I've been trying to export certain things in my scene as a cad file (like dxf or dwg) but so far nothing. I know dxf is an ASCII format but I couldn't crack it (like I did with fbx). and I've found some resources but they are for the newer versions of .net than what unity tends to use. where can I start or what should I do? any ideas?
-
don't know about the specific file types you're interested in, but generally i've had success bringing in CAD files using blender to do the file conversions – code11 Oct 03 '16 at 13:01
-
by bringing in you mean bringing in to unity? I'm sorry if I wasn't clear but I want to bring from unity to cad . I want to bring them out of unity – Henjin Oct 03 '16 at 13:09
-
How are the assets being stored already? You should just be able to convert them directly, or are you looking to export collections of objects arranged in some way in unity? – code11 Oct 03 '16 at 13:12
-
I'm trying to create these file with script according to how my scene is arranged – Henjin Oct 03 '16 at 13:14
-
DXF format can support many types of curves (lines, arcs, splines,...etc) and also facets. Here is a good tutorial for exporting to dxf file: http://paulbourke.net/dataformats/dxf/min3d.html – fang Oct 04 '16 at 04:53
-
Thank you @fang , you should have posted that as an answer – Henjin Oct 04 '16 at 06:58
2 Answers
DXF file is a good choice to export your cad data. It supports many types of curves (lines, arcs, splines,...etc) and also facets and it is in ASCII format. The DXF format can be relatively confusing at the first glance, but it is actually relatively simple. A DXF file is mainly consist of 6 sections (HEADER, CLASSES, TABLES, BLOCKS, ENTITIES and OBJECTS) and each entry (whether an integer value or a double value) is started with a group code (which by itself is an integer).
Here are two links to get you started to learn more about DXF export/import:
1) A good tutorial for exporting to dxf file.
2) A comprehensive DXF reference
To export triangular facets, you will use 3DFACE entity. To export curves, use ARC, LINE, CIRCLE, ELLIPSE, SPLINE and POLYLINE entities. You can find the description about these entities under the ENTITIES section in the DXF reference pdf file (the 2nd reference above).

- 3,473
- 1
- 13
- 19
This is a great question, and one that is somewhat hard to search for, since everyone is concerned about importing things into unity.
However, I did find a way to export things to .obj files which you might be able to convert to what you want.
http://wiki.unity3d.com/index.php?title=ObjExporter
I am a bit ignorant of the file type specifics of .obj, but I believe it supports multiple disconnected 3d objects, which is what you want.
For completeness sake, trying to do the same thing with animations however seems impossible for the moment.

- 1,986
- 5
- 29
- 37
-
thank you, I used it to create fbx files but the content in a cad file is completely different . in a 3d file we have vertex coordinates and shaders and materials but in a cad file we have line rectangle circle and curves. and if you open an ascii fbx file you are able to distinguish between different types of objects and their connection with each other , thats not the case with a cad file , any ways , thanks – Henjin Oct 03 '16 at 13:32