Inserting entity to cadinsert

Discuss and ask questions about CAD .NET library.

Moderators: SDS, support, admin

Post Reply
VijayKumar
Posts: 11
Joined: 17 Oct 2019, 09:33

Inserting entity to cadinsert

Post by VijayKumar » 15 Nov 2019, 12:03

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.

support
Posts: 3271
Joined: 30 Mar 2005, 11:36
Contact:

Re: Inserting entity to cadinsert

Post by support » 15 Nov 2019, 20:45

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
Technical Support E-mail: support@cadsofttools.com
Chat support on Skype: cadsofttools.support

Post Reply