Field vdLoadXref
- Namespace
- vdWebLibrary
- Assembly
- JsPropertiesExtractor.dll
Get/Set a method of vdLoadXrefDelegate type , that called when an External Reference Block need to be loaded from a file
public vdLoadXrefDelegate vdLoadXref
Returns
- vdLoadXrefDelegate
- Get/Set a method of type , that called when an External Reference Block need to be loaded from a file
Examples
Loading a drawing that contains ExternalReferences (xrefs)
var vdcanvas; // keep the vdcanvas control global for quick access inside the functions since it is the only one in the this page
function vdrawInitPageLoad()
{//Intiallize theweb control inside this function.It must be called inside onload event of this page
vdcanvas = vdmanager.AttachCanvas("canvas"); //create a new web control and attach it to the canvas element
vdcanvas.vdLoadXref = _vdLoadXrefDelegate;
vdcanvas.SelectDocument('file:///D:/somepath/exportedscript.vds');
}
function _vdLoadXrefDelegate(e)
{
//e.UrlPath is the path of the xref that vdraw is trying to load, for example 'file:///D:/somepath/xref.vdml.vds'
var originalPath = e.target.GetDocument().pathname;//get the full path filename of the main drawing ('file:///D:/somepath/exportedscript.vds')
const directory = originalPath.substring(0, originalPath.lastIndexOf('/')); //get the directoy with out filename( 'file:///D:/somepat')
const fileName = e.UrlPath.split('/').pop();//get the filename of the xref with the extension ('xref.vdml.vds')
e.UrlPath = directory + '/' + fileName; //try to load xref from the same directory of the main document ('file:///D:/somepath/xref.vdml.vds')
}