Author Topic: Get all blocks in layout  (Read 2533 times)

0 Members and 1 Guest are viewing this topic.

shsss1985

  • Guest
Get all blocks in layout
« on: January 24, 2012, 02:27:34 AM »
Hello everyone!
Need help.
I need select all blocks in layout.
Code for select layout:
Code: [Select]
DBDictionary layouts = (DBDictionary) tr.GetObject(db.LayoutDictionaryId, OpenMode.ForRead);
foreach(DBDictionary ent in layouts)
{
Layout lay = (Layout) tr.GeetObject(ent.Value, OpenMode.ForRead);
if (lay.LayoutName == "object_03")
{
...
//need gets all blocks
}
}

thx.

kaefer

  • Guest
Re: Get all blocks in layout
« Reply #1 on: January 24, 2012, 12:40:54 PM »
I need select all blocks in layout.

Please be more specific about what you want to accomplish. Somehow I get the impression that merely "selecting" the BlockReferences, that is, creating a selection set for further user interaction, is not what you're really after.

If you want to iterate through the objects contained in the Layout and do specific things depending on object type or whatever, see the Layout.BlockTableRecordId property. You can open that BlockTableRecord like any other BTR and loop through its contents.

shsss1985

  • Guest
Re: Get all blocks in layout
« Reply #2 on: February 06, 2012, 10:43:40 PM »
thx for answer, Layout.BlockTableRecordId - its very help.