[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: gEDA-user: Commercial CAD, land pattern generators report



On Aug 11, 2010, at 12:28 PM, John Griessen wrote;
> 
> What's a good reference about DXF?

Arghhh... I've spent a bit of time trying to read .dxf correctly.  My first shot was for reading .dxf to drive a simple laser cutter that used bastardized HP/GL.  I did an ad hoc parser in C after reading Autocad's online documentation, and only attempted to pull out the fraction of the information that interested me. Let's just say I recommend against that approach. ;)

My next version of the laser cutter CAM used the Ribbonsoft's dxflib (GPL).  dxflib is C++ and is actually a pretty reasonable interface for reading dxf and is very robust.  Writing dxf with it requires a pretty good knowledge of the structure of dxf, but reading is straightforward.

About that... the structure of dxf... Imagine a design committee consisting entirely of passive-aggressive, 'B' ark chimpanzees that were only convinced to join the project for the meeting donuts.  Now imagine the file format they would specify.  Now imagine that file format evolved to support things that were never originally intended. That is dxf.

I am now working on a new project -- with the intent of reading 2D dxf and producing real, proper, good-to-go, CNC machine g-code that doesn't crash the milling machine or break tools.  Wish me luck.  (Or volunteer to help??? :)  Anyway, I'm doing the project in Python, and after looking for a good dxf reader in Python, briefly considered putting a Python wrapper around dxflib.  But that is not a great fit... it's hard to make a Pythonic interface to dxf around dxflib.  So... I decided to commit the cardinal sin of all programmers, writing my own library... I can get away with that since there is no one to fire me for such a silly decision.

And now I finally get to the point of this rambling e-mail.  Since what I want is 100%  interoperability with QCad (from Ribbonsoft, uses dxflib for file I/O), I concluded that reading the dxflib code very carefully is about the best dxf file documentation that is around. Autodesk has a lot of online documentation of the file format, and that is indispensable.  dxf comes in several versions, and each is documented separately.  The documentation that exists on the Autocad web site is reasonably well organized once you learn to navigate it.  Be aware, however, that certain 3D entities are *not* documented, they are binary blobs and you can only get the spec by paying for a license from Autocad and signing an NDA.  So no open source dxf library will ever be able to handle all of dxf.  My immediate goal is to write a library that can make sense of all 2D information in a complete and coherent way, provide a Pythonic interface for reading and writing dxf, and gracefully ignore or perhaps read-and-blobify anything it doesn't understand without crashing or hanging.  The not-crashing-and-hanging part will put it ahead of at least some commercial alternatives.

HTH

If you are interested in talking about my Python dxf I/O lib we should take that off-list.

-dave



_______________________________________________
geda-user mailing list
geda-user@xxxxxxxxxxxxxx
http://www.seul.org/cgi-bin/mailman/listinfo/geda-user