Page 1 of 1

Inserting entity to cadinsert

Posted: 15 Nov 2019, 12:03
by VijayKumar
I am creating a circle and adding the circle to CADBlock and to CADInsert as mentioned in the code below. But circle is not visible on screen only dot is visible vInsert.Box.Wdth and height is 0.
Please guide me to add entity to block and vinsert

CADBlock tempcadBlock = new CADBlock();
tempcadBlock.Name = "caption";

CADCircle vCircle = new CADCircle();
vCircle.LineTypeScale = 0.2f;
vCircle.Radius = 500;
vCircle.Point = new DPoint(10,10,0);
vCircle.Color = Color.Green;
vCircle.Layer = cadImage.Converter.LayerByName("caption");

tempcadBlock.AddEntity(vCircle);

cadImage.Converter.Loads(tempcadBlock);
cadImage.Converter.GetSection(ConvSection.Blocks).AddEntity(tempcadBlock);

CADInsert vInsert = new CADInsert();
vInsert.Block = tempcadBlock;
vInsert.Point = new DPoint(10,10,0);

CADLayout vLayout;
vLayout = cadflow.Layouts[0];

if (vLayout == null) return false;

cadImage.Converter.Loads(vInsert);
vLayout.AddEntity(vInsert);

can you give me guide and advice in detail.

Re: Inserting entity to cadinsert

Posted: 15 Nov 2019, 20:45
by support
Hello,

CADBlock object determines a non-visual block definition which stores entities, block entities are not visible and cannot have a Layer property. To add a CAD entity to the block definition, one should use a CADBlock.AddEntity method.

CADInsert object determines a visual block reference and doesn't store entities itself (except CADAttrib), but makes block entities visible, being placed on a layout. It is mandatory to set the following CADInsert properties:

CADInsert.Block - the CADBlock object which CADInsert refers to
CADInsert.Point - CADInsert insertion point

As for the problem you encountered, we suggest to check tempcadBlock.Box and vInsert.Scale values with debugger.

Mikhail