Table of Contents

Method AddBlockSymbol

Namespace
vdWebLibrary
Assembly
JsPropertiesExtractor.dll

AddBlockSymbol(string, object, double, double, bool, object)

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.

public object AddBlockSymbol(string blockname, object insertionPt, double scale, double rotation, bool drawit, object entities)

Parameters

blockname string

The name of the desired block to be used. Block must be with exact name in the Blocks collection.

insertionPt object

The point where the block will be created in world coordination system.

scale double

The scale applied on the drawn object over the original Block.

rotation double

The vdInsert's rotation in radians.

drawit bool

Defines if the vdInsert object will be drawn.

entities object

The entities collection where the block symbol will be added. This can be the entities of layout or a block.

Returns

object

The created vdInsert object.

Examples

For example we create a new block which contains two lines and then we insert it using the AddBlockSymbol method.

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(double, double, double) method. Attention, the source .vds file is not modified.