TheSwamp

Code Red => .NET => Topic started by: shsss1985 on January 24, 2012, 02:27:34 AM

Title: Get all blocks in layout
Post by: shsss1985 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.
Title: Re: Get all blocks in layout
Post by: kaefer 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.
Title: Re: Get all blocks in layout
Post by: shsss1985 on February 06, 2012, 10:43:40 PM
thx for answer, Layout.BlockTableRecordId - its very help.