PDA

View Full Version : Importing DXF



Mr.Freeze
01-28-2002, 10:56 PM
Hi,

I'm writing a basic import function for dxf files (please don't tell me -.obj files are easier, I already implemented that but I also need dxf), but since the format is quite complex, I'm just filtering the interesting information. It is not yet ready, but I would like to know if I didn't forget some important flags or else. I would appreciate a lot if someone who knows could correct (or answer) the following (I'm just interested in importing the faces):

1. I only need to parse BLOCKs and ENTITIES
2. In BLOCK I can find some shapes which could be referenced in ENTITIES with an INSERT.
3. 3DFACE important group codes:

10,20,30, (point 1 location)
11,21,31, (point 2 location)
12,22,32, (point 3 location)
13,23,33 (point 4 location if not same as point 3)

4. INSERT important group codes:

2 (block name)
10,20,30 (insertion point)
41,42,43 (scale factor)
50 (rotation angle) (I'm not sure around which axis??)

5. POLYLINE important group codes:

70 (polyline flags (bit 6 is important))

6. VERTEX important group codes:

10,20,30 (location)
70 (vertex flags (bit 6 & 7 are important))
71,72,73,74 (index for faces)

7. Will a BLOCK base point's coordinates be added to the vertices it contains?
8. Will an INSERT base point's coordinates be added to the block it references?

Thanks a lot http://www.opengl.org/discussion_boards/ubb/smile.gif

richardve
01-29-2002, 12:49 AM
Use Wavefront files, they're easier.
http://www.wotsit.org/search.asp

heiman
01-29-2002, 05:54 AM
Freeze,

Sometime in the distant past, I wrote a DXF importer. I believe that you only need to read the entities and the import blocks, however, my memory is hazy. As for the rest of your questions...

I have the DXF file format in an HTML help document. It describes all of the entities, blocks, flags, etc. It is a well organized, hyperlinked document that provides all of the basic info you need to interpret a DXF files. I can e-mail a copy to you if you are interested.

I also have a working (but unfinished) project that imports DXF files and displays them using OpenGL. It is a Borland project, but you should be able to compile the DXF classes (after minor mods) with any compiler. I can e-mail that to you as well.

scottheiman@cox.net

[This message has been edited by heiman (edited 01-29-2002).]

Eric
01-29-2002, 06:16 AM
The main problem I have had with DXF files concerns the extrusion vector that is sometimes defined for some entities. It actually defines a new OCS using the Arbitrary Axis Algorithm but it does not seem to work with Ellipses (or Arcs, can't remember).

All in all, DXF is a pain and you can't even get solids from it !

Regards.

Eric

Coconut
01-29-2002, 07:54 AM
Originally posted by Eric:

All in all, DXF is a pain and you can't even get solids from it !



I saw posts somewhere people were able to decode those encoded SAT data in the DXF file, although I never try that.

Eric
01-31-2002, 12:02 AM
Originally posted by Coconut:
I saw posts somewhere people were able to decode those encoded SAT data in the DXF file, although I never try that.




I'll have a look for that because it is really a feature I'd like to have in my programs... For the moment, when people want to import solids they have to convert the DXF say to ASE via 3DS Max...

Thanks for the hint !

Regards.

Eric