Location of block in the EditorDemo

Discuss and ask questions about CAD .NET library.

Moderators: SDS, support, admin

Post Reply
dlwotj4274
Posts: 13
Joined: 19 Jun 2019, 07:30

Location of block in the EditorDemo

Post by dlwotj4274 » 26 Jun 2019, 11:01

Hello

When I click a block in the EditorDemo, I can see a location of block .

Image

I think that I can get a location of block by using CADInsert.Point.

I would like to know how to get this location by CADBlock instance.

I got a block instance by the blockname.

I don't know how to get a location.

Thank you

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

Re: Location of block in the EditorDemo

Post by support » 26 Jun 2019, 17:50

Hello,

To get a CADInsert location by a certain CADBlock, you need to find a CADInsert instance which refers to the given CADBlock and then use a CADInsert.Point property. For example:

Code: Select all

public static DPoint GetInsertLocationByBlock(CADImage cadImage, CADBlock block)
{
    CADInsert cadInsert = cadImage.Converter.Entities.FindAll(ent => ent.EntType == EntityType.Insert).Find(ent => (ent as CADInsert).Block.Name == block.Name) as CADInsert;
    if (cadInsert != null)
        return cadInsert.Point;
    return new DPoint(0, 0, 0); 
}
Mikhail
Technical Support E-mail: support@cadsofttools.com
Chat support on Skype: cadsofttools.support

Post Reply