.NET

Reply
Valued Contributor
swaywood
Posts: 91
Registered: ‎08-22-2013
Message 1 of 5 (156 Views)
Accepted Solution

I just feel a liitle confusing affter making several program by .net.

156 Views, 4 Replies
03-20-2014 08:36 PM

Hi all:

 

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,layouts,blocktablerecord,blockreference,entities?

 

2. How to get the object from eachother?

 

3. Modelspace is a blocktable or blocktablerecord or blockreference or other?

Hi

 

Briefly,

 

- 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.

 

 

*Expert Elite*
_gile
Posts: 2,106
Registered: ‎04-29-2006
Message 2 of 5 (132 Views)

Re : I just feel a liitle confusing affter making several program by .net.

03-20-2014 11:47 PM in reply to: swaywood

Hi

 

Briefly,

 

- 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.

 

 

Gilles Chanteau
Valued Contributor
swaywood
Posts: 91
Registered: ‎08-22-2013
Message 3 of 5 (120 Views)

Re : I just feel a liitle confusing affter making several program by .net.

03-21-2014 01:12 AM in reply to: _gile

HI Gilles:

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?

 

best regards

swaywood

 

Valued Contributor
swaywood
Posts: 91
Registered: ‎08-22-2013
Message 4 of 5 (115 Views)

Re : I just feel a liitle confusing affter making several program by .net.

03-21-2014 01:27 AM in reply to: swaywood
what is the db.PaperSpaceVportId?
the default viewpot of the first layout?
*Expert Elite*
_gile
Posts: 2,106
Registered: ‎04-29-2006
Message 5 of 5 (110 Views)

Re : I just feel a liitle confusing affter making several program by .net.

03-21-2014 01:46 AM in reply to: swaywood

I have not much time to explain you this in details.

 

Have a look at the documentation you can find here (Managed .NET reference Guide).

You can also use the mgddbg tool to explore the database.

Gilles Chanteau
Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.