[PythonCAD] I/O filters via text streams

Art Haas ahaas at airmail.net
Thu Feb 12 13:20:22 EST 2004

On Thu, Feb 12, 2004 at 10:20:22AM -0600, Eric Wilhelm wrote:
> Art,
> I mentioned this a bit a while back.  Did you ever come-up with an 
> implementation for dwg/dxf import and export to/from pythoncad?

Yes and no. The DWG stuff is at the point where there is a means of
creating a DWG class, having it read the DWG file and store all that
rich, creamy DWG goodness in itself, and then retreive the information
from the class and use it as one sees fit. DXF stuff is still little
more than just printing out the contents of the file.

Aside from the lack of writing either a DWG or DXF file, a problem with
the current DWG reader is that it won't work if the DWG info is coming
in through a pipe, as the reader does all sorts of seek()ing through the
file when reading the objects found in the object map. One can read a DWG
file from in a serial manner, but that isn't how the code does it at present.

> I'm in discussions with the author of perlcad about collaboration between 
> perlcad and CAD::Drawing.  It's looking like one thing which might come out 
> of this is a set of streaming objects which allow one I/O backend to be 
> connected directly to another.
> It occurred to me that this might be a good way to consolidate import/export 
> methods between multiple projects.
> For example, iirc, you are using an XML format for pythoncad.  If a backend 
> for CAD::Drawing could be written to handle this format, a small perl program 
> could be opened in a pipeline to load/save to/from this format or any other 
> supported format.
> It would also make a great command-line converter as well as giving any 
> program automatic import/export abilities to any other program which had a 
> working backend to CAD::Drawing.
> Any thoughts?

PythonCAD does use XML for storing files, and I'm interested in anything
that can make the format exportable to other programs.

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