DXFLIB Reads too many Items.

If you are having problems with dxflib, post here. Please report bugs here.

Moderator: andrew

DXFLIB Reads too many Items.

Postby beding » Sun Nov 14, 2010 4:15 pm

When I read some DXF files, e.g. created by ACAD, i seem much more objects than shown.
I expect some objects are stored but no longer in use, how can i see that?
beding
Newbie Member
 
Posts: 5
Joined: Mon Nov 08, 2010 12:53 pm

Postby andrew » Sun Nov 14, 2010 6:35 pm

Most likely you are reading in and displaying all block definitions that are stored in the file. A "block definition" is a named, reusable group. A "block insert" is an entity that references a block definition in a drawing. A drawing might for example contain a block definition called "screw" which contains some lines and other entities that represent a screw. A block insert might exist at position 50,50 which means that your drawing will display a screw at this position. Other block inserts might exist in other positions, reusing the same block definition.

In DXF, every entity is part of a block definition. 'Normal' entities are part of the special block definition named "*Model_Space" which contains the entire drawing and is usually displayed when opening a drawing. Entities that are part of any other block definition are only displayed if block inserts exist for that block definition.

dxflib will call DL_CreationAdapter::addBlock() and DL_CreationAdapter::endBlock() to encapsulate each individual block definition.

If you are not interested in block definitions (or block inserts) at all, simply ignore everything that is not directly part of the special block definition called "*Model_Space". In other words, ignore any DL_CreationAdapter::add*() calls that occur between DL_CreationAdapter::addBlock() and DL_CreationAdapter::endBlock() if the block name is not "*ModelSpace".
User avatar
andrew
Site Admin
 
Posts: 2549
Joined: Fri Mar 30, 2007 6:07 am

Postby beding » Sun Nov 14, 2010 7:17 pm

Thanks, that works!
beding
Newbie Member
 
Posts: 5
Joined: Mon Nov 08, 2010 12:53 pm


Return to dxflib Troubleshooting and Problems

Who is online

Users browsing this forum: No registered users and 2 guests