[PythonCAD] Re: [cad-linux] First hack at DWG reading for PythonCAD

Eric Wilhelm ewilhelm at sbcglobal.net
Thu Aug 28 20:49:32 EDT 2003


> The following was supposedly scribed by
> Art Haas
> on Thursday 28 August 2003 05:57 pm:

>The code you have is just the first take on reading the DWG files. I'm
>sure there are errors in it - the R13/R14 files I have don't have all
>the entities that the spec describes, so I'm sure I've goofed up on some
>of them.

Sorry to freak out everybody's e-mail client as I switch addresses and jump 
threads between mailing lists.

I'm looking at a fairly simple R14 file with the dwg.py and a fresh build of 
python:
$ ~/src/Python-2.2.3/python dwg.py sm14_chck.dwg
<not sure where to snip>
zombie: 0
itemclassid: 1f2
bitpos after itemclassid: 2278
classnum: 506
version: 0
appname: 'AutoCAD 2000'
cplusplusclassname: 'AcDbXrecord'
classdxfname: 'XRECORD'
zombie: 0
itemclassid: 1f3
bitpos after itemclassid: 2587
Traceback (most recent call last):
  File "dwg.py", line 4450, in ?
    dump_info(_fh)
  File "dwg.py", line 139, in dump_info
    _cmap = decode_class_data(_class_data)
  File "dwg.py", line 973, in decode_class_data
    _bitpos, _classnum = get_bit_short(data, _bitpos)
  File "dwg.py", line 4169, in get_bit_short
    _sh = get_bits(data, 16, (offset + 2))
  File "dwg.py", line 4408, in get_bits
    _b2 = (data[_idx] & _mask2)
IndexError: array index out of range

the file is only 36k.  What's the attachment policy on this list?

--Eric



More information about the PythonCAD mailing list