%%PageItemTitle%%

VectorDraw Web Library

JsPropertiesExtractor Send comments on this topic.
AddBlockSymbol Method
See Also  Example
vdWebLibrary Namespace > vdrawObj Class : AddBlockSymbol Method
blockname
The name of the desired block to be used. Block must be with exact name in the Blocks collection.
insertionPt
The point where the block will be created in world coordination system.
scale
The scale applied on the drawn object over the original Block.
rotation
The vdInsert's rotation in radians.
drawit
Defines if the vdInsert object will be drawn.
entities
The entities collection where the block symbol will be added. This can be the entities of layout or a block.
Adds a new vdInsert object in the document. The insert's block is found in the Document's collection and by using the given blockname.

Syntax

JScript 
public function AddBlockSymbol( 
   blockname : String,
   insertionPt : Object,
   scale : double,
   rotation : double,
   drawit : boolean,
   entities : Object
) : Object;

Parameters

blockname
The name of the desired block to be used. Block must be with exact name in the Blocks collection.
insertionPt
The point where the block will be created in world coordination system.
scale
The scale applied on the drawn object over the original Block.
rotation
The vdInsert's rotation in radians.
drawit
Defines if the vdInsert object will be drawn.
entities
The entities collection where the block symbol will be added. This can be the entities of layout or a block.

Return Value

The created vdInsert object.

Example

For example we create a new block which contains two lines and then we insert it using the AddBlockSymbol method.
C#Copy Code
  
var blk = vdcanvas.AddBlock("myblock"); 
//add a new line to block 
                var line1 = vdcanvas.AddLine([0, 0, 0],[2, 0, 0],false,blk.Entities); 
 
//we can set the line color to be 'byblock'(it will get the color of the insertBlock, else it will get the vdcanvas.GetActivePenColor() 
line1.PenColor =  vdConst.colorFromString("byblock"); 
 
//add an other new line to block 
                var line2 = vdcanvas.AddLine([1, -1, 0],[1, 1, 0],false,blk.Entities); 
 
//we can set the line color to be 'byblock'(it will get the color of the insertBlock, else it will get the vdcanvas.GetActivePenColor() 
line2.PenColor =  vdConst.colorFromString("byblock");); 
 
//we insert the block  
vdcanvas.AddBlockSymbol("myblock",[0,0,0],1.0,0,true);

Remarks

You can create new points by using the newpoint method. Attention, the source .vds file is not modified.

See Also