PDA

View Full Version : Cad model File reader



Andy Suma
02-12-2009, 08:49 PM
Greetings,
I am trying to read any file format(.iges, .dxf, .asm, .prt etc) to load a 3d model in my OpenGL Program and visualize it(The program is to visualise the Mechanical part of an automobile design, assemble the parts disassemble it and visualise one by one). I went through the specification of .iges format but I found its very much difficult since it is having huge number of entity set, for which I need to write the parser for each entity.

When I tried for .dxf format one of my friend told this format gives only the wire mode of the model not the fill mode(Is this true?).

Can anyone guide me, which file format should give me the "fill mode" of the model after reading it, and will be easy also to write a file reader for that, which will give me vertices, normals etc.

Also kindly direct me to any available file reader so that I can directly use it.

I will really appreciate the help.

Regards
Andy

_NK47
02-13-2009, 04:22 AM
"When I tried for .dxf format one of my friend told this format gives only the wire mode of the model not the fill mode(Is this true?)."
makes no sense at all. all file formats should be able to give you geometry information like vertices, texcoords, normals (can be computed) and faces aka triangles because thats how OpenGL understands geometry. as long as you have vertices you can connect them with triangles and display any geometry you like. it's then a matter of rendering how you display them, lit, textured, fancy shaded, wireframe or static colored. don't know any CAD file format parsers but the overall process is to parse and read out all the geometry information you can get.

ZbuffeR
02-13-2009, 06:12 AM
In fact .dxf can be also 2D line drawings, so no surface information.

_NK47
02-13-2009, 06:44 AM
true thanks. :) that explains the "wire mode" word, didnt get that at first, my bad. *.dxf then excludes loading 3d models as all vertices are on a 2d plane. probably *.dwg then or any suitable 3d file format like *.3ds *.obj *.x *.ase. the *.x and *.obj file formats are plain text, easy to parse and to adjust.

ZbuffeR
02-13-2009, 07:16 AM
You misread or I was not clear enough : there are both 2D and 3D dxf files.
The main problem with 3D dxf is that it is very basic, no color, no normal data, no texture coords, nothing.
obj is pretty simple and neat, has normals and texcoords. most 3D packages can import/export it.
ase stands for "ascii scene export" It is very detailed (but complex too), but reserved for 3dsmax.

Andy Suma
02-13-2009, 09:08 AM
Thanks for your replies.

kindly see these links:

http://www.cnczone.com/forums/archive/index.php/t-19568.html

http://www.escape.de/~quincunx/dxfviewer/index.html

some people wrote there that .dxf format is only generates wireframe model.

So my question is now---

Qn1). Can a .dxf file represent a 3d model?
Qn1a). If yes, and If I read that .dxf file with a file reader, will it generate a wire frame view only or surfaces also.

@ZbuffeR
"The main problem with 3D dxf is that it is very basic, no color, no normal data, no texture coords, nothing."

Qn2).I wanna use a 3D model to visualise an automobile design. If there is no color, no normal, no texture data, I dont think .dxf file I should use. What do you suggest?

Qn3). Kindly let me know all the easily readable file formats, which I can read and can get color, normals, textures etc. so that I can read and put all the info(vertices, colors, normals, textures) in a display list and render the model in OpenGL.

Warm Regards,
Andy

shankyrhodes
02-14-2009, 06:05 AM
VizUp Reducer is designed specially for game developers, architects, and 3D designers. With this software in place, they get a pain-free way to reduce polygons and optimize 3D models, and presentations before publishing them on Web. Supports Wavefront .OBJ, VRML 2.0/97 and StereoLitho (.STL) file formats.

http://www.dirtystreetadvertising.com
info@dirtystreetadvertising.com
0800 4118 752

ZbuffeR
02-14-2009, 08:40 AM
Well MeshLab does all that http://meshlab.sourceforge.net/ and more.

What would be a reason to buy your expensive software instead of using an opensource one ?

_NK47
02-16-2009, 05:32 AM
MeshLab rocks! love it.