Page 1 of 1

Location of block in the EditorDemo

Posted: 26 Jun 2019, 11:01
by dlwotj4274
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

Re: Location of block in the EditorDemo

Posted: 26 Jun 2019, 17:50
by support
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