What Bobby told you isn't precisely correct, which may be what
lead you off track.
A Layout is NOT a block.
A Layout is an object that represents a layout tab. Each layout
tab displays the contents of a block (whose names begin with
'Paper_Space' followed by a number, or 'Model_Space' for the
model tab). In other words, the entities that appear on a layout
tab are contained in a block that's associated with the layout.
If you have the ObjectId of the layout, open it and cast it to a
Layout Object and then get the ObjectId of the BlockTableRecord
that contains the entities appearing on the layout from the Layout's
BlockTableRecordId property. Then open that id, and cast it to a
BlockTableRecord object object and iterate over its contents using
For Each/Next to get the ObjectId of each entity in the block.
--
http://www.caddzone.com
AcadXTabs: MDI Document Tabs for AutoCAD
Supporting AutoCAD 2000 through 2010
http://www.acadxtabs.com
Email: string.Format("{0}@{1}.com", "tonyt", "caddzone");
wrote in message news:6294062@discussion.autodesk.com...
I already tried to access the layout as a block.
I tried following
Dim acBlkTbl As BlockTable =
CType(acTrans.GetObject(db.BlockTableId, OpenMode.ForRead), BlockTable)
Dim acBlkTblRec As BlockTableRecord =
CType(acTrans.GetObject(acBlkTbl(layoutId.ToString), OpenMode.ForRead),
BlockTableRecord)
and
Dim acBlkTbl As BlockTable =
CType(acTrans.GetObject(db.BlockTableId, OpenMode.ForRead), BlockTable)
Dim acBlkTblRec As BlockTableRecord =
CType(acTrans.GetObject(acBlkTbl(LayoutName), OpenMode.ForRead),
BlockTableRecord)
layoutID is the ObjectId of the layout
Before a check is done if the layout does exist
Both ended with runtime exception 'eKeyNotFound'