using (Transaction tr = doc.Database.TransactionManager.StartTransaction())
{
foreach (ObjectId objId in blkSelIds)
{
BlockReference br = (BlockReference)tr.GetObject(objId, OpenMode.ForWrite);
....
}
}
Consider the BlockName, or BlockId Properties of your BlockReference Object.
I'd grab the owner id off the block reference. It'll be the id of the block table record owning it, open that and you can access it's name property
Out of curiosity... Why wouldn't you use the BlockName Property to query the name only, or BlockId to open via GetObject()?Because I haven't had the opportunity of somebody as awesome as you pointing those properties out to me yet :| it makes me curious if the 'get' function for the BlockName property opens the owner and grabs the name property.
Out of curiosity... Why wouldn't you use the BlockName Property to query the name only, or BlockId to open via GetObject()?
Because I haven't had the opportunity of somebody as awesome as you pointing those properties out to me yet...
... makes me curious if the 'get' function for the BlockName property opens the owner and grabs the name property.
Well I haven't found the layout yet (either ID or name, doesn't matter)
...
br.BlockId --> it doesn't return me the same ID as my current layout ID
Well I haven't found the layout yet (either ID or name, doesn't matter)
Layout Object (http://entercad.ru/acadauto.en/index.html?page=idh_layout_object.htm)
The representation of a layout is slightly different in ActiveX from that of the AutoCAD user interface. In ActiveX, the content of a standard AutoCAD layout is broken out into two separate objects: Layout object and Block object. The Layout object contains the plot settings and the visual properties of the layout as it appears in the AutoCAD user interface. The Block object contains the geometry for the layout.
Each Layout object is associated with one Block object. To access the Block object associated with a given layout, use the Block property. Conversely, each Block object is associated with one Layout object. To access the Layout object associated with a given Block, use the Layout property for that block.
In ActiveX, in addition to the paper space layouts, model space is considered a layout.
BlockReference br = (BlockReference)tr.GetObject(objId, OpenMode.ForRead);
br.BlockName return me either Model_Space or Paper_Space --> it doesn't tell me the exact layout name
br.BlockId --> it doesn't return me the same ID as my current layout ID