%%PageItemTitle%%

VectorDraw Web Library

JsPropertiesExtractor Send comments on this topic.
AddBlockFromFile Method
See Also  Example
vdWebLibrary Namespace > vdrawObj Class : AddBlockFromFile Method
filename
The filename of the file from where all the entities for the block will be taken.
blockname
The name of the block to be added.
overwrite
If the passed blockname exist and the overwrite is true the the block entities will be replaced from the passed filename drawing model entities.
loadedDelegate
Optional. If present, is a user define function of vdLoadXrefDelegate type, that will be called when the block if successfully loaded.
Creates a vdBlock object from a file and add it in the blocks collection of the document.

Syntax

JScript 
public function AddBlockFromFile( 
   filename : String,
   blockname : String,
   overwrite : boolean,
   loadedDelegate : vdLoadXrefDelegate
) : Object;

Parameters

filename
The filename of the file from where all the entities for the block will be taken.
blockname
The name of the block to be added.
overwrite
If the passed blockname exist and the overwrite is true the the block entities will be replaced from the passed filename drawing model entities.
loadedDelegate
Optional. If present, is a user define function of vdLoadXrefDelegate type, that will be called when the block if successfully loaded.

Return Value

The created block object.

Example

C#Copy Code
  
var vdcanvas = vdmanager.vdrawObject(canvasId); 
//create a block from the file 'test.vds' and assign 'myblock' key name 
   var blk = vdcanvas.AddBlockFromFile("test.vds", "myblock", true); 
   //insert the block in four different positions 
   vdcanvas.AddBlockSymbol("myblock", [0, 0, 0], 1, 0, true, null); 
   vdcanvas.AddBlockSymbol("myblock", [7, 0, 0], 1, 0, true, null); 
   vdcanvas.AddBlockSymbol("myblock", [0, 7, 0], 1, 0, true, null); 
   vdcanvas.AddBlockSymbol("myblock", [7, 7, 0], 1, 0, true, null);

Remarks

The origin of the block is defined by the BasePoint property of the passed drawing filename

See Also