I just feel a liitle confusing affter making several program by .net.
Could anybody kindly solve my confusions completely?
1. what's the relation about the blocktable,modelspace,paperspace,currentspace,layo
2. How to get the object from eachother?
3. Modelspace is a blocktable or blocktablerecord or blockreference or other?
Solved! Go to Solution.
- The BlockTable is a SymbolTable (as Layertable, TextStyletable...) A SymbolTable is a collection of SymbolTableRecords: BlocktTableRecords for the BlockTable, LayerTableRecords for the LayerTable and so on.
- As others SymbolTableRecords, BlockTableRecords are non-graphical objects (only records) but can be considered as containers for graphical objects (Entity). Any DWG contains some special BlockTableRecords which are linked to Layouts: model space and paper space(s). The BlockTable may also contain other BlockTableRecords: the block definitions and xrefs. Editing a block definition in the block editor (BEDIT command) is quite similar to work in the model space layout.
- A Layout is mainly a plot settings. The layout.BlocktableRecord property is used to get the BlockTableRecord linked to the Layout as the BlockTableRecord.LayoutId property to get the Layout linked to the BlockTableRecord (if the BlockTableRecord.IsLayout property is true).
- A BlockReference is a graphical object (derived from Entity) which is an insertion of a BlockTableRecord in another BlockTableRecord (a space or a block definition). All BlockReferences which refer to the same BlockTableRecord contains the same entities but may differ by their geometry (position, rotation, scales) they're geometric representations of the BlockTableRecord. If the blockTableRecord contains some AttributeDefinitions, the BlockReferences may display AttributeReferences. The BlockTableRecord objectId which a BlockReference refers to is got using the BlockReference.BlockTableRecord property and the all refrences of a BlocktableRecord can be got using the BlockTableRecord.GetBlockReferenceIds() method.
Thanks for your patient reply.
I try to understand the objects.
Are the following is correct?
viewport like a window which can look from layout and can zoom by the factor.
layout just like a piece of paper
layout contains some viewports and other entities.
paperspace contains several layouts(paper)
modelspace or paperspace is blocktablerecord and just like a 'big' blockdefinition?
blockreference is a type of entity belongs to modelspace or layout?
and layout belongs to paperspace?
I have some other question:
is the db.CurrentSpaceId the same with paperspaceid?
if it is why the following code get the current layout? The DWG have 3 layouts.
BlockTableRecord btr = (BlockTableRecord)tr.GetObject(db.CurrentSpaceId, OpenMode.ForRead);
Layout lay = (Layout)tr.GetObject(btr.LayoutId, OpenMode.ForRead);
How can I get the layout collection?
Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register