sry..plz help(DXF question)

I'm not sure here is the good place to ask dxf question..plz help
............
I have a software that needs to process dxf files and I am having a
nightmare trying to find the absolute corrdinates of LINEs inside
blocks.

This is what I know about BLOCKS:

Each BLOCK (in the BLOCKS section) has a block name that is related to
an INSERT entity (In the ENTITIES section).
The INSERT entity defines the transformation parameters such as origin,
scale and rotation, to transform the BLOCK coordinates from relative to
absolute coordinates.
All coordinates in the BLOCK may be transformed using the parameters
defined in INSERT.
Each BLOCK ends with ENDBLK.

This is what I need to do:

I need to transform the relative coordinates of LINEs inside blocks (in
the BLOCKS section) to absolute coordinates.
What I do is search (using the block name) the corresponding INSERT
entity (in the ENTITIES section) which gives me the coordinates of the
block, so by adding the relative + block corrdinates I can obtain the
absolute coordinates for LINEs.

SO FAR THE EXPLANATION, NOW THE PROBLEM TO SOLVE:

What can I do if I find more than one INSERT entity with the same block
name ?
How do I know which one applies to each LINE, since for a given block
name there is only one BLOCK structure in the blocks SECTION but in
some cases there is more than one INSERT entity in the ENTITIES
section.

Thanks for your help
winthan

P Dolbey's picture

This isn't really the forum for answering questions about DXF - some of the AutoCAD forums may be more useful.

...BUT I think your problem is that you assume a 1 to 1 relationship between BLOCKS and INSERTS which is not the case. Think about this from a purely drawing point of view - the idea behind BLOCKS is that it enables repeated components (nuts, bolts, etc.) to be inserted into a drawing at many locations, so what you describe is totally consistent with this useage.

What you seem to be doing is iterating through the BLOCKs collection to find the corresponding INSERT. Try reversing your logic and iterating over the INSERTs to find the corresponding BLOCK.

HTH Pete