[PythonCAD] Looking for DXF help

Art Haas ahaas at airmail.net
Tue Feb 10 14:13:59 EST 2004

On Tue, Feb 10, 2004 at 12:01:27PM -0500, Vic Kelson wrote:
> Hi All,
> I am in need of code for writing DXF or DWG files from Python. My 
> application is pretty simple, only 2-D, but I need to write in 
> world-coordinates. The application is drawing geological cross-sections 
> from spatial data and lithological data. I have done this in 1998 using 
> VB (ugh!), but my new data management framework is all Python (yeah!). I 
> can of course write DXF files "by hand", but I'd really rather use a 
> library if one exists.
> Incidentally, is the OpenDWG library python-able? SWIG-able? Not quite 
> "open", but it's pretty good...
> Does PythonCAD plot to scale? Does it have hatching/fill patterns? Would 
> it be a capable cross-section drawing tool (in Win32 or Linux)?


Unfortunately PythonCAD won't do what you need. The two features you're
looking for - plotting and hatching - are the two big missing parts of
the program as it currently stands. Sorry.

As for handling DWG and DXF files, there is code in PythonCAD for
reading these formats, but no code for writing them. Coding up a DXF
writer will probably be much easier than a DWG writer due to the nature
of the DWG file format - binary, lots of checksums, bitstreams for
storing the data, and other unpleasantness to deal with.

I don't believe the OpenDWG library is has a Python interface or SWIG
interface at the moment, but the best source of info is the OpenDWG

Sorry to inform you that PythonCAD can't help you right now.

Art Haas

Man once surrendering his reason, has no remaining guard against absurdities
the most monstrous, and like a ship without rudder, is the sport of every wind.

-Thomas Jefferson to James Smith, 1822

More information about the PythonCAD mailing list