I am trying to design and develop a DXF importer using C++. I have gone through the DXF references starting from version 2000 onwards. There are four things which have put the development on hold for me right now.
1) Handles for each entity. Are they really important? If so, then how are they related to other entities?
2) Entities such as ARC, POLYLINE, TEXT etc occurs in BLOCKS section and in ENTITIES section. What difference does these two sections make? Why not all the entities are placed in ENTITIES section?
3) What is INSERT entity? How does this work? Does it have any visualization (as it contains insertion point, scale and rotation factors)? If so, how is it represented graphically? As a point (as it contains only one point )?
4) I see that some points are in OCS and some are in WCS. How do I convert OCS to WCS? For this point I did some google research and didn't get much help, as most of them use auto-lisp for this and I am using C++.
Kindly learned people guide me, by clarifying these doubts.
Thanks in advance
>> 1) Handles for each entity. Are they really important?
Handles are like database ID's, so yes, they are important as sometimes objects are referenced one to the other (some kind of associative geometry like dimensions, hatches, ...) ==> therefor the handle is really important.
There exist old DXF-versions (I think <= 12) that might not necessarily need them in the DXF, but it's unusual ... and these DXF files sometimes creates faults with current products.
>> 2) Entities such as ARC, POLYLINE, TEXT etc occurs in BLOCKS section and in ENTITIES section.
>> What difference does these two sections make
One section is what you draw (called modelspace, in DXF it's the entities section), and entities can also exist in symbols (block-definitions). So if you want to create a symbol called WHEEL you will have the geometry for drawing the wheel in the block-section for the blockdefinition WHEEL .... and then this symbol might be inserted in the modelspace ==> called INSERT
>> 3) What is INSERT entity? How does this work?
It's a block or symbol that is used to structure drawings. E.g. to have 4 equal wheels on a drawing of a car you don't need to draw them 4 times, you just create it once, make a block-definition and then you INSERT this block 4 times in the modelspace. Next advantage: if you need another rim ==> you modify just one time the blockdefintion to draw a new rim, save the blockdefinition and all occurances of the insertion of block WHEEL are updated.
>> How do I convert OCS to WCS?
Within AutoCAD you have these functions ready in all API's, otherwise you'll have to use geometry-algorythms for transfering points with matrix-definitions.
HTH, - alfred -
Thanks for your quick reply. Let me explain you what I understood. We define the geometry of an entity (say wheel in your example) in the BLOCKS section. And this entity is inserted wherever required in the ENTITIES section using INSERT entity. Am I right? If so, then how does it associate to the block defined in BLOCK section? Using Handle or using block name?
Regarding the conversion of OCS to WCS, I need the algorithm or procedure how it should be done.
Also, can you just explain me about DIMENSION please?
Thanks once again.
>> Also, can you just explain me about DIMENSION please?
Have you found the DXF-description? I can't describe now every single entity and it's representation in DXF. Check >>>that<<<.
>> Am I right? If so, then how does it associate to the block defined in BLOCK section?
>> Using Handle or using block name?
Blockname ... but at least look into the DXF description.
If you don't know how an entity is saved in the DXF then create such an entity in AutoCAD and save the drawing as DXF.
If you have no license then download a 30day testversion. But I guess you have one, because you need to test your DXF's if they are valid at all.
- alfred -
Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register