[PythonCAD] Next step with DWG/DXF readers

Art Haas ahaas at airmail.net
Mon Sep 8 17:42:45 EDT 2003


Hi.

As it looks like the basic reading functionality is working well, it is
time to look at actually doing something useful with the data in these
files besided printing it out. I'm looking for some ideas regarding the
ways that presenting the data in the files should be done. There is
still more to learn about the file data, but I'd like to start working
on at least a first version of an interface for getting the data.

My initial idea is roughly to make a DWG/DXF class and then provide a
few methods for retrieving the data. Here's some fictional Python code
to show what I'm considering...

$ python
>>> import dwg
>>> cadfile = dwg.Dwg("/path/to/the/dwg/file.dwg")
>>> hdata = cadfile.getHeaderData()
[ ... hdata is a dict with all the header variables ... ]
>>> cdata = cadfile.getClassData()
[ ... cdata is a dict or list with the class data ... ]
>>> for entity in cadfile.entityCount():
...     ent = cadfile.getEntity()
[ ... sequentially retrieve entities ... ]

What is written above is just a starting point. I'm thinking that each
entity should be returned as a dictionary, with each key being the DXF
code for the component of that entity, or maybe the key being a
descriptive string.

While trying to write this I'm hoping to make things useful so that
people not using PythonCAD could still get these DXF/DWG readers and
maybe use them for projects of their own. I can see some clever person
writing a {DWG/DXF}->SVG converter, or converters to other cad formats.

Ideas welcomed. Perhaps people using the OpenDWG libraries can chime in
with some suggestions.

Art

P.S. - On a completely unrelated topic, I'm looking for a little modem
expertise. I have a dialup connection with a 56K modem, and things have
been working just fine until roughly 4 days ago. The modem setup had not
been touched in months and survived many Linux kernel and glibc
upgrades. For about the last few days though, the modem connections
speed has pluged - my 56K modem is now essentially a 14.4K modem. A call
to my ISP informed me that they haven't been changing hardware and that
things on their end are apparently working smoothly. My phone connection
is my normal telephone line, and when I'm on the phone the connection
seems decent enough.

Things went blammo here after we had several days of rain. Once during
the rain I was online then abruptly disconnected after what I'm guessing
was a lightning strike somewhere. It seems like after that my connection
speed has been cut down almost to one-third of its previous speed. My
computer is on a surge protector and is fine, and the modem does still
works, though something is certainly amiss. Any ideas from out there
with regards to testing the modem and especially testing the phone line
connection? 

Art

-- 
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