.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

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

4 REPLIES 4
SOLVED
Reply
Message 1 of 5
swaywood
448 Views, 4 Replies

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

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?

4 REPLIES 4
Message 2 of 5
_gile
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
Programmation AutoCAD LISP/.NET
GileCAD
GitHub

Message 3 of 5
swaywood
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

 

Message 4 of 5
swaywood
in reply to: swaywood

what is the db.PaperSpaceVportId?
the default viewpot of the first layout?
Message 5 of 5
_gile
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
Programmation AutoCAD LISP/.NET
GileCAD
GitHub

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost