2 # Copyright (c) 2003 Art Haas
4 # This file is part of PythonCAD.
6 # PythonCAD is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 2 of the License, or
9 # (at your option) any later version.
11 # PythonCAD is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with PythonCAD; if not, write to the Free Software
18 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 # read in an AutoCAD R15 DWG file
27 from PythonCAD
.Generic
import dwgbase
28 from PythonCAD
.Generic
import dwgutil
30 def initialize_dwg(dwg
):
31 _handle
= dwg
.getHandle()
33 _buf
= _handle
.read(6)
35 raise ValueError, "File not R15 DWG format"
36 _handle
.seek(7, 1) # padding and a revisionbyte
37 _offset
= struct
.unpack('<l', _handle
.read(4))[0]
39 dwg
.setOffset('IMAGES', (_offset
, None))
40 _handle
.seek(2, 1) # two unknown bytes
41 _codepage
, _count
= struct
.unpack('<hl', _handle
.read(6))
42 for _i
in range(_count
):
43 _rec
, _seek
, _size
= struct
.unpack('<Bll', _handle
.read(9))
44 if _rec
== 0: # header
45 dwg
.setOffset('HEADERS', (_seek
, _size
))
46 elif _rec
== 1: # class
47 dwg
.setOffset('CLASSES', (_seek
, _size
))
48 elif _rec
== 2: # object map
49 dwg
.setOffset('OBJECTS', (_seek
, _size
))
50 elif _rec
== 3: # unknown
51 dwg
.setOffset('UNKNOWN', (_seek
, _size
))
52 elif _rec
== 4: # r14 where there may be data stored
53 dwg
.setOffset('R14DATA', (_seek
, _size
))
54 elif _rec
== 5: # occasionally exists
55 dwg
.setOffset('R14REC5', (_seek
, _size
))
57 raise ValueError, "Unexpected record number %d" % _rec
58 _crc
= struct
.unpack('<h', _handle
.read(2))[0]
60 _s
.fromfile(_handle
, 16)
61 if _s
[0] != 0x95: raise ValueError, "_s[0] != 0x95"
62 if _s
[1] != 0xa0: raise ValueError, "_s[1] != 0xa0"
63 if _s
[2] != 0x4e: raise ValueError, "_s[2] != 0x4e"
64 if _s
[3] != 0x28: raise ValueError, "_s[3] != 0x28"
65 if _s
[4] != 0x99: raise ValueError, "_s[4] != 0x99"
66 if _s
[5] != 0x82: raise ValueError, "_s[5] != 0x82"
67 if _s
[6] != 0x1a: raise ValueError, "_s[6] != 0x1a"
68 if _s
[7] != 0xe5: raise ValueError, "_s[7] != 0xe5"
69 if _s
[8] != 0x5e: raise ValueError, "_s[8] != 0x5e"
70 if _s
[9] != 0x41: raise ValueError, "_s[9] != 0x41"
71 if _s
[10] != 0xe0: raise ValueError, "_s[10] != 0xe0"
72 if _s
[11] != 0x5f: raise ValueError, "_s[11] != 0x5f"
73 if _s
[12] != 0x9d: raise ValueError, "_s[12] != 0x9d"
74 if _s
[13] != 0x3a: raise ValueError, "_s[13] != 0x3a"
75 if _s
[14] != 0x4d: raise ValueError, "_s[14] != 0x4d"
76 if _s
[15] != 0x00: raise ValueError, "_s[15] != 0x00"
78 # set the data reading functions
80 dwg
.setReader('IMAGES', get_images
)
81 dwg
.setReader('HEADERS', get_headers
)
82 dwg
.setReader('CLASSES', get_classes
)
83 dwg
.setReader('OBJECTS', get_objects
)
84 dwg
.setReader('OFFSETS', get_offsets
)
85 dwg
.setReader('OBJECT', get_object
)
88 _handle
= dwg
.getHandle()
89 _offset
, _size
= dwg
.getOffset('IMAGES') # size is None
90 _handle
.seek(_offset
, 0)
92 _s
.fromfile(_handle
, 16)
93 if _s
[0] != 0x1f: raise ValueError, "_s[0] != 0x1f"
94 if _s
[1] != 0x25: raise ValueError, "_s[1] != 0x25"
95 if _s
[2] != 0x6d: raise ValueError, "_s[2] != 0x6d"
96 if _s
[3] != 0x07: raise ValueError, "_s[3] != 0x07"
97 if _s
[4] != 0xd4: raise ValueError, "_s[4] != 0xd4"
98 if _s
[5] != 0x36: raise ValueError, "_s[5] != 0x36"
99 if _s
[6] != 0x28: raise ValueError, "_s[6] != 0x28"
100 if _s
[7] != 0x28: raise ValueError, "_s[7] != 0x28"
101 if _s
[8] != 0x9d: raise ValueError, "_s[8] != 0x9d"
102 if _s
[9] != 0x57: raise ValueError, "_s[9] != 0x57"
103 if _s
[10] != 0xca: raise ValueError, "_s[10] != 0xca"
104 if _s
[11] != 0x3f: raise ValueError, "_s[11] != 0x3f"
105 if _s
[12] != 0x9d: raise ValueError, "_s[12] != 0x9d"
106 if _s
[13] != 0x44: raise ValueError, "_s[13] != 0x44"
107 if _s
[14] != 0x10: raise ValueError, "_s[14] != 0x10"
108 if _s
[15] != 0x2b: raise ValueError, "_s[15] != 0x2b"
109 _size
, _count
= struct
.unpack('<lB', _handle
.read(5))
110 _headerstart
= _headersize
= None
111 _headerdata
= array
.array('B')
112 _bmpstart
= _bmpsize
= None
113 _bmpdata
= array
.array('B')
114 _wmfstart
= _wmfsize
= None
115 _wmfdata
= array
.array('B')
116 for _i
in range(_count
):
117 _code
, _start
, _imgsize
= struct
.unpack('<Bll', _handle
.read(9))
118 if _code
== 1: # header
119 _headerstart
= _start
120 _headersize
= _imgsize
121 elif _code
== 2: # bmp
124 elif _code
== 3: # wmf
128 raise ValueError, "Unexpected code: %#x" % _code
129 if _headerstart
is not None and _headersize
is not None:
130 _handle
.seek(_headerstart
, 0)
131 _headerdata
.fromfile(_handle
, _headersize
) # what to do with this ???
132 if _bmpstart
is not None and _bmpsize
is not None:
133 _handle
.seek(_bmpstart
, 0)
134 _bmpdata
.fromfile(_handle
, _bmpsize
)
135 if _wmfstart
is not None and _wmfsize
is not None:
136 _handle
.seek(_wmfstart
, 0)
137 _wmfdata
.fromfile(_handle
, _wmfsize
)
138 _s
.fromfile(_handle
, 16)
139 if _s
[16] != 0xe0: raise ValueError, "_s[16] != 0xe0"
140 if _s
[17] != 0xda: raise ValueError, "_s[17] != 0xda"
141 if _s
[18] != 0x92: raise ValueError, "_s[18] != 0x92"
142 if _s
[19] != 0xf8: raise ValueError, "_s[19] != 0xf8"
143 if _s
[20] != 0x2b: raise ValueError, "_s[20] != 0x29"
144 if _s
[21] != 0xc9: raise ValueError, "_s[21] != 0xc9"
145 if _s
[22] != 0xd7: raise ValueError, "_s[22] != 0xd7"
146 if _s
[23] != 0xd7: raise ValueError, "_s[23] != 0xd7"
147 if _s
[24] != 0x62: raise ValueError, "_s[24] != 0x62"
148 if _s
[25] != 0xa8: raise ValueError, "_s[25] != 0xa8"
149 if _s
[26] != 0x35: raise ValueError, "_s[26] != 0x35"
150 if _s
[27] != 0xc0: raise ValueError, "_s[27] != 0xc0"
151 if _s
[28] != 0x62: raise ValueError, "_s[28] != 0x62"
152 if _s
[29] != 0xbb: raise ValueError, "_s[29] != 0xbb"
153 if _s
[30] != 0xef: raise ValueError, "_s[30] != 0xef"
154 if _s
[31] != 0xd4: raise ValueError, "_s[31] != 0xd4"
155 if _bmpdata
is not None:
156 dwg
.setImage('BMP', _bmpdata
)
157 if _wmfdata
is not None:
158 dwg
.setImage('WMF', _wmfdata
)
160 def get_headers(dwg
):
161 _handle
= dwg
.getHandle()
162 _offset
, _size
= dwg
.getOffset('HEADERS')
163 _handle
.seek(_offset
, 0)
164 _s
= array
.array('B')
165 _s
.fromfile(_handle
, 16)
166 if _s
[0] != 0xcf: raise ValueError, "_s[0] != 0xcf"
167 if _s
[1] != 0x7b: raise ValueError, "_s[1] != 0x7b"
168 if _s
[2] != 0x1f: raise ValueError, "_s[2] != 0x1f"
169 if _s
[3] != 0x23: raise ValueError, "_s[3] != 0x23"
170 if _s
[4] != 0xfd: raise ValueError, "_s[4] != 0xfd"
171 if _s
[5] != 0xde: raise ValueError, "_s[5] != 0xde"
172 if _s
[6] != 0x38: raise ValueError, "_s[6] != 0x38"
173 if _s
[7] != 0xa9: raise ValueError, "_s[7] != 0xa9"
174 if _s
[8] != 0x5f: raise ValueError, "_s[8] != 0x5f"
175 if _s
[9] != 0x7c: raise ValueError, "_s[9] != 0x7c"
176 if _s
[10] != 0x68: raise ValueError, "_s[10] != 0x68"
177 if _s
[11] != 0xb8: raise ValueError, "_s[11] != 0xb8"
178 if _s
[12] != 0x4e: raise ValueError, "_s[12] != 0x4e"
179 if _s
[13] != 0x6d: raise ValueError, "_s[13] != 0x6d"
180 if _s
[14] != 0x33: raise ValueError, "_s[14] != 0x33"
181 if _s
[15] != 0x5f: raise ValueError, "_s[15] != 0x5f"
182 _size
= struct
.unpack('<l', _handle
.read(4))[0]
183 _data
= array
.array('B')
184 _data
.fromfile(_handle
, _size
)
185 _crc
= struct
.unpack('<h', _handle
.read(2))[0]
186 _s
.fromfile(_handle
, 16)
187 if _s
[16] != 0x30: raise ValueError, "_s[16] != 0x30"
188 if _s
[17] != 0x84: raise ValueError, "_s[17] != 0x84"
189 if _s
[18] != 0xe0: raise ValueError, "_s[18] != 0xe0"
190 if _s
[19] != 0xdc: raise ValueError, "_s[19] != 0xdc"
191 if _s
[20] != 0x02: raise ValueError, "_s[20] != 0x02"
192 if _s
[21] != 0x21: raise ValueError, "_s[21] != 0x21"
193 if _s
[22] != 0xc7: raise ValueError, "_s[22] != 0xc7"
194 if _s
[23] != 0x56: raise ValueError, "_s[23] != 0x56"
195 if _s
[24] != 0xa0: raise ValueError, "_s[24] != 0xa0"
196 if _s
[25] != 0x83: raise ValueError, "_s[25] != 0x83"
197 if _s
[26] != 0x97: raise ValueError, "_s[26] != 0x97"
198 if _s
[27] != 0x47: raise ValueError, "_s[27] != 0x47"
199 if _s
[28] != 0xb1: raise ValueError, "_s[28] != 0xb1"
200 if _s
[29] != 0x92: raise ValueError, "_s[29] != 0x92"
201 if _s
[30] != 0xcc: raise ValueError, "_s[30] != 0xcc"
202 if _s
[31] != 0xa0: raise ValueError, "_s[31] != 0xa0"
207 _bitpos
, _val
= dwgutil
.get_bit_double(_data
, _bitpos
)
208 dwg
.setHeader('VAL1', _val
)
209 # print "bitpos: %d" % _bitpos
210 _bitpos
, _val
= dwgutil
.get_bit_double(_data
, _bitpos
)
211 dwg
.setHeader('VAL2', _val
)
212 # print "bitpos: %d" % _bitpos
213 _bitpos
, _val
= dwgutil
.get_bit_double(_data
, _bitpos
)
214 dwg
.setHeader('VAL3', _val
)
215 # print "bitpos: %d" % _bitpos
216 _bitpos
, _val
= dwgutil
.get_bit_double(_data
, _bitpos
)
217 dwg
.setHeader('VAL4', _val
)
218 # print "bitpos: %d" % _bitpos
219 _bitpos
, _string
= dwgutil
.get_text_string(_data
, _bitpos
)
220 dwg
.setHeader('STRING1', _string
)
221 # print "bitpos: %d" % _bitpos
222 _bitpos
, _string
= dwgutil
.get_text_string(_data
, _bitpos
)
223 dwg
.setHeader('STRING2', _string
)
224 # print "bitpos: %d" % _bitpos
225 _bitpos
, _string
= dwgutil
.get_text_string(_data
, _bitpos
)
226 dwg
.setHeader('STRING3', _string
)
227 # print "bitpos: %d" % _bitpos
228 _bitpos
, _string
= dwgutil
.get_text_string(_data
, _bitpos
)
229 dwg
.setHeader('STRING4', _string
)
230 # print "bitpos: %d" % _bitpos
231 _bitpos
, _val
= dwgutil
.get_bit_long(_data
, _bitpos
)
232 dwg
.setHeader('LONG1', _val
)
233 # print "bitpos: %d" % _bitpos
234 _bitpos
, _val
= dwgutil
.get_bit_long(_data
, _bitpos
)
235 dwg
.setHeader('LONG2', _val
)
236 # print "bitpos: %d" % _bitpos
237 _bitpos
, _handle
= dwgutil
.get_handle(_data
, _bitpos
)
238 dwg
.setHeader('HANDLE1', _handle
)
239 # print "bitpos: %d" % _bitpos
240 _bitpos
, _val
= dwgutil
.test_bit(_data
, _bitpos
)
241 dwg
.setHeader('DIMASO', _val
)
242 # print "bitpos: %d" % _bitpos
243 _bitpos
, _val
= dwgutil
.test_bit(_data
, _bitpos
)
244 dwg
.setHeader('DIMSHO', _val
)
245 # print "bitpos: %d" % _bitpos
246 _bitpos
, _val
= dwgutil
.test_bit(_data
, _bitpos
)
247 dwg
.setHeader('PLINEGEN', _val
)
248 # print "bitpos: %d" % _bitpos
249 _bitpos
, _val
= dwgutil
.test_bit(_data
, _bitpos
)
250 dwg
.setHeader('ORTHOMODE', _val
)
251 # print "bitpos: %d" % _bitpos
252 _bitpos
, _val
= dwgutil
.test_bit(_data
, _bitpos
)
253 dwg
.setHeader('REGENMODE', _val
)
254 # print "bitpos: %d" % _bitpos
255 _bitpos
, _val
= dwgutil
.test_bit(_data
, _bitpos
)
256 dwg
.setHeader('FILLMODE', _val
)
257 # print "bitpos: %d" % _bitpos
258 _bitpos
, _val
= dwgutil
.test_bit(_data
, _bitpos
)
259 dwg
.setHeader('QTEXTMODE', _val
)
260 # print "bitpos: %d" % _bitpos
261 _bitpos
, _val
= dwgutil
.test_bit(_data
, _bitpos
)
262 dwg
.setHeader('PSLTSCALE', _val
)
263 # print "bitpos: %d" % _bitpos
264 _bitpos
, _val
= dwgutil
.test_bit(_data
, _bitpos
)
265 dwg
.setHeader('LIMCHECK', _val
)
266 # print "bitpos: %d" % _bitpos
267 _bitpos
, _val
= dwgutil
.test_bit(_data
, _bitpos
)
268 dwg
.setHeader('User_timer', _val
)
269 # print "bitpos: %d" % _bitpos
270 _bitpos
, _val
= dwgutil
.test_bit(_data
, _bitpos
)
271 dwg
.setHeader('SKPOLY', _val
)
272 # print "bitpos: %d" % _bitpos
273 _bitpos
, _val
= dwgutil
.test_bit(_data
, _bitpos
)
274 dwg
.setHeader('ANGDIR', _val
)
275 # print "bitpos: %d" % _bitpos
276 _bitpos
, _val
= dwgutil
.test_bit(_data
, _bitpos
)
277 dwg
.setHeader('SPLFRAME', _val
)
278 # print "bitpos: %d" % _bitpos
279 _bitpos
, _val
= dwgutil
.test_bit(_data
, _bitpos
)
280 dwg
.setHeader('MIRRTEXT', _val
)
281 # print "bitpos: %d" % _bitpos
282 _bitpos
, _val
= dwgutil
.test_bit(_data
, _bitpos
)
283 dwg
.setHeader('WORLDVIEW', _val
)
284 # print "bitpos: %d" % _bitpos
285 _bitpos
, _val
= dwgutil
.test_bit(_data
, _bitpos
)
286 dwg
.setHeader('TILEMODE', _val
)
287 # print "bitpos: %d" % _bitpos
288 _bitpos
, _val
= dwgutil
.test_bit(_data
, _bitpos
)
289 dwg
.setHeader('PLIMCHECK', _val
)
290 # print "bitpos: %d" % _bitpos
291 _bitpos
, _val
= dwgutil
.test_bit(_data
, _bitpos
)
292 dwg
.setHeader('VISRETAIN', _val
)
293 # print "bitpos: %d" % _bitpos
294 _bitpos
, _val
= dwgutil
.test_bit(_data
, _bitpos
)
295 dwg
.setHeader('DISPSILH', _val
)
296 # print "bitpos: %d" % _bitpos
297 _bitpos
, _val
= dwgutil
.test_bit(_data
, _bitpos
)
298 dwg
.setHeader('PELLISE', _val
)
299 # print "bitpos: %d" % _bitpos
300 _bitpos
, _val
= dwgutil
.get_bit_short(_data
, _bitpos
)
301 dwg
.setHeader('PROXYGRAPH', _val
)
302 # print "bitpos: %d" % _bitpos
303 _bitpos
, _val
= dwgutil
.get_bit_short(_data
, _bitpos
)
304 dwg
.setHeader('TREEDEPTH', _val
)
305 # print "bitpos: %d" % _bitpos
306 _bitpos
, _val
= dwgutil
.get_bit_short(_data
, _bitpos
)
307 dwg
.setHeader('LUNITS', _val
)
308 # print "bitpos: %d" % _bitpos
309 _bitpos
, _val
= dwgutil
.get_bit_short(_data
, _bitpos
)
310 dwg
.setHeader('LUPREC', _val
)
311 # print "bitpos: %d" % _bitpos
312 _bitpos
, _val
= dwgutil
.get_bit_short(_data
, _bitpos
)
313 dwg
.setHeader('AUNITS', _val
)
314 # print "bitpos: %d" % _bitpos
315 _bitpos
, _val
= dwgutil
.get_bit_short(_data
, _bitpos
)
316 dwg
.setHeader('AUPREC', _val
)
317 # print "bitpos at attmode: %d" % _bitpos
318 _bitpos
, _val
= dwgutil
.get_bit_short(_data
, _bitpos
)
319 dwg
.setHeader('ATTMODE', _val
)
320 # print "bitpos: %d" % _bitpos
321 _bitpos
, _val
= dwgutil
.get_bit_short(_data
, _bitpos
)
322 dwg
.setHeader('PDMODE', _val
)
323 # print "bitpos: %d" % _bitpos
324 _bitpos
, _val
= dwgutil
.get_bit_short(_data
, _bitpos
)
325 dwg
.setHeader('USERI1', _val
)
326 # print "bitpos: %d" % _bitpos
327 _bitpos
, _val
= dwgutil
.get_bit_short(_data
, _bitpos
)
328 dwg
.setHeader('USERI2', _val
)
329 # print "bitpos: %d" % _bitpos
330 _bitpos
, _val
= dwgutil
.get_bit_short(_data
, _bitpos
)
331 dwg
.setHeader('USERI3', _val
)
332 # print "bitpos: %d" % _bitpos
333 _bitpos
, _val
= dwgutil
.get_bit_short(_data
, _bitpos
)
334 dwg
.setHeader('USERI4', _val
)
335 # print "bitpos: %d" % _bitpos
336 _bitpos
, _val
= dwgutil
.get_bit_short(_data
, _bitpos
)
337 dwg
.setHeader('USERI5', _val
)
338 # print "bitpos: %d" % _bitpos
339 _bitpos
, _val
= dwgutil
.get_bit_short(_data
, _bitpos
)
340 dwg
.setHeader('SPLINESEGS', _val
)
341 # print "bitpos: %d" % _bitpos
342 _bitpos
, _val
= dwgutil
.get_bit_short(_data
, _bitpos
)
343 dwg
.setHeader('SURFU', _val
)
344 # print "bitpos: %d" % _bitpos
345 _bitpos
, _val
= dwgutil
.get_bit_short(_data
, _bitpos
)
346 dwg
.setHeader('SURFV', _val
)
347 # print "bitpos: %d" % _bitpos
348 _bitpos
, _val
= dwgutil
.get_bit_short(_data
, _bitpos
)
349 dwg
.setHeader('SURFTYPE', _val
)
350 # print "bitpos: %d" % _bitpos
351 _bitpos
, _val
= dwgutil
.get_bit_short(_data
, _bitpos
)
352 dwg
.setHeader('SURFTAB1', _val
)
353 # print "bitpos: %d" % _bitpos
354 _bitpos
, _val
= dwgutil
.get_bit_short(_data
, _bitpos
)
355 dwg
.setHeader('SURFTAB2', _val
)
356 # print "bitpos: %d" % _bitpos
357 _bitpos
, _val
= dwgutil
.get_bit_short(_data
, _bitpos
)
358 dwg
.setHeader('SPLINETYPE', _val
)
359 # print "bitpos: %d" % _bitpos
360 _bitpos
, _val
= dwgutil
.get_bit_short(_data
, _bitpos
)
361 dwg
.setHeader('SHADEGDE', _val
)
362 # print "bitpos: %d" % _bitpos
363 _bitpos
, _val
= dwgutil
.get_bit_short(_data
, _bitpos
)
364 dwg
.setHeader('SHADEDIF', _val
)
365 # print "bitpos: %d" % _bitpos
366 _bitpos
, _val
= dwgutil
.get_bit_short(_data
, _bitpos
)
367 dwg
.setHeader('UNITMODE', _val
)
368 # print "bitpos: %d" % _bitpos
369 _bitpos
, _val
= dwgutil
.get_bit_short(_data
, _bitpos
)
370 dwg
.setHeader('MAXACTVP', _val
)
371 # print "bitpos: %d" % _bitpos
372 _bitpos
, _val
= dwgutil
.get_bit_short(_data
, _bitpos
)
373 dwg
.setHeader('ISOLINES', _val
)
374 # print "bitpos: %d" % _bitpos
375 _bitpos
, _val
= dwgutil
.get_bit_short(_data
, _bitpos
)
376 dwg
.setHeader('CMLJUST', _val
)
377 # print "bitpos: %d" % _bitpos
378 _bitpos
, _val
= dwgutil
.get_bit_short(_data
, _bitpos
)
379 dwg
.setHeader('TEXTQLTY', _val
)
380 # print "bitpos: %d" % _bitpos
381 _bitpos
, _val
= dwgutil
.get_bit_double(_data
, _bitpos
)
382 dwg
.setHeader('LTSCALE', _val
)
383 # print "bitpos: %d" % _bitpos
384 _bitpos
, _val
= dwgutil
.get_bit_double(_data
, _bitpos
)
385 dwg
.setHeader('TEXTSIZE', _val
)
386 # print "bitpos: %d" % _bitpos
387 _bitpos
, _val
= dwgutil
.get_bit_double(_data
, _bitpos
)
388 dwg
.setHeader('TRACEWID', _val
)
389 # print "bitpos: %d" % _bitpos
390 _bitpos
, _val
= dwgutil
.get_bit_double(_data
, _bitpos
)
391 dwg
.setHeader('SKETCHINC', _val
)
392 # print "bitpos: %d" % _bitpos
393 _bitpos
, _val
= dwgutil
.get_bit_double(_data
, _bitpos
)
394 dwg
.setHeader('FILLETRAD', _val
)
395 # print "bitpos: %d" % _bitpos
396 _bitpos
, _val
= dwgutil
.get_bit_double(_data
, _bitpos
)
397 dwg
.setHeader('THICKNESS', _val
)
398 # print "bitpos: %d" % _bitpos
399 _bitpos
, _val
= dwgutil
.get_bit_double(_data
, _bitpos
)
400 dwg
.setHeader('ANGBASE', _val
)
401 # print "bitpos: %d" % _bitpos
402 _bitpos
, _val
= dwgutil
.get_bit_double(_data
, _bitpos
)
403 dwg
.setHeader('PDSIZE', _val
)
404 # print "bitpos: %d" % _bitpos
405 _bitpos
, _val
= dwgutil
.get_bit_double(_data
, _bitpos
)
406 dwg
.setHeader('PLINEWID', _val
)
407 # print "bitpos: %d" % _bitpos
408 _bitpos
, _val
= dwgutil
.get_bit_double(_data
, _bitpos
)
409 dwg
.setHeader('USERR1', _val
)
410 # print "bitpos: %d" % _bitpos
411 _bitpos
, _val
= dwgutil
.get_bit_double(_data
, _bitpos
)
412 dwg
.setHeader('USERR2', _val
)
413 # print "bitpos: %d" % _bitpos
414 _bitpos
, _val
= dwgutil
.get_bit_double(_data
, _bitpos
)
415 dwg
.setHeader('USERR3', _val
)
416 # print "bitpos: %d" % _bitpos
417 _bitpos
, _val
= dwgutil
.get_bit_double(_data
, _bitpos
)
418 dwg
.setHeader('USERR4', _val
)
419 # print "bitpos: %d" % _bitpos
420 _bitpos
, _val
= dwgutil
.get_bit_double(_data
, _bitpos
)
421 dwg
.setHeader('USERR5', _val
)
422 # print "bitpos: %d" % _bitpos
423 _bitpos
, _val
= dwgutil
.get_bit_double(_data
, _bitpos
)
424 dwg
.setHeader('CHAMFERA', _val
)
425 # print "bitpos: %d" % _bitpos
426 _bitpos
, _val
= dwgutil
.get_bit_double(_data
, _bitpos
)
427 dwg
.setHeader('CHAMFERB', _val
)
428 # print "bitpos: %d" % _bitpos
429 _bitpos
, _val
= dwgutil
.get_bit_double(_data
, _bitpos
)
430 dwg
.setHeader('CHAMFERC', _val
)
431 # print "bitpos: %d" % _bitpos
432 _bitpos
, _val
= dwgutil
.get_bit_double(_data
, _bitpos
)
433 dwg
.setHeader('CHAMFERD', _val
)
434 # print "bitpos: %d" % _bitpos
435 _bitpos
, _val
= dwgutil
.get_bit_double(_data
, _bitpos
)
436 dwg
.setHeader('FACETRES', _val
)
437 # print "bitpos: %d" % _bitpos
438 _bitpos
, _val
= dwgutil
.get_bit_double(_data
, _bitpos
)
439 dwg
.setHeader('CMLSCALE', _val
)
440 # print "bitpos: %d" % _bitpos
441 _bitpos
, _val
= dwgutil
.get_bit_double(_data
, _bitpos
)
442 dwg
.setHeader('CELTSCALE', _val
)
443 # print "bitpos: %d" % _bitpos
444 _bitpos
, _string
= dwgutil
.get_text_string(_data
, _bitpos
)
445 dwg
.setHeader('MENUNAME', _string
)
446 # print "bitpos: %d" % _bitpos
447 _bitpos
, _long
= dwgutil
.get_bit_long(_data
, _bitpos
)
448 dwg
.setHeader('TDCREATE_JD', _long
)
449 # print "bitpos: %d" % _bitpos
450 _bitpos
, _long
= dwgutil
.get_bit_long(_data
, _bitpos
)
451 dwg
.setHeader('TDCREATE_MS', _long
)
452 # print "bitpos: %d" % _bitpos
453 _bitpos
, _long
= dwgutil
.get_bit_long(_data
, _bitpos
)
454 dwg
.setHeader('TDUPDATE_JD', _long
)
455 # print "bitpos: %d" % _bitpos
456 _bitpos
, _long
= dwgutil
.get_bit_long(_data
, _bitpos
)
457 dwg
.setHeader('TDUPDATE_MS', _long
)
458 # print "bitpos: %d" % _bitpos
459 _bitpos
, _long
= dwgutil
.get_bit_long(_data
, _bitpos
)
460 dwg
.setHeader('TDINDWG_D', _long
)
461 # print "bitpos: %d" % _bitpos
462 _bitpos
, _long
= dwgutil
.get_bit_long(_data
, _bitpos
)
463 dwg
.setHeader('TDINDWG_MS', _long
)
464 # print "bitpos: %d" % _bitpos
465 _bitpos
, _long
= dwgutil
.get_bit_long(_data
, _bitpos
)
466 dwg
.setHeader('TDUSRTIMER_D', _long
)
467 # print "bitpos: %d" % _bitpos
468 _bitpos
, _long
= dwgutil
.get_bit_long(_data
, _bitpos
)
469 dwg
.setHeader('TDUSRTIMER_MS', _long
)
470 # print "bitpos: %d" % _bitpos
471 _bitpos
, _val
= dwgutil
.get_bit_short(_data
, _bitpos
)
472 dwg
.setHeader('CECOLOR', _val
)
473 # print "bitpos: %d" % _bitpos
474 _bitpos
, _handle
= dwgutil
.get_handle(_data
, _bitpos
)
475 dwg
.setHeader('HANDSEED', _handle
)
476 # print "bitpos: %d" % _bitpos
477 _bitpos
, _handle
= dwgutil
.get_handle(_data
, _bitpos
)
478 dwg
.setHeader('CLAYER', _handle
)
479 # print "bitpos: %d" % _bitpos
480 _bitpos
, _handle
= dwgutil
.get_handle(_data
, _bitpos
)
481 dwg
.setHeader('TEXTSTYLE', _handle
)
482 # print "bitpos: %d" % _bitpos
483 _bitpos
, _handle
= dwgutil
.get_handle(_data
, _bitpos
)
484 dwg
.setHeader('CELTYPE', _handle
)
485 # print "bitpos: %d" % _bitpos
486 _bitpos
, _handle
= dwgutil
.get_handle(_data
, _bitpos
)
487 dwg
.setHeader('DIMSTYLE', _handle
)
488 # print "bitpos: %d" % _bitpos
489 _bitpos
, _handle
= dwgutil
.get_handle(_data
, _bitpos
)
490 dwg
.setHeader('CMLSTYLE', _handle
)
491 # print "bitpos: %d" % _bitpos
492 _bitpos
, _val
= dwgutil
.get_bit_double(_data
, _bitpos
)
493 dwg
.setHeader('PSVPSCALE', _val
)
494 # print "bitpos: %d" % _bitpos
495 _bitpos
, _val1
= dwgutil
.get_bit_double(_data
, _bitpos
)
496 _bitpos
, _val2
= dwgutil
.get_bit_double(_data
, _bitpos
)
497 _bitpos
, _val3
= dwgutil
.get_bit_double(_data
, _bitpos
)
498 dwg
.setHeader('PSPACE_INSBASE', (_val1
, _val2
, _val3
))
499 # print "bitpos: %d" % _bitpos
500 _bitpos
, _val1
= dwgutil
.get_bit_double(_data
, _bitpos
)
501 _bitpos
, _val2
= dwgutil
.get_bit_double(_data
, _bitpos
)
502 _bitpos
, _val3
= dwgutil
.get_bit_double(_data
, _bitpos
)
503 dwg
.setHeader('PSPACE_EXTMIN', (_val1
, _val2
, _val3
))
504 # print "bitpos: %d" % _bitpos
505 _bitpos
, _val1
= dwgutil
.get_bit_double(_data
, _bitpos
)
506 _bitpos
, _val2
= dwgutil
.get_bit_double(_data
, _bitpos
)
507 _bitpos
, _val3
= dwgutil
.get_bit_double(_data
, _bitpos
)
508 dwg
.setHeader('PSPACE_EXTMAX', (_val1
, _val2
, _val3
))
509 # print "bitpos: %d" % _bitpos
510 _bitpos
, _val1
= dwgutil
.get_raw_double(_data
, _bitpos
)
511 _bitpos
, _val2
= dwgutil
.get_raw_double(_data
, _bitpos
)
512 dwg
.setHeader('PSPACE_LIMMIN', (_val1
, _val2
))
513 # print "bitpos: %d" % _bitpos
514 _bitpos
, _val1
= dwgutil
.get_raw_double(_data
, _bitpos
)
515 _bitpos
, _val2
= dwgutil
.get_raw_double(_data
, _bitpos
)
516 dwg
.setHeader('PSPACE_LIMMAX', (_val1
, _val2
))
517 # print "bitpos: %d" % _bitpos
518 _bitpos
, _val
= dwgutil
.get_bit_double(_data
, _bitpos
)
519 dwg
.setHeader('PSPACE_ELEVATION', _val
)
520 # print "bitpos: %d" % _bitpos
521 _bitpos
, _val1
= dwgutil
.get_bit_double(_data
, _bitpos
)
522 _bitpos
, _val2
= dwgutil
.get_bit_double(_data
, _bitpos
)
523 _bitpos
, _val3
= dwgutil
.get_bit_double(_data
, _bitpos
)
524 dwg
.setHeader('PSPACE_UCSORG', (_val1
, _val2
, _val3
))
525 # print "bitpos: %d" % _bitpos
526 _bitpos
, _val1
= dwgutil
.get_bit_double(_data
, _bitpos
)
527 _bitpos
, _val2
= dwgutil
.get_bit_double(_data
, _bitpos
)
528 _bitpos
, _val3
= dwgutil
.get_bit_double(_data
, _bitpos
)
529 dwg
.setHeader('PSPACE_UCSXDIR', (_val1
, _val2
, _val3
))
530 # print "bitpos: %d" % _bitpos
531 _bitpos
, _val1
= dwgutil
.get_bit_double(_data
, _bitpos
)
532 _bitpos
, _val2
= dwgutil
.get_bit_double(_data
, _bitpos
)
533 _bitpos
, _val3
= dwgutil
.get_bit_double(_data
, _bitpos
)
534 dwg
.setHeader('PSPACE_UCSYDIR', (_val1
, _val2
, _val3
))
535 # print "bitpos: %d" % _bitpos
536 _bitpos
, _handle
= dwgutil
.get_handle(_data
, _bitpos
)
537 dwg
.setHeader('PSPACE_UCSNAME', _handle
)
538 # print "bitpos: %d" % _bitpos
539 _bitpos
, _handle
= dwgutil
.get_handle(_data
, _bitpos
)
540 dwg
.setHeader('PUCSBASE', _handle
)
541 # print "bitpos: %d" % _bitpos
542 _bitpos
, _val
= dwgutil
.get_bit_short(_data
, _bitpos
)
543 dwg
.setHeader('PUCSORTHOVIEW', _val
)
544 # print "bitpos: %d" % _bitpos
545 _bitpos
, _handle
= dwgutil
.get_handle(_data
, _bitpos
)
546 dwg
.setHeader('PUCSORTHOREF', _handle
)
547 # print "bitpos: %d" % _bitpos
548 _bitpos
, _val1
= dwgutil
.get_bit_double(_data
, _bitpos
)
549 _bitpos
, _val2
= dwgutil
.get_bit_double(_data
, _bitpos
)
550 _bitpos
, _val3
= dwgutil
.get_bit_double(_data
, _bitpos
)
551 dwg
.setHeader('PUCSORGTOP', (_val1
, _val2
, _val3
))
552 # print "bitpos: %d" % _bitpos
553 _bitpos
, _val1
= dwgutil
.get_bit_double(_data
, _bitpos
)
554 _bitpos
, _val2
= dwgutil
.get_bit_double(_data
, _bitpos
)
555 _bitpos
, _val3
= dwgutil
.get_bit_double(_data
, _bitpos
)
556 dwg
.setHeader('PUCSORGBOTTOM', (_val1
, _val2
, _val3
))
557 # print "bitpos: %d" % _bitpos
558 _bitpos
, _val1
= dwgutil
.get_bit_double(_data
, _bitpos
)
559 _bitpos
, _val2
= dwgutil
.get_bit_double(_data
, _bitpos
)
560 _bitpos
, _val3
= dwgutil
.get_bit_double(_data
, _bitpos
)
561 dwg
.setHeader('PUCSORGLEFT', (_val1
, _val2
, _val3
))
562 # print "bitpos: %d" % _bitpos
563 _bitpos
, _val1
= dwgutil
.get_bit_double(_data
, _bitpos
)
564 _bitpos
, _val2
= dwgutil
.get_bit_double(_data
, _bitpos
)
565 _bitpos
, _val3
= dwgutil
.get_bit_double(_data
, _bitpos
)
566 dwg
.setHeader('PUCSORGRIGHT', (_val1
, _val2
, _val3
))
567 # print "bitpos: %d" % _bitpos
568 _bitpos
, _val1
= dwgutil
.get_bit_double(_data
, _bitpos
)
569 _bitpos
, _val2
= dwgutil
.get_bit_double(_data
, _bitpos
)
570 _bitpos
, _val3
= dwgutil
.get_bit_double(_data
, _bitpos
)
571 dwg
.setHeader('PUCSORGFRONT', (_val1
, _val2
, _val3
))
572 # print "bitpos: %d" % _bitpos
573 _bitpos
, _val1
= dwgutil
.get_bit_double(_data
, _bitpos
)
574 _bitpos
, _val2
= dwgutil
.get_bit_double(_data
, _bitpos
)
575 _bitpos
, _val3
= dwgutil
.get_bit_double(_data
, _bitpos
)
576 dwg
.setHeader('PUCSORGBACK', (_val1
, _val2
, _val3
))
577 # print "bitpos: %d" % _bitpos
578 _bitpos
, _val1
= dwgutil
.get_bit_double(_data
, _bitpos
)
579 _bitpos
, _val2
= dwgutil
.get_bit_double(_data
, _bitpos
)
580 _bitpos
, _val3
= dwgutil
.get_bit_double(_data
, _bitpos
)
581 dwg
.setHeader('MSPACE_INSBASE', (_val1
, _val2
, _val3
))
582 # print "bitpos: %d" % _bitpos
583 _bitpos
, _val1
= dwgutil
.get_bit_double(_data
, _bitpos
)
584 _bitpos
, _val2
= dwgutil
.get_bit_double(_data
, _bitpos
)
585 _bitpos
, _val3
= dwgutil
.get_bit_double(_data
, _bitpos
)
586 dwg
.setHeader('MSPACE_EXTMIN', (_val1
, _val2
, _val3
))
587 # print "bitpos: %d" % _bitpos
588 _bitpos
, _val1
= dwgutil
.get_bit_double(_data
, _bitpos
)
589 _bitpos
, _val2
= dwgutil
.get_bit_double(_data
, _bitpos
)
590 _bitpos
, _val3
= dwgutil
.get_bit_double(_data
, _bitpos
)
591 dwg
.setHeader('MSPACE_EXTMAX', (_val1
, _val2
, _val3
))
592 # print "bitpos: %d" % _bitpos
593 _bitpos
, _val1
= dwgutil
.get_raw_double(_data
, _bitpos
)
594 _bitpos
, _val2
= dwgutil
.get_raw_double(_data
, _bitpos
)
595 dwg
.setHeader('MSPACE_LIMMIN', (_val1
, _val2
))
596 # print "bitpos: %d" % _bitpos
597 _bitpos
, _val1
= dwgutil
.get_raw_double(_data
, _bitpos
)
598 _bitpos
, _val2
= dwgutil
.get_raw_double(_data
, _bitpos
)
599 dwg
.setHeader('MSPACE_LIMMAX', (_val1
, _val2
))
600 # print "bitpos: %d" % _bitpos
601 _bitpos
, _val
= dwgutil
.get_bit_double(_data
, _bitpos
)
602 dwg
.setHeader('MSPACE_ELEVATION', _val
)
603 # print "bitpos: %d" % _bitpos
604 _bitpos
, _val1
= dwgutil
.get_bit_double(_data
, _bitpos
)
605 _bitpos
, _val2
= dwgutil
.get_bit_double(_data
, _bitpos
)
606 _bitpos
, _val3
= dwgutil
.get_bit_double(_data
, _bitpos
)
607 dwg
.setHeader('MSPACE_UCSORG', (_val1
, _val2
, _val3
))
608 # print "bitpos: %d" % _bitpos
609 _bitpos
, _val1
= dwgutil
.get_bit_double(_data
, _bitpos
)
610 _bitpos
, _val2
= dwgutil
.get_bit_double(_data
, _bitpos
)
611 _bitpos
, _val3
= dwgutil
.get_bit_double(_data
, _bitpos
)
612 dwg
.setHeader('MSPACE_UCSXDIR', (_val1
, _val2
, _val3
))
613 # print "bitpos: %d" % _bitpos
614 _bitpos
, _val1
= dwgutil
.get_bit_double(_data
, _bitpos
)
615 _bitpos
, _val2
= dwgutil
.get_bit_double(_data
, _bitpos
)
616 _bitpos
, _val3
= dwgutil
.get_bit_double(_data
, _bitpos
)
617 dwg
.setHeader('MSPACE_UCSYDIR', (_val1
, _val2
, _val3
))
618 # print "bitpos: %d" % _bitpos
619 _bitpos
, _handle
= dwgutil
.get_handle(_data
, _bitpos
)
620 dwg
.setHeader('MSPACE_UCSNAME', _handle
)
621 # print "bitpos: %d" % _bitpos
622 _bitpos
, _handle
= dwgutil
.get_handle(_data
, _bitpos
)
623 dwg
.setHeader('UCSBASE', _handle
)
624 # print "bitpos: %d" % _bitpos
625 _bitpos
, _val
= dwgutil
.get_bit_short(_data
, _bitpos
)
626 dwg
.setHeader('UCSORTHOVIEW', _val
)
627 # print "bitpos: %d" % _bitpos
628 _bitpos
, _handle
= dwgutil
.get_handle(_data
, _bitpos
)
629 dwg
.setHeader('UCSORTHOREF', _handle
)
630 # print "bitpos: %d" % _bitpos
631 _bitpos
, _val1
= dwgutil
.get_bit_double(_data
, _bitpos
)
632 _bitpos
, _val2
= dwgutil
.get_bit_double(_data
, _bitpos
)
633 _bitpos
, _val3
= dwgutil
.get_bit_double(_data
, _bitpos
)
634 dwg
.setHeader('UCSORGTOP', (_val1
, _val2
, _val3
))
635 # print "bitpos: %d" % _bitpos
636 _bitpos
, _val1
= dwgutil
.get_bit_double(_data
, _bitpos
)
637 _bitpos
, _val2
= dwgutil
.get_bit_double(_data
, _bitpos
)
638 _bitpos
, _val3
= dwgutil
.get_bit_double(_data
, _bitpos
)
639 dwg
.setHeader('UCSORGBOTTOM', (_val1
, _val2
, _val3
))
640 # print "bitpos: %d" % _bitpos
641 _bitpos
, _val1
= dwgutil
.get_bit_double(_data
, _bitpos
)
642 _bitpos
, _val2
= dwgutil
.get_bit_double(_data
, _bitpos
)
643 _bitpos
, _val3
= dwgutil
.get_bit_double(_data
, _bitpos
)
644 dwg
.setHeader('UCSORGLEFT', (_val1
, _val2
, _val3
))
645 # print "bitpos: %d" % _bitpos
646 _bitpos
, _val1
= dwgutil
.get_bit_double(_data
, _bitpos
)
647 _bitpos
, _val2
= dwgutil
.get_bit_double(_data
, _bitpos
)
648 _bitpos
, _val3
= dwgutil
.get_bit_double(_data
, _bitpos
)
649 dwg
.setHeader('UCSORGRIGHT', (_val1
, _val2
, _val3
))
650 # print "bitpos: %d" % _bitpos
651 _bitpos
, _val1
= dwgutil
.get_bit_double(_data
, _bitpos
)
652 _bitpos
, _val2
= dwgutil
.get_bit_double(_data
, _bitpos
)
653 _bitpos
, _val3
= dwgutil
.get_bit_double(_data
, _bitpos
)
654 dwg
.setHeader('UCSORGFRONT', (_val1
, _val2
, _val3
))
655 # print "bitpos: %d" % _bitpos
656 _bitpos
, _val1
= dwgutil
.get_bit_double(_data
, _bitpos
)
657 _bitpos
, _val2
= dwgutil
.get_bit_double(_data
, _bitpos
)
658 _bitpos
, _val3
= dwgutil
.get_bit_double(_data
, _bitpos
)
659 dwg
.setHeader('UCSORGBACK', (_val1
, _val2
, _val3
))
660 # print "bitpos: %d" % _bitpos
661 _bitpos
, _string
= dwgutil
.get_text_string(_data
, _bitpos
)
662 dwg
.setHeader('DIMPOST', _string
)
663 # print "bitpos: %d" % _bitpos
664 _bitpos
, _string
= dwgutil
.get_text_string(_data
, _bitpos
)
665 dwg
.setHeader('DIMAPOST', _string
)
666 # print "bitpos: %d" % _bitpos
667 _bitpos
, _val
= dwgutil
.get_bit_double(_data
, _bitpos
)
668 dwg
.setHeader('DIMSCALE', _val
)
669 # print "bitpos: %d" % _bitpos
670 _bitpos
, _val
= dwgutil
.get_bit_double(_data
, _bitpos
)
671 dwg
.setHeader('DIMASZ', _val
)
672 # print "bitpos: %d" % _bitpos
673 _bitpos
, _val
= dwgutil
.get_bit_double(_data
, _bitpos
)
674 dwg
.setHeader('DIMEXO', _val
)
675 # print "bitpos: %d" % _bitpos
676 _bitpos
, _val
= dwgutil
.get_bit_double(_data
, _bitpos
)
677 dwg
.setHeader('DIMDLI', _val
)
678 # print "bitpos: %d" % _bitpos
679 _bitpos
, _val
= dwgutil
.get_bit_double(_data
, _bitpos
)
680 dwg
.setHeader('DIMEXE', _val
)
681 # print "bitpos: %d" % _bitpos
682 _bitpos
, _val
= dwgutil
.get_bit_double(_data
, _bitpos
)
683 dwg
.setHeader('DIMAND', _val
)
684 # print "bitpos: %d" % _bitpos
685 _bitpos
, _val
= dwgutil
.get_bit_double(_data
, _bitpos
)
686 dwg
.setHeader('DIMDLE', _val
)
687 # print "bitpos: %d" % _bitpos
688 _bitpos
, _val
= dwgutil
.get_bit_double(_data
, _bitpos
)
689 dwg
.setHeader('DIMTP', _val
)
690 # print "bitpos: %d" % _bitpos
691 _bitpos
, _val
= dwgutil
.get_bit_double(_data
, _bitpos
)
692 dwg
.setHeader('DIMTM', _val
)
693 # print "bitpos: %d" % _bitpos
694 _bitpos
, _val
= dwgutil
.test_bit(_data
, _bitpos
)
695 dwg
.setHeader('DIMTOL', _val
)
696 # print "bitpos: %d" % _bitpos
697 _bitpos
, _val
= dwgutil
.test_bit(_data
, _bitpos
)
698 dwg
.setHeader('DIMLIM', _val
)
699 # print "bitpos: %d" % _bitpos
700 _bitpos
, _val
= dwgutil
.test_bit(_data
, _bitpos
)
701 dwg
.setHeader('DIMTIH', _val
)
702 # print "bitpos: %d" % _bitpos
703 _bitpos
, _val
= dwgutil
.test_bit(_data
, _bitpos
)
704 dwg
.setHeader('DIMTOH', _val
)
705 # print "bitpos: %d" % _bitpos
706 _bitpos
, _val
= dwgutil
.test_bit(_data
, _bitpos
)
707 dwg
.setHeader('DIMSE1', _val
)
708 # print "bitpos: %d" % _bitpos
709 _bitpos
, _val
= dwgutil
.test_bit(_data
, _bitpos
)
710 dwg
.setHeader('DIMSE2', _val
)
711 # print "bitpos: %d" % _bitpos
712 _bitpos
, _val
= dwgutil
.get_bit_short(_data
, _bitpos
)
713 dwg
.setHeader('DIMTAD', _val
)
714 # print "bitpos: %d" % _bitpos
715 _bitpos
, _val
= dwgutil
.get_bit_short(_data
, _bitpos
)
716 dwg
.setHeader('DIMZIN', _val
)
717 # print "bitpos: %d" % _bitpos
718 _bitpos
, _val
= dwgutil
.get_bit_short(_data
, _bitpos
)
719 dwg
.setHeader('DIMAZIN', _val
)
720 # print "bitpos: %d" % _bitpos
721 _bitpos
, _val
= dwgutil
.get_bit_double(_data
, _bitpos
)
722 dwg
.setHeader('DIMTXT', _val
)
723 # print "bitpos: %d" % _bitpos
724 _bitpos
, _val
= dwgutil
.get_bit_double(_data
, _bitpos
)
725 dwg
.setHeader('DIMCEN', _val
)
726 # print "bitpos: %d" % _bitpos
727 _bitpos
, _val
= dwgutil
.get_bit_double(_data
, _bitpos
)
728 dwg
.setHeader('DIMSZ', _val
)
729 # print "bitpos: %d" % _bitpos
730 _bitpos
, _val
= dwgutil
.get_bit_double(_data
, _bitpos
)
731 dwg
.setHeader('DIMALTF', _val
)
732 # print "bitpos: %d" % _bitpos
733 _bitpos
, _val
= dwgutil
.get_bit_double(_data
, _bitpos
)
734 dwg
.setHeader('DIMLFAC', _val
)
735 # print "bitpos: %d" % _bitpos
736 _bitpos
, _val
= dwgutil
.get_bit_double(_data
, _bitpos
)
737 dwg
.setHeader('DIMTVP', _val
)
738 # print "bitpos: %d" % _bitpos
739 _bitpos
, _val
= dwgutil
.get_bit_double(_data
, _bitpos
)
740 dwg
.setHeader('DIMTFAC', _val
)
741 # print "bitpos: %d" % _bitpos
742 _bitpos
, _val
= dwgutil
.get_bit_double(_data
, _bitpos
)
743 dwg
.setHeader('DIMGAP', _val
)
744 # print "bitpos: %d" % _bitpos
745 _bitpos
, _val
= dwgutil
.get_bit_double(_data
, _bitpos
)
746 dwg
.setHeader('DIMALTRND', _val
)
747 # print "bitpos: %d" % _bitpos
748 _bitpos
, _val
= dwgutil
.test_bit(_data
, _bitpos
)
749 dwg
.setHeader('DIMALT', _val
)
750 # print "bitpos: %d" % _bitpos
751 _bitpos
, _val
= dwgutil
.get_bit_short(_data
, _bitpos
)
752 dwg
.setHeader('DIMALTD', _val
)
753 # print "bitpos: %d" % _bitpos
754 _bitpos
, _val
= dwgutil
.test_bit(_data
, _bitpos
)
755 dwg
.setHeader('DIMTOFL', _val
)
756 # print "bitpos: %d" % _bitpos
757 _bitpos
, _val
= dwgutil
.test_bit(_data
, _bitpos
)
758 dwg
.setHeader('DIMSAH', _val
)
759 # print "bitpos: %d" % _bitpos
760 _bitpos
, _val
= dwgutil
.test_bit(_data
, _bitpos
)
761 dwg
.setHeader('DIMTIX', _val
)
762 # print "bitpos: %d" % _bitpos
763 _bitpos
, _val
= dwgutil
.test_bit(_data
, _bitpos
)
764 dwg
.setHeader('DIMSOXD', _val
)
765 # print "bitpos: %d" % _bitpos
766 _bitpos
, _val
= dwgutil
.get_bit_short(_data
, _bitpos
)
767 dwg
.setHeader('DIMCLRD', _val
)
768 # print "bitpos: %d" % _bitpos
769 _bitpos
, _val
= dwgutil
.get_bit_short(_data
, _bitpos
)
770 dwg
.setHeader('DIMCLRE', _val
)
771 # print "bitpos: %d" % _bitpos
772 _bitpos
, _val
= dwgutil
.get_bit_short(_data
, _bitpos
)
773 dwg
.setHeader('DIMCLRT', _val
)
774 # print "bitpos: %d" % _bitpos
775 _bitpos
, _val
= dwgutil
.get_bit_short(_data
, _bitpos
)
776 dwg
.setHeader('DIMADEC', _val
)
777 # print "bitpos: %d" % _bitpos
778 _bitpos
, _val
= dwgutil
.get_bit_short(_data
, _bitpos
)
779 dwg
.setHeader('DIMDEC', _val
)
780 # print "bitpos: %d" % _bitpos
781 _bitpos
, _val
= dwgutil
.get_bit_short(_data
, _bitpos
)
782 dwg
.setHeader('DIMTDEC', _val
)
783 # print "bitpos: %d" % _bitpos
784 _bitpos
, _val
= dwgutil
.get_bit_short(_data
, _bitpos
)
785 dwg
.setHeader('DIMALTU', _val
)
786 # print "bitpos: %d" % _bitpos
787 _bitpos
, _val
= dwgutil
.get_bit_short(_data
, _bitpos
)
788 dwg
.setHeader('DIMALTTD', _val
)
789 # print "bitpos: %d" % _bitpos
790 _bitpos
, _val
= dwgutil
.get_bit_short(_data
, _bitpos
)
791 dwg
.setHeader('DIMAUNIT', _val
)
792 # print "bitpos: %d" % _bitpos
793 _bitpos
, _val
= dwgutil
.get_bit_short(_data
, _bitpos
)
794 dwg
.setHeader('DIMFRAC', _val
)
795 # print "bitpos: %d" % _bitpos
796 _bitpos
, _val
= dwgutil
.get_bit_short(_data
, _bitpos
)
797 dwg
.setHeader('DIMLUNIT', _val
)
798 # print "bitpos: %d" % _bitpos
799 _bitpos
, _val
= dwgutil
.get_bit_short(_data
, _bitpos
)
800 dwg
.setHeader('DIMDSEP', _val
)
801 # print "bitpos: %d" % _bitpos
802 _bitpos
, _val
= dwgutil
.get_bit_short(_data
, _bitpos
)
803 dwg
.setHeader('DIMTMOVE', _val
)
804 # print "bitpos: %d" % _bitpos
805 _bitpos
, _val
= dwgutil
.get_bit_short(_data
, _bitpos
)
806 dwg
.setHeader('DIMJUST', _val
)
807 # print "bitpos: %d" % _bitpos
808 _bitpos
, _val
= dwgutil
.test_bit(_data
, _bitpos
)
809 dwg
.setHeader('DIMSD1', _val
)
810 # print "bitpos: %d" % _bitpos
811 _bitpos
, _val
= dwgutil
.test_bit(_data
, _bitpos
)
812 dwg
.setHeader('DIMSD2', _val
)
813 # print "bitpos: %d" % _bitpos
814 _bitpos
, _val
= dwgutil
.get_bit_short(_data
, _bitpos
)
815 dwg
.setHeader('DIMTOLJ', _val
)
816 # print "bitpos: %d" % _bitpos
817 _bitpos
, _val
= dwgutil
.get_bit_short(_data
, _bitpos
)
818 dwg
.setHeader('DIMTZIN', _val
)
819 # print "bitpos: %d" % _bitpos
820 _bitpos
, _val
= dwgutil
.get_bit_short(_data
, _bitpos
)
821 dwg
.setHeader('DIMALTZ', _val
)
822 # print "bitpos: %d" % _bitpos
823 _bitpos
, _val
= dwgutil
.get_bit_short(_data
, _bitpos
)
824 dwg
.setHeader('DIMALTTZ', _val
)
825 # print "bitpos: %d" % _bitpos
826 _bitpos
, _val
= dwgutil
.test_bit(_data
, _bitpos
)
827 dwg
.setHeader('DIMUPT', _val
)
828 # print "bitpos: %d" % _bitpos
829 _bitpos
, _val
= dwgutil
.get_bit_short(_data
, _bitpos
)
830 dwg
.setHeader('DIMFIT', _val
)
831 # print "bitpos: %d" % _bitpos
832 _bitpos
, _handle
= dwgutil
.get_handle(_data
, _bitpos
)
833 dwg
.setHeader('DIMTXTSTY', _handle
)
834 # print "bitpos: %d" % _bitpos
835 _bitpos
, _handle
= dwgutil
.get_handle(_data
, _bitpos
)
836 dwg
.setHeader('DIMLDRBLK', _handle
)
837 # print "bitpos: %d" % _bitpos
838 _bitpos
, _handle
= dwgutil
.get_handle(_data
, _bitpos
)
839 dwg
.setHeader('DIMBLK', _handle
)
840 # print "bitpos: %d" % _bitpos
841 _bitpos
, _handle
= dwgutil
.get_handle(_data
, _bitpos
)
842 dwg
.setHeader('DIMBLK1', _handle
)
843 # print "bitpos: %d" % _bitpos
844 _bitpos
, _handle
= dwgutil
.get_handle(_data
, _bitpos
)
845 dwg
.setHeader('DIMBLK2', _handle
)
846 # print "bitpos: %d" % _bitpos
847 _bitpos
, _val
= dwgutil
.get_bit_short(_data
, _bitpos
)
848 dwg
.setHeader('DIMLWD', _handle
)
849 # print "bitpos: %d" % _bitpos
850 _bitpos
, _val
= dwgutil
.get_bit_short(_data
, _bitpos
)
851 dwg
.setHeader('DIMLWE', _handle
)
852 # print "bitpos: %d" % _bitpos
853 _bitpos
, _handle
= dwgutil
.get_handle(_data
, _bitpos
)
854 dwg
.setHeader('BLOCK_CONTROL_OBJECT', _handle
)
855 # print "bitpos: %d" % _bitpos
856 _bitpos
, _handle
= dwgutil
.get_handle(_data
, _bitpos
)
857 dwg
.setHeader('LAYER_CONTROL_OBJECT', _handle
)
858 # print "bitpos: %d" % _bitpos
859 _bitpos
, _handle
= dwgutil
.get_handle(_data
, _bitpos
)
860 dwg
.setHeader('STYLE_CONTROL_OBJECT', _handle
)
861 # print "bitpos: %d" % _bitpos
862 _bitpos
, _handle
= dwgutil
.get_handle(_data
, _bitpos
)
863 dwg
.setHeader('LINETYPE_CONTROL_OBJECT', _handle
)
864 # print "bitpos: %d" % _bitpos
865 _bitpos
, _handle
= dwgutil
.get_handle(_data
, _bitpos
)
866 dwg
.setHeader('VIEW_CONTROL_OBJECT', _handle
)
867 # print "bitpos: %d" % _bitpos
868 _bitpos
, _handle
= dwgutil
.get_handle(_data
, _bitpos
)
869 dwg
.setHeader('UCS_CONTROL_OBJECT', _handle
)
870 # print "bitpos: %d" % _bitpos
871 _bitpos
, _handle
= dwgutil
.get_handle(_data
, _bitpos
)
872 dwg
.setHeader('VPORT_CONTROL_OBJECT', _handle
)
873 # print "bitpos: %d" % _bitpos
874 _bitpos
, _handle
= dwgutil
.get_handle(_data
, _bitpos
)
875 dwg
.setHeader('APPID_CONTROL_OBJECT', _handle
)
876 # print "bitpos: %d" % _bitpos
877 _bitpos
, _handle
= dwgutil
.get_handle(_data
, _bitpos
)
878 dwg
.setHeader('DIMSTYLE_CONTROL_OBJECT', _handle
)
879 # print "bitpos: %d" % _bitpos
880 _bitpos
, _handle
= dwgutil
.get_handle(_data
, _bitpos
)
881 dwg
.setHeader('VIEWPORT_ENTITY_HEADER_CONTROL_OBJECT', _handle
)
882 # print "bitpos: %d" % _bitpos
883 _bitpos
, _handle
= dwgutil
.get_handle(_data
, _bitpos
)
884 dwg
.setHeader('ACAD_GROUP_DICTIONARY', _handle
)
885 # print "bitpos: %d" % _bitpos
886 _bitpos
, _handle
= dwgutil
.get_handle(_data
, _bitpos
)
887 dwg
.setHeader('ACAD_MLINE_DICTIONARY', _handle
)
888 # print "bitpos: %d" % _bitpos
889 _bitpos
, _handle
= dwgutil
.get_handle(_data
, _bitpos
)
890 dwg
.setHeader('NAMED_OBJECTS_DICTIONARY', _handle
)
891 # print "bitpos: %d" % _bitpos
892 _bitpos
, _val
= dwgutil
.get_bit_short(_data
, _bitpos
)
893 dwg
.setHeader('SHORT1', _val
)
894 # print "bitpos: %d" % _bitpos
895 _bitpos
, _val
= dwgutil
.get_bit_short(_data
, _bitpos
)
896 dwg
.setHeader('SHORT2', _val
)
897 # print "bitpos: %d" % _bitpos
898 _bitpos
, _string
= dwgutil
.get_text_string(_data
, _bitpos
)
899 dwg
.setHeader('HYPERLINKBASE', _string
)
900 # print "bitpos: %d" % _bitpos
901 _bitpos
, _string
= dwgutil
.get_text_string(_data
, _bitpos
)
902 dwg
.setHeader('STYLESHEET', _string
)
903 # print "bitpos: %d" % _bitpos
904 _bitpos
, _handle
= dwgutil
.get_handle(_data
, _bitpos
)
905 dwg
.setHeader('LAYOUTS_DICTIONARY', _handle
)
906 # print "bitpos: %d" % _bitpos
907 _bitpos
, _handle
= dwgutil
.get_handle(_data
, _bitpos
)
908 dwg
.setHeader('PLOTSETTINGS_DICTIONARY', _handle
)
909 # print "bitpos: %d" % _bitpos
910 _bitpos
, _handle
= dwgutil
.get_handle(_data
, _bitpos
)
911 dwg
.setHeader('PLOTSTYLES_DICTIONARY', _handle
)
912 # print "bitpos: %d" % _bitpos
913 _bitpos
, _val
= dwgutil
.get_bit_long(_data
, _bitpos
)
914 dwg
.setHeader('FLAGS', _val
)
915 # print "bitpos: %d" % _bitpos
916 _bitpos
, _val
= dwgutil
.get_bit_short(_data
, _bitpos
)
917 dwg
.setHeader('INSUNITS', _val
)
918 # print "bitpos: %d" % _bitpos
919 _bitpos
, _val
= dwgutil
.get_bit_short(_data
, _bitpos
)
920 dwg
.setHeader('CEPSNTYPE', _val
)
921 # print "bitpos: %d" % _bitpos
923 _bitpos
, _val
= dwgutil
.get_handle(_data
, _bitpos
)
924 dwg
.setHeader('CPSNID', _val
)
925 # print "bitpos: %d" % _bitpos
926 _bitpos
, _string
= dwgutil
.get_text_string(_data
, _bitpos
)
927 dwg
.setHeader('FINGERPRINT', _string
)
928 # print "bitpos: %d" % _bitpos
929 _bitpos
, _string
= dwgutil
.get_text_string(_data
, _bitpos
)
930 dwg
.setHeader('VERSIONGUID', _string
)
931 # print "bitpos: %d" % _bitpos
932 _bitpos
, _handle
= dwgutil
.get_handle(_data
, _bitpos
)
933 dwg
.setHeader('PSPACE_BLOCK_RECORD', _handle
)
934 # print "bitpos: %d" % _bitpos
935 _bitpos
, _handle
= dwgutil
.get_handle(_data
, _bitpos
)
936 dwg
.setHeader('MSPACE_BLOCK_RECORD', _handle
)
937 # print "bitpos: %d" % _bitpos
938 _bitpos
, _handle
= dwgutil
.get_handle(_data
, _bitpos
)
939 dwg
.setHeader('LTYPE_BYLAYER', _handle
)
940 # print "bitpos: %d" % _bitpos
941 _bitpos
, _handle
= dwgutil
.get_handle(_data
, _bitpos
)
942 dwg
.setHeader('LTYPE_BYBLOCK', _handle
)
943 # print "bitpos: %d" % _bitpos
944 _bitpos
, _handle
= dwgutil
.get_handle(_data
, _bitpos
)
945 dwg
.setHeader('LTYPE_CONTINUOUS', _handle
)
946 # print "bitpos: %d" % _bitpos
947 # print "bitpos after LTYPE (CONTINUOUS): %d" % _bitpos
948 # print "byte: %d" % (_bitpos/8)
949 # print "offset: %d" % (_bitpos % 8)
951 # remaing bits are unknown, and they end with possible
952 # padding bits so that 16-bit CRC value after the data
953 # is on a byte boundary - ignore them for now ...
956 def get_classes(dwg
):
957 _handle
= dwg
.getHandle()
958 _offset
, _size
= dwg
.getOffset('CLASSES') # size is ignored
959 _handle
.seek(_offset
, 0)
960 _s
= array
.array('B')
961 _s
.fromfile(_handle
, 16)
962 if _s
[0] != 0x8d: raise ValueError, "_s[0] != 0x8d"
963 if _s
[1] != 0xa1: raise ValueError, "_s[1] != 0xa1"
964 if _s
[2] != 0xc4: raise ValueError, "_s[2] != 0xc4"
965 if _s
[3] != 0xb8: raise ValueError, "_s[3] != 0xb8"
966 if _s
[4] != 0xc4: raise ValueError, "_s[4] != 0xc4"
967 if _s
[5] != 0xa9: raise ValueError, "_s[5] != 0xa9"
968 if _s
[6] != 0xf8: raise ValueError, "_s[6] != 0xf8"
969 if _s
[7] != 0xc5: raise ValueError, "_s[7] != 0xc5"
970 if _s
[8] != 0xc0: raise ValueError, "_s[8] != 0xc0"
971 if _s
[9] != 0xdc: raise ValueError, "_s[9] != 0xdc"
972 if _s
[10] != 0xf4: raise ValueError, "_s[10] != 0xf4"
973 if _s
[11] != 0x5f: raise ValueError, "_s[11] != 0x5f"
974 if _s
[12] != 0xe7: raise ValueError, "_s[12] != 0xe7"
975 if _s
[13] != 0xcf: raise ValueError, "_s[13] != 0xcf"
976 if _s
[14] != 0xb6: raise ValueError, "_s[14] != 0xb6"
977 if _s
[15] != 0x8a: raise ValueError, "_s[15] != 0x8a"
978 _size
= struct
.unpack('<l', _handle
.read(4))[0]
979 _data
= array
.array('B')
980 _data
.fromfile(_handle
, _size
)
981 _crc
= struct
.unpack('<h', _handle
.read(2))[0]
982 _s
.fromfile(_handle
, 16)
983 if _s
[16] != 0x72: raise ValueError, "_s[16] != 0x72"
984 if _s
[17] != 0x5e: raise ValueError, "_s[17] != 0x5e"
985 if _s
[18] != 0x3b: raise ValueError, "_s[18] != 0x3b"
986 if _s
[19] != 0x47: raise ValueError, "_s[19] != 0x47"
987 if _s
[20] != 0x3b: raise ValueError, "_s[20] != 0x3b"
988 if _s
[21] != 0x56: raise ValueError, "_s[21] != 0x56"
989 if _s
[22] != 0x07: raise ValueError, "_s[22] != 0x07"
990 if _s
[23] != 0x3a: raise ValueError, "_s[23] != 0x3a"
991 if _s
[24] != 0x3f: raise ValueError, "_s[24] != 0x3f"
992 if _s
[25] != 0x23: raise ValueError, "_s[25] != 0x23"
993 if _s
[26] != 0x0b: raise ValueError, "_s[26] != 0x0b"
994 if _s
[27] != 0xa0: raise ValueError, "_s[27] != 0xa0"
995 if _s
[28] != 0x18: raise ValueError, "_s[28] != 0x18"
996 if _s
[29] != 0x30: raise ValueError, "_s[29] != 0x30"
997 if _s
[30] != 0x49: raise ValueError, "_s[30] != 0x49"
998 if _s
[31] != 0x75: raise ValueError, "_s[31] != 0x75"
1000 # get the class info from the data array
1004 while (_bitpos
+ 8) < _maxbit
: # watch out for padding bits ...
1005 _bitpos
, _classnum
= dwgutil
.get_bit_short(_data
, _bitpos
)
1006 _bitpos
, _ver
= dwgutil
.get_bit_short(_data
, _bitpos
)
1007 _bitpos
, _appname
= dwgutil
.get_text_string(_data
, _bitpos
)
1008 _bitpos
, _cppcn
= dwgutil
.get_text_string(_data
, _bitpos
)
1009 _bitpos
, _dxfname
= dwgutil
.get_text_string(_data
, _bitpos
)
1010 _bitpos
, _zombie
= dwgutil
.test_bit(_data
, _bitpos
)
1011 _bitpos
, _id
= dwgutil
.get_bit_short(_data
, _bitpos
)
1012 dwg
.setDxfName(_classnum
, _dxfname
)
1013 dwg
.setClass(_classnum
, (_ver
, _appname
, _cppcn
, _zombie
, _id
))
1015 def get_objects(dwg
):
1016 for _offset
in dwg
.getEntityOffset():
1017 _obj
= get_object(dwg
, _offset
)
1020 def get_offsets(dwg
):
1021 _handle
= dwg
.getHandle()
1022 _offset
, _size
= dwg
.getOffset('OBJECTS') # size is ignored
1023 _handle
.seek(_offset
, 0)
1025 _data
= array
.array('B')
1026 _size
= struct
.unpack('>h', _handle
.read(2))[0] # big-endian size
1027 if _size
== 2: # section is just CRC
1029 _data
.fromfile(_handle
, _size
)
1031 # the spec says 'last_handle' and 'last_loc' are initialized outside
1032 # the outer for loop - postings on OpenDWG forum say these variables
1033 # must be initialized for each section
1038 _bitmax
= (_size
- 2) * 8 # remove two bytes for section CRC
1040 # there should be something done with the CRC for section ...
1042 while _bitpos
< _bitmax
:
1043 _bitpos
, _hoffset
= dwgutil
.get_modular_char(_data
, _bitpos
)
1044 _last_handle
= _last_handle
+ _hoffset
1045 _bitpos
, _foffset
= dwgutil
.get_modular_char(_data
, _bitpos
)
1046 _last_loc
= _last_loc
+ _foffset
1047 dwg
.addEntityOffset(_last_handle
, _last_loc
)
1049 # read the common parts at the start of many entities
1052 def header_read(ent
, data
, offset
):
1054 _mode
= dwgutil
.get_bits(data
, 2, _bitpos
)
1055 _bitpos
= _bitpos
+ 2
1057 _bitpos
, _rnum
= dwgutil
.get_bit_long(data
, _bitpos
)
1058 ent
.setNumReactors(_rnum
)
1059 _bitpos
, _nolinks
= dwgutil
.test_bit(data
, _bitpos
)
1060 ent
.setNoLinks(_nolinks
)
1061 _bitpos
, _color
= dwgutil
.get_bit_short(data
, _bitpos
)
1062 ent
.setColor(_color
)
1063 _bitpos
, _ltscale
= dwgutil
.get_bit_double(data
, _bitpos
)
1064 ent
.setLinetypeScale(_ltscale
)
1065 _ltflag
= dwgutil
.get_bits(data
, 2, _bitpos
)
1066 _bitpos
= _bitpos
+ 2
1067 ent
.setLinetypeFlags(_ltflag
)
1068 _psflag
= dwgutil
.get_bits(data
, 2, _bitpos
)
1069 _bitpos
= _bitpos
+ 2
1070 ent
.setPlotstyleFlags(_psflag
)
1071 _bitpos
, _invis
= dwgutil
.get_bit_short(data
, _bitpos
)
1072 ent
.setInvisiblity(_invis
)
1073 _bitpos
, _weight
= dwgutil
.get_raw_char(data
, _bitpos
)
1074 ent
.setLineweight(_weight
)
1077 # read the common parts ant the end of many entities
1080 def tail_read(ent
, data
, offset
):
1083 if ent
.getMode() == 0x0:
1084 _bitpos
, _sh
= dwgutil
.get_handle(data
, _bitpos
)
1085 ent
.setSubentity(_sh
)
1086 for _i
in range(ent
.getNumReactors()):
1087 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
1088 ent
.addReactor(_handle
)
1089 _bitpos
, _xh
= dwgutil
.get_handle(data
, _bitpos
)
1091 _bitpos
, _lh
= dwgutil
.get_handle(data
, _bitpos
)
1093 if ent
.getNoLinks() is False:
1094 _bitpos
, _prev
= dwgutil
.get_handle(data
, _bitpos
)
1095 ent
.setPrevious(_prev
)
1096 _bitpos
, _next
= dwgutil
.get_handle(data
, _bitpos
)
1098 if ent
.getLinetypeFlags() == 0x3:
1099 _bitpos
, _lth
= dwgutil
.get_handle(data
, _bitpos
)
1100 ent
.setLinetype(_lth
)
1101 if ent
.getPlotstyleFlags() == 0x3:
1102 _bitpos
, _pth
= dwgutil
.get_handle(data
, _bitpos
)
1103 ent
.setPlotstyle(_pth
)
1107 # read the various entities stored in the DWG file
1110 def text_reader(ent
, data
, offset
):
1112 _bitpos
= header_read(ent
, data
, _bitpos
)
1113 _bitpos
, _dflag
= dwgutil
.get_raw_char(data
, _bitpos
)
1114 ent
.setEntityData('data_flag', _dflag
)
1115 if not (_dflag
& 0x1):
1116 _bitpos
, _elev
= dwgutil
.get_raw_double(data
, _bitpos
)
1117 ent
.setEntityData('elevation', _elev
)
1118 _bitpos
, _x1
= dwgutil
.get_raw_double(data
, _bitpos
)
1119 _bitpos
, _y1
= dwgutil
.get_raw_double(data
, _bitpos
)
1120 ent
.setEntityData('insertion_point', (_x1
, _y1
))
1121 if not (_dflag
& 0x2):
1122 _bitpos
, _x
= dwgutil
.get_default_double(data
, _bitpos
, _x1
)
1123 _bitpos
, _y
= dwgutil
.get_default_double(data
, _bitpos
, _y1
)
1124 ent
.setEntityData('alignment_point', (_x
, _y
))
1125 _bitpos
, _flag
= dwgutil
.test_bit(data
, _bitpos
)
1130 _bitpos
, _x
= dwgutil
.get_bit_double(data
, _bitpos
)
1131 _bitpos
, _y
= dwgutil
.get_bit_double(data
, _bitpos
)
1132 _bitpos
, _z
= dwgutil
.get_bit_double(data
, _bitpos
)
1133 ent
.setEntityData('extrusion', (_x
, _y
, _z
))
1134 _bitpos
, _th
= dwgutil
.test_bit(data
, _bitpos
)
1138 _bitpos
, _th
= dwgutil
.get_bit_double(data
, _bitpos
)
1139 ent
.setEntityData('thickness', _th
)
1140 if not (_dflag
& 0x4):
1141 _bitpos
, _oblique
= dwgutil
.get_raw_double(data
, _bitpos
)
1142 ent
.setEntityData('oblique_angle', _oblique
)
1143 if not (_dflag
& 0x8):
1144 _bitpos
, _rotation
= dwgutil
.get_raw_double(data
, _bitpos
)
1145 ent
.setEntityData('rotation_angle', _rotation
)
1146 _bitpos
, _height
= dwgutil
.get_raw_double(data
, _bitpos
)
1147 ent
.setEntityData('height', _height
)
1148 if not (_dflag
& 0x10):
1149 _bitpos
, _width
= dwgutil
.get_raw_double(data
, _bitpos
)
1150 ent
.setEntityData('width_factor', _width
)
1151 _bitpos
, _text
= dwgutil
.get_text_string(data
, _bitpos
)
1152 ent
.setEntityData('text', _text
)
1153 if not (_dflag
& 0x20):
1154 _bitpos
, _gen
= dwgutil
.get_bit_short(data
, _bitpos
)
1155 ent
.setEntityData('generation', _gen
)
1156 if not (_dflag
& 0x40):
1157 _bitpos
, _halign
= dwgutil
.get_bit_short(data
, _bitpos
)
1158 ent
.setEntityData('halign', _halign
)
1159 if not (_dflag
& 0x80):
1160 _bitpos
, _valign
= dwgutil
.get_bit_short(data
, _bitpos
)
1161 ent
.setEntityData('valign', _valign
)
1162 _bitpos
= tail_read(ent
, data
, _bitpos
)
1163 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
1164 ent
.setEntityData('style_handle', _handle
)
1166 def attrib_reader(ent
, data
, offset
):
1168 _bitpos
= header_read(ent
, data
, _bitpos
)
1169 _bitpos
, _dflag
= dwgutil
.get_raw_char(data
, _bitpos
)
1170 ent
.setEntityData('data_flag', _dflag
)
1171 if not (_dflag
& 0x1):
1172 _bitpos
, _elev
= dwgutil
.get_raw_double(data
, _bitpos
)
1173 ent
.setEntityData('elevation', _elev
)
1174 _bitpos
, _x1
= dwgutil
.get_raw_double(data
, _bitpos
)
1175 _bitpos
, _y1
= dwgutil
.get_raw_double(data
, _bitpos
)
1176 ent
.setEntityData('insertion_point', (_x1
, _y1
))
1177 if not (_dflag
& 0x2):
1178 _bitpos
, _x
= dwgutil
.get_default_double(data
, _bitpos
, _x1
)
1179 _bitpos
, _y
= dwgutil
.get_default_double(data
, _bitpos
, _y1
)
1180 ent
.setEntityData('alignment_point', (_x
, _y
))
1181 _bitpos
, _flag
= dwgutil
.test_bit(data
, _bitpos
)
1186 _bitpos
, _x
= dwgutil
.get_bit_double(data
, _bitpos
)
1187 _bitpos
, _y
= dwgutil
.get_bit_double(data
, _bitpos
)
1188 _bitpos
, _z
= dwgutil
.get_bit_double(data
, _bitpos
)
1189 ent
.setEntityData('extrusion', (_x
, _y
, _z
))
1190 _bitpos
, _th
= dwgutil
.test_bit(data
, _bitpos
)
1194 _bitpos
, _th
= dwgutil
.get_bit_double(data
, _bitpos
)
1195 ent
.setEntityData('thickness', _th
)
1196 if not (_dflag
& 0x4):
1197 _bitpos
, _oblique
= dwgutil
.get_raw_double(data
, _bitpos
)
1198 ent
.setEntityData('oblique_angle', _oblique
)
1199 if not (_dflag
& 0x8):
1200 _bitpos
, _rotation
= dwgutil
.get_raw_double(data
, _bitpos
)
1201 ent
.setEntityData('rotation_angle', _rotation
)
1202 _bitpos
, _height
= dwgutil
.get_raw_double(data
, _bitpos
)
1203 ent
.setEntityData('height', _height
)
1204 if not (_dflag
& 0x10):
1205 _bitpos
, _width
= dwgutil
.get_raw_double(data
, _bitpos
)
1206 ent
.setEntityData('width_factor', _width
)
1207 _bitpos
, _text
= dwgutil
.get_text_string(data
, _bitpos
)
1208 ent
.setEntityData('text', _text
)
1209 if not (_dflag
& 0x20):
1210 _bitpos
, _gen
= dwgutil
.get_bit_short(data
, _bitpos
)
1211 ent
.setEntityData('generation', _gen
)
1212 if not (_dflag
& 0x40):
1213 _bitpos
, _halign
= dwgutil
.get_bit_short(data
, _bitpos
)
1214 ent
.setEntityData('halign', _halign
)
1215 if not (_dflag
& 0x80):
1216 _bitpos
, _valign
= dwgutil
.get_bit_short(data
, _bitpos
)
1217 ent
.setEntityData('valign', _valign
)
1218 _bitpos
, _tag
= dwgutil
.get_text_string(data
, _bitpos
)
1219 ent
.setEntityData('tag', _tag
)
1220 _bitpos
, _fl
= dwgutil
.get_bit_short(data
, _bitpos
)
1221 ent
.setEntityData('field_length', _fl
)
1222 _bitpos
, _flags
= dwgutil
.get_raw_char(data
, _bitpos
)
1223 ent
.setEntityData('flags', _flags
)
1224 _bitpos
= tail_read(ent
, data
, _bitpos
)
1225 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
1226 ent
.setEntityData('style_handle', _handle
)
1228 def attdef_reader(ent
, data
, offset
):
1230 _bitpos
= header_read(ent
, data
, _bitpos
)
1231 _bitpos
, _dflag
= dwgutil
.get_raw_char(data
, _bitpos
)
1232 ent
.setEntityData('data_flag', _dflag
)
1233 if not (_dflag
& 0x1):
1234 _bitpos
, _elev
= dwgutil
.get_raw_double(data
, _bitpos
)
1235 ent
.setEntityData('elevation', _elev
)
1236 _bitpos
, _x1
= dwgutil
.get_raw_double(data
, _bitpos
)
1237 _bitpos
, _y1
= dwgutil
.get_raw_double(data
, _bitpos
)
1238 ent
.setEntityData('insertion_point', (_x1
, _y1
))
1239 if not (_dflag
& 0x2):
1240 _bitpos
, _x
= dwgutil
.get_default_double(data
, _bitpos
, _x1
)
1241 _bitpos
, _y
= dwgutil
.get_default_double(data
, _bitpos
, _y1
)
1242 ent
.setEntityData('alignment_point', (_x
, _y
))
1243 _bitpos
, _flag
= dwgutil
.test_bit(data
, _bitpos
)
1248 _bitpos
, _x
= dwgutil
.get_bit_double(data
, _bitpos
)
1249 _bitpos
, _y
= dwgutil
.get_bit_double(data
, _bitpos
)
1250 _bitpos
, _z
= dwgutil
.get_bit_double(data
, _bitpos
)
1251 ent
.setEntityData('extrusion', (_x
, _y
, _z
))
1252 _bitpos
, _th
= dwgutil
.test_bit(data
, _bitpos
)
1256 _bitpos
, _th
= dwgutil
.get_bit_double(data
, _bitpos
)
1257 ent
.setEntityData('thickness', _th
)
1258 if not (_dflag
& 0x4):
1259 _bitpos
, _oblique
= dwgutil
.get_raw_double(data
, _bitpos
)
1260 ent
.setEntityData('oblique_angle', _oblique
)
1261 if not (_dflag
& 0x8):
1262 _bitpos
, _rotation
= dwgutil
.get_raw_double(data
, _bitpos
)
1263 ent
.setEntityData('rotation_angle', _rotation
)
1264 _bitpos
, _height
= dwgutil
.get_raw_double(data
, _bitpos
)
1265 ent
.setEntityData('height', _height
)
1266 if not (_dflag
& 0x10):
1267 _bitpos
, _width
= dwgutil
.get_raw_double(data
, _bitpos
)
1268 ent
.setEntityData('width_factor', _width
)
1269 _bitpos
, _text
= dwgutil
.get_text_string(data
, _bitpos
)
1270 ent
.setEntityData('text', _text
)
1271 if not (_dflag
& 0x20):
1272 _bitpos
, _gen
= dwgutil
.get_bit_short(data
, _bitpos
)
1273 ent
.setEntityData('generation', _gen
)
1274 if not (_dflag
& 0x40):
1275 _bitpos
, _halign
= dwgutil
.get_bit_short(data
, _bitpos
)
1276 ent
.setEntityData('halign', _halign
)
1277 if not (_dflag
& 0x80):
1278 _bitpos
, _valign
= dwgutil
.get_bit_short(data
, _bitpos
)
1279 ent
.setEntityData('valign', _valign
)
1280 _bitpos
, _tag
= dwgutil
.get_text_string(data
, _bitpos
)
1281 ent
.setEntityData('tag', _tag
)
1282 _bitpos
, _fl
= dwgutil
.get_bit_short(data
, _bitpos
)
1283 ent
.setEntityData('field_length', _fl
)
1284 _bitpos
, _flags
= dwgutil
.get_raw_char(data
, _bitpos
)
1285 ent
.setEntityData('flags', _flags
)
1286 _bitpos
, _prompt
= dwgutil
.get_text_string(data
, _bitpos
)
1287 ent
.setEntityData('prompt', _prompt
)
1288 _bitpos
= tail_read(ent
, data
, _bitpos
)
1289 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
1290 ent
.setEntityData('style_handle', _handle
)
1292 def block_reader(ent
, data
, offset
):
1294 _bitpos
= header_read(ent
, data
, _bitpos
)
1295 _bitpos
, _text
= dwgutil
.get_text_string(data
, _bitpos
)
1296 ent
.setEntityData('name', _text
)
1297 _bitpos
= tail_read(ent
, data
, _bitpos
)
1299 def endblk_reader(ent
, data
, offset
):
1301 _bitpos
= header_read(ent
, data
, _bitpos
)
1302 _bitpos
= tail_read(ent
, data
, _bitpos
)
1304 def seqend_reader(ent
, data
, offset
):
1306 _bitpos
= header_read(ent
, data
, _bitpos
)
1307 _bitpos
= tail_read(ent
, data
, _bitpos
)
1309 def insert_reader(ent
, data
, offset
):
1311 _bitpos
= header_read(ent
, data
, _bitpos
)
1312 _bitpos
, _x
= dwgutil
.get_bit_double(data
, _bitpos
)
1313 _bitpos
, _y
= dwgutil
.get_bit_double(data
, _bitpos
)
1314 _bitpos
, _z
= dwgutil
.get_bit_double(data
, _bitpos
)
1315 ent
.setEntityData('insertion_point', (_x
, _y
, _z
))
1316 _dflag
= dwgutil
.get_bits(data
, 2, _bitpos
)
1317 _bitpos
= _bitpos
+ 2
1319 _bitpos
, _x
= dwgutil
.get_raw_double(data
, _bitpos
)
1320 _bitpos
, _y
= dwgutil
.get_default_double(data
, _bitpos
, _x
)
1321 _bitpos
, _z
= dwgutil
.get_default_double(data
, _bitpos
, _x
)
1324 _bitpos
, _y
= dwgutil
.get_default_double(data
, _bitpos
, _x
)
1325 _bitpos
, _z
= dwgutil
.get_default_double(data
, _bitpos
, _x
)
1327 _bitpos
, _x
= dwgutil
.get_raw_double(data
, _bitpos
)
1331 ent
.setEntityData('scale', (_x
, _y
, _z
))
1332 _bitpos
, _rot
= dwgutil
.get_bit_double(data
, _bitpos
)
1333 ent
.setEntityData('rotation', _rot
)
1334 _bitpos
, _x
= dwgutil
.get_bit_double(data
, _bitpos
)
1335 _bitpos
, _y
= dwgutil
.get_bit_double(data
, _bitpos
)
1336 _bitpos
, _z
= dwgutil
.get_bit_double(data
, _bitpos
)
1337 ent
.setEntityData('extrusion', (_x
, _y
, _z
))
1338 _bitpos
, _hasattr
= dwgutil
.test_bit(data
, _bitpos
)
1339 _bitpos
= tail_read(ent
, data
, _bitpos
)
1340 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
1341 ent
.setEntityData('block_header_handle', _handle
)
1343 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
1344 ent
.setEntityData('first_attrib_handle', _handle
)
1345 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
1346 ent
.setEntityData('last_attrib_handle', _handle
)
1347 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
1348 ent
.setEntityData('seqend_handle', _handle
)
1350 def minsert_reader(ent
, data
, offset
):
1352 _bitpos
= header_read(ent
, data
, _bitpos
)
1353 _bitpos
, _x
= dwgutil
.get_bit_double(data
, _bitpos
)
1354 _bitpos
, _y
= dwgutil
.get_bit_double(data
, _bitpos
)
1355 _bitpos
, _z
= dwgutil
.get_bit_double(data
, _bitpos
)
1356 ent
.setEntityData('insertion_point', (_x
, _y
, _z
))
1357 _dflag
= dwgutil
.get_bits(data
, 2, _bitpos
)
1358 _bitpos
= _bitpos
+ 2
1360 _bitpos
, _x
= dwgutil
.get_raw_double(data
, _bitpos
)
1361 _bitpos
, _y
= dwgutil
.get_default_double(data
, _bitpos
, _x
)
1362 _bitpos
, _z
= dwgutil
.get_default_double(data
, _bitpos
, _x
)
1365 _bitpos
, _y
= dwgutil
.get_default_double(data
, _bitpos
, _x
)
1366 _bitpos
, _z
= dwgutil
.get_default_double(data
, _bitpos
, _x
)
1368 _bitpos
, _x
= dwgutil
.get_raw_double(data
, _bitpos
)
1372 ent
.setEntityData('scale', (_x
, _y
, _z
))
1373 _bitpos
, _rot
= dwgutil
.get_bit_double(data
, _bitpos
)
1374 ent
.setEntityData('rotation', _rot
)
1375 _bitpos
, _x
= dwgutil
.get_bit_double(data
, _bitpos
)
1376 _bitpos
, _y
= dwgutil
.get_bit_double(data
, _bitpos
)
1377 _bitpos
, _z
= dwgutil
.get_bit_double(data
, _bitpos
)
1378 ent
.setEntityData('extrusion', (_x
, _y
, _z
))
1379 _bitpos
, _hasattr
= dwgutil
.test_bit(data
, _bitpos
)
1380 _bitpos
, _nc
= dwgutil
.get_bit_short(data
, _bitpos
)
1381 ent
.setEntityData('column_count', _nc
)
1382 _bitpos
, _nr
= dwgutil
.get_bit_short(data
, _bitpos
)
1383 ent
.setEntityData('row_count', _nr
)
1384 _bitpos
, _colsp
= dwgutil
.get_bit_double(data
, _bitpos
)
1385 ent
.setEntityData('column_spacing', _colsp
)
1386 _bitpos
, _rowsp
= dwgutil
.get_bit_double(data
, _bitpos
)
1387 ent
.setEntityData('row_spacing', _rowsp
)
1388 _bitpos
= tail_read(ent
, data
, _bitpos
)
1389 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
1390 ent
.setEntityData('block_header_handle', _handle
)
1392 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
1393 ent
.setEntityData('first_attrib_handle', _handle
)
1394 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
1395 ent
.setEntityData('last_attrib_handle', _handle
)
1396 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
1397 ent
.setEntityData('seqend_handle', _handle
)
1399 def vertex2d_reader(ent
, data
, offset
):
1401 _bitpos
= header_read(ent
, data
, _bitpos
)
1402 _bitpos
, _flags
= dwgutil
.get_raw_char(data
, _bitpos
)
1403 ent
.setEntityData('flags', _flags
)
1404 _bitpos
, _x
= dwgutil
.get_bit_double(data
, _bitpos
)
1405 _bitpos
, _y
= dwgutil
.get_bit_double(data
, _bitpos
)
1406 _bitpos
, _z
= dwgutil
.get_bit_double(data
, _bitpos
)
1407 ent
.setEntityData('point', (_x
, _y
, _z
))
1408 _bitpos
, _sw
= dwgutil
.get_bit_double(data
, _bitpos
)
1410 _sw
= _ew
= abs(_sw
)
1412 _bitpos
, _ew
= dwgutil
.get_bit_double(data
, _bitpos
)
1413 ent
.setEntityData('start_width', _sw
)
1414 ent
.setEntityData('end_width', _ew
)
1415 _bitpos
, _bulge
= dwgutil
.get_bit_double(data
, _bitpos
)
1416 ent
.setEntityData('bulge', _bulge
)
1417 _bitpos
, _tandir
= dwgutil
.get_bit_double(data
, _bitpos
)
1418 ent
.setEntityData('tangent_dir', _tandir
)
1419 _bitpos
= tail_read(ent
, data
, _bitpos
)
1421 def vertex3d_reader(ent
, data
, offset
):
1423 _bitpos
= header_read(ent
, data
, _bitpos
)
1424 _bitpos
, _flags
= dwgutil
.get_raw_char(data
, _bitpos
)
1425 ent
.setEntityData('flags', _flags
)
1426 _bitpos
, _x
= dwgutil
.get_bit_double(data
, _bitpos
)
1427 _bitpos
, _y
= dwgutil
.get_bit_double(data
, _bitpos
)
1428 _bitpos
, _z
= dwgutil
.get_bit_double(data
, _bitpos
)
1429 ent
.setEntityData('point', (_x
, _y
, _z
))
1430 _bitpos
= tail_read(ent
, data
, _bitpos
)
1432 def vertex_mesh_reader(ent
, data
, offset
):
1434 _bitpos
= header_read(ent
, data
, _bitpos
)
1435 _bitpos
, _flags
= dwgutil
.get_raw_char(data
, _bitpos
)
1436 ent
.setEntityData('flags', _flags
)
1437 _bitpos
, _x
= dwgutil
.get_bit_double(data
, _bitpos
)
1438 _bitpos
, _y
= dwgutil
.get_bit_double(data
, _bitpos
)
1439 _bitpos
, _z
= dwgutil
.get_bit_double(data
, _bitpos
)
1440 ent
.setEntityData('point', (_x
, _y
, _z
))
1441 _bitpos
= tail_read(ent
, data
, _bitpos
)
1443 def vertex_pface_reader(ent
, data
, offset
):
1445 _bitpos
= header_read(ent
, data
, _bitpos
)
1446 _bitpos
, _flags
= dwgutil
.get_raw_char(data
, _bitpos
)
1447 ent
.setEntityData('flags', _flags
)
1448 _bitpos
, _x
= dwgutil
.get_bit_double(data
, _bitpos
)
1449 _bitpos
, _y
= dwgutil
.get_bit_double(data
, _bitpos
)
1450 _bitpos
, _z
= dwgutil
.get_bit_double(data
, _bitpos
)
1451 ent
.setEntityData('point', (_x
, _y
, _z
))
1452 _bitpos
= tail_read(ent
, data
, _bitpos
)
1454 def vertex_pface_face_reader(ent
, data
, offset
):
1456 _bitpos
= header_read(ent
, data
, _bitpos
)
1457 _bitpos
, _vi1
= dwgutil
.get_bit_short(data
, _bitpos
)
1458 _bitpos
, _vi2
= dwgutil
.get_bit_short(data
, _bitpos
)
1459 _bitpos
, _vi3
= dwgutil
.get_bit_short(data
, _bitpos
)
1460 _bitpos
, _vi4
= dwgutil
.get_bit_short(data
, _bitpos
)
1461 ent
.setEntityData('points', (_vi1
, _vi2
, _vi3
, _vi4
))
1462 _bitpos
= tail_read(ent
, data
, _bitpos
)
1464 def polyline2d_reader(ent
, data
, offset
):
1466 _bitpos
= header_read(ent
, data
, _bitpos
)
1467 _bitpos
, _flags
= dwgutil
.get_bit_short(data
, _bitpos
)
1468 ent
.setEntityData('flags', _flags
)
1469 _bitpos
, _ctype
= dwgutil
.get_bit_short(data
, _bitpos
)
1470 ent
.setEntityData('curve_type', _ctype
)
1471 _bitpos
, _sw
= dwgutil
.get_bit_double(data
, _bitpos
)
1472 ent
.setEntityData('start_width', _sw
)
1473 _bitpos
, _ew
= dwgutil
.get_bit_double(data
, _bitpos
)
1474 ent
.setEntityData('end_width', _ew
)
1475 _bitpos
, _flag
= dwgutil
.test_bit(data
, _bitpos
)
1479 _bitpos
, _th
= dwgutil
.get_bit_double(data
, _bitpos
)
1480 ent
.setEntityData('thickness', _th
)
1481 _bitpos
, _elev
= dwgutil
.get_bit_double(data
, _bitpos
)
1482 ent
.setEntityData('elevation', _elev
)
1483 _bitpos
, _flag
= dwgutil
.test_bit(data
, _bitpos
)
1488 _bitpos
, _ex
= dwgutil
.get_bit_double(data
, _bitpos
)
1489 _bitpos
, _ey
= dwgutil
.get_bit_double(data
, _bitpos
)
1490 _bitpos
, _ez
= dwgutil
.get_bit_double(data
, _bitpos
)
1491 ent
.setEntityData('extrusion', (_ex
, _ey
, _ez
))
1492 _bitpos
= tail_read(ent
, data
, _bitpos
)
1493 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
1494 ent
.setEntityData('first_vertex_handle', _handle
)
1495 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
1496 ent
.setEntityData('last_vertext_handle', _handle
)
1497 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
1498 ent
.setEntityData('seqend_handle', _handle
)
1500 def polyline3d_reader(ent
, data
, offset
):
1502 _bitpos
= header_read(ent
, data
, _bitpos
)
1503 _bitpos
, _sflags
= dwgutil
.get_raw_char(data
, _bitpos
)
1504 ent
.setEntityData('spline_flags', _sflags
)
1505 _bitpos
, _cflags
= dwgutil
.get_raw_char(data
, _bitpos
)
1506 ent
.setEntityData('closed_flags', _cflags
)
1507 _bitpos
= tail_read(ent
, data
, _bitpos
)
1508 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
1509 ent
.setEntityData('first_vertex_handle', _handle
)
1510 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
1511 ent
.setEntityData('last_vertex_handle', _handle
)
1512 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
1513 ent
.setEntityData('seqend_handle', _handle
)
1515 def arc_reader(ent
, data
, offset
):
1517 _bitpos
= header_read(ent
, data
, _bitpos
)
1518 _bitpos
, _x
= dwgutil
.get_bit_double(data
, _bitpos
)
1519 _bitpos
, _y
= dwgutil
.get_bit_double(data
, _bitpos
)
1520 _bitpos
, _z
= dwgutil
.get_bit_double(data
, _bitpos
)
1521 ent
.setEntityData('center', (_x
, _y
, _z
))
1522 _bitpos
, _val
= dwgutil
.get_bit_double(data
, _bitpos
)
1523 ent
.setEntityData('radius', _val
)
1524 _bitpos
, _flag
= dwgutil
.test_bit(data
, _bitpos
)
1528 _bitpos
, _val
= dwgutil
.get_bit_double(data
, _bitpos
)
1529 ent
.setEntityData('thickness', _val
)
1530 _bitpos
, _flag
= dwgutil
.test_bit(data
, _bitpos
)
1535 _bitpos
, _x
= dwgutil
.get_bit_double(data
, _bitpos
)
1536 _bitpos
, _y
= dwgutil
.get_bit_double(data
, _bitpos
)
1537 _bitpos
, _z
= dwgutil
.get_bit_double(data
, _bitpos
)
1538 ent
.setEntityData('extrusion', (_x
, _y
, _z
))
1539 _bitpos
, _val
= dwgutil
.get_bit_double(data
, _bitpos
)
1540 ent
.setEntityData('start_angle', _val
)
1541 _bitpos
, _val
= dwgutil
.get_bit_double(data
, _bitpos
)
1542 ent
.setEntityData('end_angle', _val
)
1543 _bitpos
= tail_read(ent
, data
, _bitpos
)
1545 def circle_reader(ent
, data
, offset
):
1547 _bitpos
= header_read(ent
, data
, _bitpos
)
1548 _bitpos
, _x
= dwgutil
.get_bit_double(data
, _bitpos
)
1549 _bitpos
, _y
= dwgutil
.get_bit_double(data
, _bitpos
)
1550 _bitpos
, _z
= dwgutil
.get_bit_double(data
, _bitpos
)
1551 ent
.setEntityData('center', (_x
, _y
, _z
))
1552 _bitpos
, _val
= dwgutil
.get_bit_double(data
, _bitpos
)
1553 ent
.setEntityData('radius', _val
)
1554 _bitpos
, _flag
= dwgutil
.test_bit(data
, _bitpos
)
1558 _bitpos
, _val
= dwgutil
.get_bit_double(data
, _bitpos
)
1559 ent
.setEntityData('thickness', _val
)
1560 _bitpos
, _flag
= dwgutil
.test_bit(data
, _bitpos
)
1565 _bitpos
, _x
= dwgutil
.get_bit_double(data
, _bitpos
)
1566 _bitpos
, _y
= dwgutil
.get_bit_double(data
, _bitpos
)
1567 _bitpos
, _z
= dwgutil
.get_bit_double(data
, _bitpos
)
1568 ent
.setEntityData('extrusion', (_x
, _y
, _z
))
1569 _bitpos
= tail_read(ent
, data
, _bitpos
)
1571 def line_reader(ent
, data
, offset
):
1573 _bitpos
= header_read(ent
, data
, _bitpos
)
1574 _bitpos
, _zflag
= dwgutil
.test_bit(data
, _bitpos
)
1575 _bitpos
, _x1
= dwgutil
.get_raw_double(data
, _bitpos
)
1576 _bitpos
, _x2
= dwgutil
.get_default_double(data
, _bitpos
, _x1
)
1577 _bitpos
, _y1
= dwgutil
.get_raw_double(data
, _bitpos
)
1578 _bitpos
, _y2
= dwgutil
.get_default_double(data
, _bitpos
, _y1
)
1580 _bitpos
, _z1
= dwgutil
.get_raw_double(data
, _bitpos
)
1581 _bitpos
, _z2
= dwgutil
.get_default_double(data
, _bitpos
, _z1
)
1582 _p1
= (_x1
, _y1
, _z1
)
1583 _p2
= (_x2
, _y2
, _z2
)
1587 ent
.setEntityData('p1', _p1
)
1588 ent
.setEntityData('p2', _p2
)
1589 _bitpos
, _flag
= dwgutil
.test_bit(data
, _bitpos
)
1593 _bitpos
, _th
= dwgutil
.get_bit_double(data
, _bitpos
)
1594 ent
.setEntityData('thickness', _th
)
1595 _bitpos
, _flag
= dwgutil
.test_bit(data
, _bitpos
)
1600 _bitpos
, _ex
= dwgutil
.get_bit_double(data
, _bitpos
)
1601 _bitpos
, _ey
= dwgutil
.get_bit_double(data
, _bitpos
)
1602 _bitpos
, _ez
= dwgutil
.get_bit_double(data
, _bitpos
)
1603 ent
.setEntityData('extrusion', (_ex
, _ey
, _ez
))
1604 _bitpos
= tail_read(ent
, data
, _bitpos
)
1606 def dimord_reader(ent
, data
, offset
):
1608 _bitpos
= header_read(ent
, data
, _bitpos
)
1609 _bitpos
, _x
= dwgutil
.get_bit_double(data
, _bitpos
)
1610 _bitpos
, _y
= dwgutil
.get_bit_double(data
, _bitpos
)
1611 _bitpos
, _z
= dwgutil
.get_bit_double(data
, _bitpos
)
1612 ent
.setEntityData('extrusion', (_x
, _y
, _z
))
1613 _bitpos
, _x
= dwgutil
.get_raw_double(data
, _bitpos
)
1614 _bitpos
, _y
= dwgutil
.get_raw_double(data
, _bitpos
)
1615 ent
.setEntityData('text_midpoint', (_x
, _y
))
1616 _bitpos
, _elev
= dwgutil
.get_bit_double(data
, _bitpos
)
1617 ent
.setEntityData('elevation', _elev
)
1618 _bitpos
, _flags
= dwgutil
.get_raw_char(data
, _bitpos
)
1619 ent
.setEntityData('flags', _flags
)
1620 _bitpos
, _text
= dwgutil
.get_text_string(data
, _bitpos
)
1621 ent
.setEntityData('text', _text
)
1622 _bitpos
, _rot
= dwgutil
.get_bit_double(data
, _bitpos
)
1623 ent
.setEntityData('rotation', _rot
)
1624 _bitpos
, _hdir
= dwgutil
.get_bit_double(data
, _bitpos
)
1625 ent
.setEntityData('horiz_dir', _hdir
)
1626 _bitpos
, _x
= dwgutil
.get_bit_double(data
, _bitpos
)
1627 _bitpos
, _y
= dwgutil
.get_bit_double(data
, _bitpos
)
1628 _bitpos
, _z
= dwgutil
.get_bit_double(data
, _bitpos
)
1629 ent
.setEntityData('ins_scale', (_x
, _y
, _z
))
1630 _bitpos
, _ir
= dwgutil
.get_bit_double(data
, _bitpos
)
1631 ent
.setEntityData('ins_rotation', _ir
)
1632 _bitpos
, _ap
= dwgutil
.get_bit_short(data
, _bitpos
)
1633 ent
.setEntityData('attachment_point', _ap
)
1634 _bitpos
, _lss
= dwgutil
.get_bit_short(data
, _bitpos
)
1635 ent
.setEntityData('linespace_style', _lss
)
1636 _bitpos
, _lsf
= dwgutil
.get_bit_double(data
, _bitpos
)
1637 ent
.setEntityData('linespace_factor', _lsf
)
1638 _bitpos
, _am
= dwgutil
.get_bit_double(data
, _bitpos
)
1639 ent
.setEntityData('actual_measurement', _am
)
1640 _bitpos
, _x
= dwgutil
.get_raw_double(data
, _bitpos
)
1641 _bitpos
, _y
= dwgutil
.get_raw_double(data
, _bitpos
)
1642 ent
.setEntityData('12-pt', (_x
, _y
))
1643 _bitpos
, _x
= dwgutil
.get_bit_double(data
, _bitpos
)
1644 _bitpos
, _y
= dwgutil
.get_bit_double(data
, _bitpos
)
1645 _bitpos
, _z
= dwgutil
.get_bit_double(data
, _bitpos
)
1646 ent
.setEntityData('10-pt', (_x
, _y
, _z
))
1647 _bitpos
, _x
= dwgutil
.get_bit_double(data
, _bitpos
)
1648 _bitpos
, _y
= dwgutil
.get_bit_double(data
, _bitpos
)
1649 _bitpos
, _z
= dwgutil
.get_bit_double(data
, _bitpos
)
1650 ent
.setEntityData('13-pt', (_x
, _y
, _z
))
1651 _bitpos
, _x
= dwgutil
.get_bit_double(data
, _bitpos
)
1652 _bitpos
, _y
= dwgutil
.get_bit_double(data
, _bitpos
)
1653 _bitpos
, _z
= dwgutil
.get_bit_double(data
, _bitpos
)
1654 ent
.setEntityData('14-pt', (_x
, _y
, _z
))
1655 _bitpos
, _flags2
= dwgutil
.get_raw_char(data
, _bitpos
)
1656 ent
.setEntityData('flags2', _flags
)
1657 _bitpos
= tail_read(ent
, data
, _bitpos
)
1658 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
1659 ent
.setEntityData('dimstyle_handle', _handle
)
1660 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
1661 ent
.setEntityData('anon_block_handle', _handle
)
1663 def dimlin_reader(ent
, data
, offset
):
1665 _bitpos
= header_read(ent
, data
, _bitpos
)
1666 _bitpos
, _x
= dwgutil
.get_bit_double(data
, _bitpos
)
1667 _bitpos
, _y
= dwgutil
.get_bit_double(data
, _bitpos
)
1668 _bitpos
, _z
= dwgutil
.get_bit_double(data
, _bitpos
)
1669 ent
.setEntityData('extrusion', (_x
, _y
, _z
))
1670 _bitpos
, _x
= dwgutil
.get_raw_double(data
, _bitpos
)
1671 _bitpos
, _y
= dwgutil
.get_raw_double(data
, _bitpos
)
1672 ent
.setEntityData('text_midpoint', (_x
, _y
))
1673 _bitpos
, _elev
= dwgutil
.get_bit_double(data
, _bitpos
)
1674 ent
.setEntityData('elevation', _elev
)
1675 _bitpos
, _flags
= dwgutil
.get_raw_char(data
, _bitpos
)
1676 ent
.setEntityData('flags', _flags
)
1677 _bitpos
, _text
= dwgutil
.get_text_string(data
, _bitpos
)
1678 ent
.setEntityData('text', _text
)
1679 _bitpos
, _rot
= dwgutil
.get_bit_double(data
, _bitpos
)
1680 ent
.setEntityData('rotation', _rot
)
1681 _bitpos
, _hdir
= dwgutil
.get_bit_double(data
, _bitpos
)
1682 ent
.setEntityData('horiz_dir', _hdir
)
1683 _bitpos
, _x
= dwgutil
.get_bit_double(data
, _bitpos
)
1684 _bitpos
, _y
= dwgutil
.get_bit_double(data
, _bitpos
)
1685 _bitpos
, _z
= dwgutil
.get_bit_double(data
, _bitpos
)
1686 ent
.setEntityData('ins_scale', (_x
, _y
, _z
))
1687 _bitpos
, _ir
= dwgutil
.get_bit_double(data
, _bitpos
)
1688 ent
.setEntityData('ins_rotation', _ir
)
1689 _bitpos
, _ap
= dwgutil
.get_bit_short(data
, _bitpos
)
1690 ent
.setEntityData('attachment_point', _ap
)
1691 _bitpos
, _lss
= dwgutil
.get_bit_short(data
, _bitpos
)
1692 ent
.setEntityData('linespace_style', _lss
)
1693 _bitpos
, _lsf
= dwgutil
.get_bit_double(data
, _bitpos
)
1694 ent
.setEntityData('linespace_factor', _lsf
)
1695 _bitpos
, _am
= dwgutil
.get_bit_double(data
, _bitpos
)
1696 ent
.setEntityData('actual_measurement', _am
)
1697 _bitpos
, _x
= dwgutil
.get_raw_double(data
, _bitpos
)
1698 _bitpos
, _y
= dwgutil
.get_raw_double(data
, _bitpos
)
1699 ent
.setEntityData('12-pt', (_x
, _y
))
1700 _bitpos
, _x
= dwgutil
.get_bit_double(data
, _bitpos
)
1701 _bitpos
, _y
= dwgutil
.get_bit_double(data
, _bitpos
)
1702 _bitpos
, _z
= dwgutil
.get_bit_double(data
, _bitpos
)
1703 ent
.setEntityData('10-pt', (_x
, _y
, _z
))
1704 _bitpos
, _x
= dwgutil
.get_bit_double(data
, _bitpos
)
1705 _bitpos
, _y
= dwgutil
.get_bit_double(data
, _bitpos
)
1706 _bitpos
, _z
= dwgutil
.get_bit_double(data
, _bitpos
)
1707 ent
.setEntityData('13-pt', (_x
, _y
, _z
))
1708 _bitpos
, _x
= dwgutil
.get_bit_double(data
, _bitpos
)
1709 _bitpos
, _y
= dwgutil
.get_bit_double(data
, _bitpos
)
1710 _bitpos
, _z
= dwgutil
.get_bit_double(data
, _bitpos
)
1711 ent
.setEntityData('14-pt', (_x
, _y
, _z
))
1712 _bitpos
, _elr
= dwgutil
.get_bit_double(data
, _bitpos
)
1713 ent
.setEntityData('ext_rotation', _elr
)
1714 _bitpos
, _dr
= dwgutil
.get_bit_double(data
, _bitpos
)
1715 ent
.setEntityData('dimension_rotation', _dr
)
1716 _bitpos
= tail_read(ent
, data
, _bitpos
)
1717 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
1718 ent
.setEntityData('dimstyle_handle', _handle
)
1719 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
1720 ent
.setEntityData('anon_block_handle', _handle
)
1722 def dimalign_reader(ent
, data
, offset
):
1724 _bitpos
= header_read(ent
, data
, _bitpos
)
1725 _bitpos
, _x
= dwgutil
.get_bit_double(data
, _bitpos
)
1726 _bitpos
, _y
= dwgutil
.get_bit_double(data
, _bitpos
)
1727 _bitpos
, _z
= dwgutil
.get_bit_double(data
, _bitpos
)
1728 ent
.setEntityData('extrusion', (_x
, _y
, _z
))
1729 _bitpos
, _x
= dwgutil
.get_raw_double(data
, _bitpos
)
1730 _bitpos
, _y
= dwgutil
.get_raw_double(data
, _bitpos
)
1731 ent
.setEntityData('text_midpoint', (_x
, _y
))
1732 _bitpos
, _elev
= dwgutil
.get_bit_double(data
, _bitpos
)
1733 ent
.setEntityData('elevation', _elev
)
1734 _bitpos
, _flags
= dwgutil
.get_raw_char(data
, _bitpos
)
1735 ent
.setEntityData('flags', _flags
)
1736 _bitpos
, _text
= dwgutil
.get_text_string(data
, _bitpos
)
1737 ent
.setEntityData('text', _text
)
1738 _bitpos
, _rot
= dwgutil
.get_bit_double(data
, _bitpos
)
1739 ent
.setEntityData('rotation', _rot
)
1740 _bitpos
, _hdir
= dwgutil
.get_bit_double(data
, _bitpos
)
1741 ent
.setEntityData('horiz_dir', _hdir
)
1742 _bitpos
, _x
= dwgutil
.get_bit_double(data
, _bitpos
)
1743 _bitpos
, _y
= dwgutil
.get_bit_double(data
, _bitpos
)
1744 _bitpos
, _z
= dwgutil
.get_bit_double(data
, _bitpos
)
1745 ent
.setEntityData('ins_scale', (_x
, _y
, _z
))
1746 _bitpos
, _ir
= dwgutil
.get_bit_double(data
, _bitpos
)
1747 ent
.setEntityData('ins_rotation', _ir
)
1748 _bitpos
, _ap
= dwgutil
.get_bit_short(data
, _bitpos
)
1749 ent
.setEntityData('attachment_point', _ap
)
1750 _bitpos
, _lss
= dwgutil
.get_bit_short(data
, _bitpos
)
1751 ent
.setEntityData('linespace_style', _lss
)
1752 _bitpos
, _lsf
= dwgutil
.get_bit_double(data
, _bitpos
)
1753 ent
.setEntityData('linespace_factor', _lsf
)
1754 _bitpos
, _am
= dwgutil
.get_bit_double(data
, _bitpos
)
1755 ent
.setEntityData('actual_measurement', _am
)
1756 _bitpos
, _x
= dwgutil
.get_raw_double(data
, _bitpos
)
1757 _bitpos
, _y
= dwgutil
.get_raw_double(data
, _bitpos
)
1758 ent
.setEntityData('12-pt', (_x
, _y
))
1759 _bitpos
, _x
= dwgutil
.get_bit_double(data
, _bitpos
)
1760 _bitpos
, _y
= dwgutil
.get_bit_double(data
, _bitpos
)
1761 _bitpos
, _z
= dwgutil
.get_bit_double(data
, _bitpos
)
1762 ent
.setEntityData('10-pt', (_x
, _y
, _z
))
1763 _bitpos
, _x
= dwgutil
.get_bit_double(data
, _bitpos
)
1764 _bitpos
, _y
= dwgutil
.get_bit_double(data
, _bitpos
)
1765 _bitpos
, _z
= dwgutil
.get_bit_double(data
, _bitpos
)
1766 ent
.setEntityData('13-pt', (_x
, _y
, _z
))
1767 _bitpos
, _x
= dwgutil
.get_bit_double(data
, _bitpos
)
1768 _bitpos
, _y
= dwgutil
.get_bit_double(data
, _bitpos
)
1769 _bitpos
, _z
= dwgutil
.get_bit_double(data
, _bitpos
)
1770 ent
.setEntityData('14-pt', (_x
, _y
, _z
))
1771 _bitpos
, _elr
= dwgutil
.get_bit_double(data
, _bitpos
)
1772 ent
.setEntityData('ext_rotation', _elr
)
1773 _bitpos
= tail_read(ent
, data
, _bitpos
)
1774 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
1775 ent
.setEntityData('dimstyle_handle', _handle
)
1776 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
1777 ent
.setEntityData('anon_block_handle', _handle
)
1779 def dimang3p_reader(ent
, data
, offset
):
1781 _bitpos
= header_read(ent
, data
, _bitpos
)
1782 _bitpos
, _x
= dwgutil
.get_bit_double(data
, _bitpos
)
1783 _bitpos
, _y
= dwgutil
.get_bit_double(data
, _bitpos
)
1784 _bitpos
, _z
= dwgutil
.get_bit_double(data
, _bitpos
)
1785 ent
.setEntityData('extrusion', (_x
, _y
, _z
))
1786 _bitpos
, _x
= dwgutil
.get_raw_double(data
, _bitpos
)
1787 _bitpos
, _y
= dwgutil
.get_raw_double(data
, _bitpos
)
1788 ent
.setEntityData('text_midpoint', (_x
, _y
))
1789 _bitpos
, _elev
= dwgutil
.get_bit_double(data
, _bitpos
)
1790 ent
.setEntityData('elevation', _elev
)
1791 _bitpos
, _flags
= dwgutil
.get_raw_char(data
, _bitpos
)
1792 ent
.setEntityData('flags', _flags
)
1793 _bitpos
, _text
= dwgutil
.get_text_string(data
, _bitpos
)
1794 ent
.setEntityData('text', _text
)
1795 _bitpos
, _rot
= dwgutil
.get_bit_double(data
, _bitpos
)
1796 ent
.setEntityData('text_rotation', _rot
)
1797 _bitpos
, _hdir
= dwgutil
.get_bit_double(data
, _bitpos
)
1798 ent
.setEntityData('horiz_dir', _hdir
)
1799 _bitpos
, _x
= dwgutil
.get_bit_double(data
, _bitpos
)
1800 _bitpos
, _y
= dwgutil
.get_bit_double(data
, _bitpos
)
1801 _bitpos
, _z
= dwgutil
.get_bit_double(data
, _bitpos
)
1802 ent
.setEntityData('ins_scale', (_x
, _y
, _z
))
1803 _bitpos
, _ir
= dwgutil
.get_bit_double(data
, _bitpos
)
1804 ent
.setEntityData('ins_rotation', _ir
)
1805 _bitpos
, _ap
= dwgutil
.get_bit_short(data
, _bitpos
)
1806 ent
.setEntityData('attachment_point', _ap
)
1807 _bitpos
, _lss
= dwgutil
.get_bit_short(data
, _bitpos
)
1808 ent
.setEntityData('linespace_style', _lss
)
1809 _bitpos
, _lsf
= dwgutil
.get_bit_double(data
, _bitpos
)
1810 ent
.setEntityData('linespace_factor', _lsf
)
1811 _bitpos
, _am
= dwgutil
.get_bit_double(data
, _bitpos
)
1812 ent
.setEntityData('actual_measurement', _am
)
1813 _bitpos
, _x
= dwgutil
.get_raw_double(data
, _bitpos
)
1814 _bitpos
, _y
= dwgutil
.get_raw_double(data
, _bitpos
)
1815 ent
.setEntityData('12-pt', (_x
, _y
))
1816 _bitpos
, _x
= dwgutil
.get_bit_double(data
, _bitpos
)
1817 _bitpos
, _y
= dwgutil
.get_bit_double(data
, _bitpos
)
1818 _bitpos
, _z
= dwgutil
.get_bit_double(data
, _bitpos
)
1819 ent
.setEntityData('10-pt', (_x
, _y
, _z
))
1820 _bitpos
, _x
= dwgutil
.get_bit_double(data
, _bitpos
)
1821 _bitpos
, _y
= dwgutil
.get_bit_double(data
, _bitpos
)
1822 _bitpos
, _z
= dwgutil
.get_bit_double(data
, _bitpos
)
1823 ent
.setEntityData('13-pt', (_x
, _y
, _z
))
1824 _bitpos
, _x
= dwgutil
.get_bit_double(data
, _bitpos
)
1825 _bitpos
, _y
= dwgutil
.get_bit_double(data
, _bitpos
)
1826 _bitpos
, _z
= dwgutil
.get_bit_double(data
, _bitpos
)
1827 ent
.setEntityData('14-pt', (_x
, _y
, _z
))
1828 _bitpos
, _x
= dwgutil
.get_bit_double(data
, _bitpos
)
1829 _bitpos
, _y
= dwgutil
.get_bit_double(data
, _bitpos
)
1830 _bitpos
, _z
= dwgutil
.get_bit_double(data
, _bitpos
)
1831 ent
.setEntityData('15-pt', (_x
, _y
, _z
))
1832 _bitpos
= tail_read(ent
, data
, _bitpos
)
1833 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
1834 ent
.setEntityData('dimstyle_handle', _handle
)
1835 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
1836 ent
.setEntityData('anon_block_handle', _handle
)
1838 def dimang2l_reader(ent
, data
, offset
):
1840 _bitpos
= header_read(ent
, data
, _bitpos
)
1841 _bitpos
, _x
= dwgutil
.get_bit_double(data
, _bitpos
)
1842 _bitpos
, _y
= dwgutil
.get_bit_double(data
, _bitpos
)
1843 _bitpos
, _z
= dwgutil
.get_bit_double(data
, _bitpos
)
1844 ent
.setEntityData('extrusion', (_x
, _y
, _z
))
1845 _bitpos
, _x
= dwgutil
.get_raw_double(data
, _bitpos
)
1846 _bitpos
, _y
= dwgutil
.get_raw_double(data
, _bitpos
)
1847 ent
.setEntityData('text_midpoint', (_x
, _y
))
1848 _bitpos
, _elev
= dwgutil
.get_bit_double(data
, _bitpos
)
1849 ent
.setEntityData('elevation', _elev
)
1850 _bitpos
, _flags
= dwgutil
.get_raw_char(data
, _bitpos
)
1851 ent
.setEntityData('flags', _flags
)
1852 _bitpos
, _text
= dwgutil
.get_text_string(data
, _bitpos
)
1853 ent
.setEntityData('text', _text
)
1854 _bitpos
, _rot
= dwgutil
.get_bit_double(data
, _bitpos
)
1855 ent
.setEntityData('text_rotation', _rot
)
1856 _bitpos
, _hdir
= dwgutil
.get_bit_double(data
, _bitpos
)
1857 ent
.setEntityData('horiz_dir', _hdir
)
1858 _bitpos
, _x
= dwgutil
.get_bit_double(data
, _bitpos
)
1859 _bitpos
, _y
= dwgutil
.get_bit_double(data
, _bitpos
)
1860 _bitpos
, _z
= dwgutil
.get_bit_double(data
, _bitpos
)
1861 ent
.setEntityData('ins_scale', (_x
, _y
, _z
))
1862 _bitpos
, _ir
= dwgutil
.get_bit_double(data
, _bitpos
)
1863 ent
.setEntityData('ins_rotation', _ir
)
1864 _bitpos
, _ap
= dwgutil
.get_bit_short(data
, _bitpos
)
1865 ent
.setEntityData('attachment_point', _ap
)
1866 _bitpos
, _lss
= dwgutil
.get_bit_short(data
, _bitpos
)
1867 ent
.setEntityData('linespace_style', _lss
)
1868 _bitpos
, _lsf
= dwgutil
.get_bit_double(data
, _bitpos
)
1869 ent
.setEntityData('linespace_factor', _lsf
)
1870 _bitpos
, _am
= dwgutil
.get_bit_double(data
, _bitpos
)
1871 ent
.setEntityData('actual_measurement', _am
)
1872 _bitpos
, _x
= dwgutil
.get_raw_double(data
, _bitpos
)
1873 _bitpos
, _y
= dwgutil
.get_raw_double(data
, _bitpos
)
1874 ent
.setEntityData('12-pt', (_x
, _y
))
1875 _bitpos
, _x
= dwgutil
.get_raw_double(data
, _bitpos
)
1876 _bitpos
, _y
= dwgutil
.get_raw_double(data
, _bitpos
)
1877 ent
.setEntityData('16-pt', (_x
, _y
))
1878 _bitpos
, _x
= dwgutil
.get_bit_double(data
, _bitpos
)
1879 _bitpos
, _y
= dwgutil
.get_bit_double(data
, _bitpos
)
1880 _bitpos
, _z
= dwgutil
.get_bit_double(data
, _bitpos
)
1881 ent
.setEntityData('13-pt', (_x
, _y
, _z
))
1882 _bitpos
, _x
= dwgutil
.get_bit_double(data
, _bitpos
)
1883 _bitpos
, _y
= dwgutil
.get_bit_double(data
, _bitpos
)
1884 _bitpos
, _z
= dwgutil
.get_bit_double(data
, _bitpos
)
1885 ent
.setEntityData('14-pt', (_x
, _y
, _z
))
1886 _bitpos
, _x
= dwgutil
.get_bit_double(data
, _bitpos
)
1887 _bitpos
, _y
= dwgutil
.get_bit_double(data
, _bitpos
)
1888 _bitpos
, _z
= dwgutil
.get_bit_double(data
, _bitpos
)
1889 ent
.setEntityData('15-pt', (_x
, _y
, _z
))
1890 _bitpos
, _x
= dwgutil
.get_bit_double(data
, _bitpos
)
1891 _bitpos
, _y
= dwgutil
.get_bit_double(data
, _bitpos
)
1892 _bitpos
, _z
= dwgutil
.get_bit_double(data
, _bitpos
)
1893 ent
.setEntityData('10-pt', (_x
, _y
, _z
))
1894 _bitpos
= tail_read(ent
, data
, _bitpos
)
1895 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
1896 ent
.setEntityData('dimstyle_handle', _handle
)
1897 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
1898 ent
.setEntityData('anon_block_handle', _handle
)
1900 def dimrad_reader(ent
, data
, offset
):
1902 _bitpos
= header_read(ent
, data
, _bitpos
)
1903 _bitpos
, _x
= dwgutil
.get_bit_double(data
, _bitpos
)
1904 _bitpos
, _y
= dwgutil
.get_bit_double(data
, _bitpos
)
1905 _bitpos
, _z
= dwgutil
.get_bit_double(data
, _bitpos
)
1906 ent
.setEntityData('extrusion', (_x
, _y
, _z
))
1907 _bitpos
, _x
= dwgutil
.get_raw_double(data
, _bitpos
)
1908 _bitpos
, _y
= dwgutil
.get_raw_double(data
, _bitpos
)
1909 ent
.setEntityData('text_midpoint', (_x
, _y
))
1910 _bitpos
, _elev
= dwgutil
.get_bit_double(data
, _bitpos
)
1911 ent
.setEntityData('elevation', _elev
)
1912 _bitpos
, _flags
= dwgutil
.get_raw_char(data
, _bitpos
)
1913 ent
.setEntityData('flags', _flags
)
1914 _bitpos
, _text
= dwgutil
.get_text_string(data
, _bitpos
)
1915 ent
.setEntityData('text', _text
)
1916 _bitpos
, _rot
= dwgutil
.get_bit_double(data
, _bitpos
)
1917 ent
.setEntityData('text_rotation', _rot
)
1918 _bitpos
, _hdir
= dwgutil
.get_bit_double(data
, _bitpos
)
1919 ent
.setEntityData('horiz_ir', _hdir
)
1920 _bitpos
, _x
= dwgutil
.get_bit_double(data
, _bitpos
)
1921 _bitpos
, _y
= dwgutil
.get_bit_double(data
, _bitpos
)
1922 _bitpos
, _z
= dwgutil
.get_bit_double(data
, _bitpos
)
1923 ent
.setEntityData('ins_scale', (_x
, _y
, _z
))
1924 _bitpos
, _ir
= dwgutil
.get_bit_double(data
, _bitpos
)
1925 ent
.setEntityData('ins_rotation', _ir
)
1926 _bitpos
, _ap
= dwgutil
.get_bit_short(data
, _bitpos
)
1927 ent
.setEntityData('attachment_point', _ap
)
1928 _bitpos
, _lss
= dwgutil
.get_bit_short(data
, _bitpos
)
1929 ent
.setEntityData('linespace_style', _lss
)
1930 _bitpos
, _lsf
= dwgutil
.get_bit_double(data
, _bitpos
)
1931 ent
.setEntityData('linespace_factor', _lsf
)
1932 _bitpos
, _am
= dwgutil
.get_bit_double(data
, _bitpos
)
1933 ent
.setEntityData('actual_measurement', _am
)
1934 _bitpos
, _x
= dwgutil
.get_raw_double(data
, _bitpos
)
1935 _bitpos
, _y
= dwgutil
.get_raw_double(data
, _bitpos
)
1936 ent
.setEntityData('12-pt', (_x
, _y
))
1937 _bitpos
, _x
= dwgutil
.get_bit_double(data
, _bitpos
)
1938 _bitpos
, _y
= dwgutil
.get_bit_double(data
, _bitpos
)
1939 _bitpos
, _z
= dwgutil
.get_bit_double(data
, _bitpos
)
1940 ent
.setEntityData('10-pt', (_x
, _y
, _z
))
1941 _bitpos
, _x
= dwgutil
.get_bit_double(data
, _bitpos
)
1942 _bitpos
, _y
= dwgutil
.get_bit_double(data
, _bitpos
)
1943 _bitpos
, _z
= dwgutil
.get_bit_double(data
, _bitpos
)
1944 ent
.setEntityData('15-pt', (_x
, _y
, _z
))
1945 _bitpos
, _llen
= dwgutil
.get_bit_double(data
, _bitpos
)
1946 ent
.setEntityData('leader_length', _llen
)
1947 _bitpos
= tail_read(ent
, data
, _bitpos
)
1948 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
1949 ent
.setEntityData('dimstyle_handle', _handle
)
1950 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
1951 ent
.setEntityData('anon_block_handle', _handle
)
1953 def dimdia_reader(ent
, data
, offset
):
1955 _bitpos
= header_read(ent
, data
, _bitpos
)
1956 _bitpos
, _x
= dwgutil
.get_bit_double(data
, _bitpos
)
1957 _bitpos
, _y
= dwgutil
.get_bit_double(data
, _bitpos
)
1958 _bitpos
, _z
= dwgutil
.get_bit_double(data
, _bitpos
)
1959 ent
.setEntityData('extrusion', (_x
, _y
, _z
))
1960 _bitpos
, _x
= dwgutil
.get_raw_double(data
, _bitpos
)
1961 _bitpos
, _y
= dwgutil
.get_raw_double(data
, _bitpos
)
1962 ent
.setEntityData('text_midpoint', (_x
, _y
))
1963 _bitpos
, _elev
= dwgutil
.get_bit_double(data
, _bitpos
)
1964 ent
.setEntityData('elevation', _elev
)
1965 _bitpos
, _flags
= dwgutil
.get_raw_char(data
, _bitpos
)
1966 ent
.setEntityData('flags', _flags
)
1967 _bitpos
, _text
= dwgutil
.get_text_string(data
, _bitpos
)
1968 ent
.setEntityData('text', _text
)
1969 _bitpos
, _rot
= dwgutil
.get_bit_double(data
, _bitpos
)
1970 ent
.setEntityData('text_rotation', _rot
)
1971 _bitpos
, _hdir
= dwgutil
.get_bit_double(data
, _bitpos
)
1972 ent
.setEntityData('horiz_dir', _hdir
)
1973 _bitpos
, _x
= dwgutil
.get_bit_double(data
, _bitpos
)
1974 _bitpos
, _y
= dwgutil
.get_bit_double(data
, _bitpos
)
1975 _bitpos
, _z
= dwgutil
.get_bit_double(data
, _bitpos
)
1976 ent
.setEntityData('ins_scale', (_x
, _y
, _z
))
1977 _bitpos
, _ir
= dwgutil
.get_bit_double(data
, _bitpos
)
1978 ent
.setEntityData('ins_rotation', _ir
)
1979 _bitpos
, _ap
= dwgutil
.get_bit_short(data
, _bitpos
)
1980 ent
.setEntityData('attachment_point', _ap
)
1981 _bitpos
, _lss
= dwgutil
.get_bit_short(data
, _bitpos
)
1982 ent
.setEntityData('linespace_style', _lss
)
1983 _bitpos
, _lsf
= dwgutil
.get_bit_double(data
, _bitpos
)
1984 ent
.setEntityData('linespace_factor', _lsf
)
1985 _bitpos
, _am
= dwgutil
.get_bit_double(data
, _bitpos
)
1986 ent
.setEntityData('actual_measurement', _am
)
1987 _bitpos
, _x
= dwgutil
.get_raw_double(data
, _bitpos
)
1988 _bitpos
, _y
= dwgutil
.get_raw_double(data
, _bitpos
)
1989 ent
.setEntityData('12-pt', (_x
, _y
))
1990 _bitpos
, _x
= dwgutil
.get_bit_double(data
, _bitpos
)
1991 _bitpos
, _y
= dwgutil
.get_bit_double(data
, _bitpos
)
1992 _bitpos
, _z
= dwgutil
.get_bit_double(data
, _bitpos
)
1993 ent
.setEntityData('10-pt', (_x
, _y
, _z
))
1994 _bitpos
, _x
= dwgutil
.get_bit_double(data
, _bitpos
)
1995 _bitpos
, _y
= dwgutil
.get_bit_double(data
, _bitpos
)
1996 _bitpos
, _z
= dwgutil
.get_bit_double(data
, _bitpos
)
1997 ent
.setEntityData('15-pt', (_x
, _y
, _z
))
1998 _bitpos
, _llen
= dwgutil
.get_bit_double(data
, _bitpos
)
1999 ent
.setEntityData('leader_length', _llen
)
2000 _bitpos
= tail_read(ent
, data
, _bitpos
)
2001 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
2002 ent
.setEntityData('dimstyle_handle', _handle
)
2003 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
2004 ent
.setEntityData('anon_block_handle', _handle
)
2006 def point_reader(ent
, data
, offset
):
2008 _bitpos
= header_read(ent
, data
, _bitpos
)
2009 _bitpos
, _x
= dwgutil
.get_bit_double(data
, _bitpos
)
2010 _bitpos
, _y
= dwgutil
.get_bit_double(data
, _bitpos
)
2011 _bitpos
, _z
= dwgutil
.get_bit_double(data
, _bitpos
)
2012 ent
.setEntityData('point', (_x
, _y
, _z
))
2013 _bitpos
, _flag
= dwgutil
.test_bit(data
, _bitpos
)
2017 _bitpos
, _th
= dwgutil
.get_bit_double(data
, _bitpos
)
2018 ent
.setEntityData('thickness', _th
)
2019 _bitpos
, _flag
= dwgutil
.test_bit(data
, _bitpos
)
2024 _bitpos
, _x
= dwgutil
.get_bit_double(data
, _bitpos
)
2025 _bitpos
, _y
= dwgutil
.get_bit_double(data
, _bitpos
)
2026 _bitpos
, _z
= dwgutil
.get_bit_double(data
, _bitpos
)
2027 ent
.setEntityData('extrusion', (_x
, _y
, _z
))
2028 _bitpos
, _xa
= dwgutil
.get_bit_double(data
, _bitpos
)
2029 ent
.setEntityData('x_axis_angle', _xa
)
2030 _bitpos
= tail_read(ent
, data
, _bitpos
)
2032 def face3d_reader(ent
, data
, offset
):
2034 _bitpos
= header_read(ent
, data
, _bitpos
)
2035 _bitpos
, _nf
= dwgutil
.test_bit(data
, _bitpos
) # spec says RC, files say otherwise
2036 _bitpos
, _zflag
= dwgutil
.test_bit(data
, _bitpos
)
2037 _bitpos
, _cx
= dwgutil
.get_raw_double(data
, _bitpos
)
2039 _bitpos
, _cy
= dwgutil
.get_raw_double(data
, _bitpos
)
2043 _bitpos
, _cz
= dwgutil
.get_raw_double(data
, _bitpos
)
2045 _corner
= (_cx
, _cy
, _cz
)
2046 ent
.setEntityData('corner1', _corner
)
2047 _bitpos
, _cx
= dwgutil
.get_default_double(data
, _bitpos
, _dcx
)
2049 _bitpos
, _cy
= dwgutil
.get_default_double(data
, _bitpos
, _dcy
)
2051 _bitpos
, _cz
= dwgutil
.get_default_double(data
, _bitpos
, _dcz
)
2053 _corner
= (_cx
, _cy
, _cz
)
2054 ent
.setEntityData('corner2', _corner
)
2055 _bitpos
, _cx
= dwgutil
.get_default_double(data
, _bitpos
, _dcx
)
2057 _bitpos
, _cy
= dwgutil
.get_default_double(data
, _bitpos
, _dcy
)
2059 _bitpos
, _cz
= dwgutil
.get_default_double(data
, _bitpos
, _dcz
)
2061 _corner
= (_cx
, _cy
, _cz
)
2062 ent
.setEntityData('corner3', _corner
)
2063 _bitpos
, _cx
= dwgutil
.get_default_double(data
, _bitpos
, _dcx
)
2064 _bitpos
, _cy
= dwgutil
.get_default_double(data
, _bitpos
, _dcy
)
2065 _bitpos
, _cz
= dwgutil
.get_default_double(data
, _bitpos
, _dcz
)
2066 _corner
= (_cx
, _cy
, _cz
)
2067 ent
.setEntityData('corner4', _corner
)
2069 _bitpos
, _invis
= dwgutil
.get_bit_short(data
, _bitpos
)
2070 ent
.setEntityData('flags', _invis
)
2071 _bitpos
= tail_read(ent
, data
, _bitpos
)
2073 def pface_reader(ent
, data
, offset
):
2075 _bitpos
= header_read(ent
, data
, _bitpos
)
2076 _bitpos
, _nv
= dwgutil
.get_bit_short(data
, _bitpos
)
2077 ent
.setEntityData('vertex_count', _nv
)
2078 _bitpos
, _nf
= dwgutil
.get_bit_short(data
, _bitpos
)
2079 ent
.setEntityData('face_count', _nf
)
2080 _bitpos
= tail_read(ent
, data
, _bitpos
)
2081 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
2082 ent
.setEntityData('first_vertex_handle', _handle
)
2083 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
2084 ent
.setEntityData('last_vertex_handle', _handle
)
2085 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
2086 ent
.setEntityData('seqend_handle', _handle
)
2088 def mesh_reader(ent
, data
, offset
):
2090 _bitpos
= header_read(ent
, data
, _bitpos
)
2091 _bitpos
, _flags
= dwgutil
.get_bit_short(data
, _bitpos
)
2092 ent
.setEntityData('flags', _flags
)
2093 _bitpos
, _ctype
= dwgutil
.get_bit_short(data
, _bitpos
)
2094 ent
.setEntityData('curve_type', _ctype
)
2095 _bitpos
, _mvc
= dwgutil
.get_bit_short(data
, _bitpos
)
2096 ent
.setEntityData('m_vertices', _mvc
)
2097 _bitpos
, _nvc
= dwgutil
.get_bit_short(data
, _bitpos
)
2098 ent
.setEntityData('n_vertices', _nvc
)
2099 _bitpos
, _md
= dwgutil
.get_bit_short(data
, _bitpos
)
2100 ent
.setEntityData('m_density', _md
)
2101 _bitpos
, _nd
= dwgutil
.get_bit_short(data
, _bitpos
)
2102 ent
.setEntityData('n_density', _md
)
2103 _bitpos
= tail_read(ent
, data
, _bitpos
)
2104 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
2105 ent
.setEntityData('first_vertex_handle', _handle
)
2106 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
2107 ent
.setEntityData('last_vertex_handle', _handle
)
2108 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
2109 ent
.setEntityData('seqend_handle', _handle
)
2111 def solid_reader(ent
, data
, offset
):
2113 _bitpos
= header_read(ent
, data
, _bitpos
)
2114 _bitpos
, _flag
= dwgutil
.test_bit(data
, _bitpos
)
2118 _bitpos
, _th
= dwgutil
.get_bit_double(data
, _bitpos
)
2119 ent
.setEntityData('thickness', _th
)
2120 _bitpos
, _elev
= dwgutil
.get_bit_double(data
, _bitpos
)
2121 ent
.setEntityData('elevation', _elev
)
2122 _bitpos
, _x
= dwgutil
.get_raw_double(data
, _bitpos
)
2123 _bitpos
, _y
= dwgutil
.get_raw_double(data
, _bitpos
)
2124 ent
.setEntityData('corner1', (_x
, _y
, _elev
))
2125 _bitpos
, _x
= dwgutil
.get_raw_double(data
, _bitpos
)
2126 _bitpos
, _y
= dwgutil
.get_raw_double(data
, _bitpos
)
2127 ent
.setEntityData('corner2', (_x
, _y
, _elev
))
2128 _bitpos
, _x
= dwgutil
.get_raw_double(data
, _bitpos
)
2129 _bitpos
, _y
= dwgutil
.get_raw_double(data
, _bitpos
)
2130 ent
.setEntityData('corner3', (_x
, _y
, _elev
))
2131 _bitpos
, _x
= dwgutil
.get_raw_double(data
, _bitpos
)
2132 _bitpos
, _y
= dwgutil
.get_raw_double(data
, _bitpos
)
2133 ent
.setEntityData('corner4', (_x
, _y
, _elev
))
2134 _bitpos
, _flag
= dwgutil
.test_bit(data
, _bitpos
)
2139 _bitpos
, _x
= dwgutil
.get_bit_double(data
, _bitpos
)
2140 _bitpos
, _y
= dwgutil
.get_bit_double(data
, _bitpos
)
2141 _bitpos
, _z
= dwgutil
.get_bit_double(data
, _bitpos
)
2142 ent
.setEntityData('extrusion', (_x
, _y
, _z
))
2143 _bitpos
= tail_read(ent
, data
, _bitpos
)
2145 def trace_reader(ent
, data
, offset
):
2147 _bitpos
= header_read(ent
, data
, _bitpos
)
2148 _bitpos
, _flag
= dwgutil
.test_bit(data
, _bitpos
)
2152 _bitpos
, _th
= dwgutil
.get_bit_double(data
, _bitpos
)
2153 ent
.setEntityData('thickness', _th
)
2154 _bitpos
, _elev
= dwgutil
.get_bit_double(data
, _bitpos
)
2155 ent
.setEntityData('elevation', _elev
)
2156 _bitpos
, _x
= dwgutil
.get_raw_double(data
, _bitpos
)
2157 _bitpos
, _y
= dwgutil
.get_raw_double(data
, _bitpos
)
2158 ent
.setEntityData('corner1', (_x
, _y
, _elev
))
2159 _bitpos
, _x
= dwgutil
.get_raw_double(data
, _bitpos
)
2160 _bitpos
, _y
= dwgutil
.get_raw_double(data
, _bitpos
)
2161 ent
.setEntityData('corner2', (_x
, _y
, _elev
))
2162 _bitpos
, _x
= dwgutil
.get_raw_double(data
, _bitpos
)
2163 _bitpos
, _y
= dwgutil
.get_raw_double(data
, _bitpos
)
2164 ent
.setEntityData('corner3', (_x
, _y
, _elev
))
2165 _bitpos
, _x
= dwgutil
.get_raw_double(data
, _bitpos
)
2166 _bitpos
, _y
= dwgutil
.get_raw_double(data
, _bitpos
)
2167 ent
.setEntityData('corner4', (_x
, _y
, _elev
))
2168 _bitpos
, _flag
= dwgutil
.test_bit(data
, _bitpos
)
2173 _bitpos
, _x
= dwgutil
.get_bit_double(data
, _bitpos
)
2174 _bitpos
, _y
= dwgutil
.get_bit_double(data
, _bitpos
)
2175 _bitpos
, _z
= dwgutil
.get_bit_double(data
, _bitpos
)
2176 ent
.setEntityData('extrusion', (_x
, _y
, _z
))
2177 _bitpos
= tail_read(ent
, data
, _bitpos
)
2179 def shape_reader(ent
, data
, offset
):
2181 _bitpos
= header_read(ent
, data
, _bitpos
)
2182 _bitpos
, _x
= dwgutil
.get_bit_double(data
, _bitpos
)
2183 _bitpos
, _y
= dwgutil
.get_bit_double(data
, _bitpos
)
2184 _bitpos
, _z
= dwgutil
.get_bit_double(data
, _bitpos
)
2185 ent
.setEntityData('insertion_point', (_x
, _y
, _z
))
2186 _bitpos
, _scale
= dwgutil
.get_bit_double(data
, _bitpos
)
2187 ent
.setEntityData('scale', _scale
)
2188 _bitpos
, _rot
= dwgutil
.get_bit_double(data
, _bitpos
)
2189 ent
.setEntityData('rotation', _rot
)
2190 _bitpos
, _width
= dwgutil
.get_bit_double(data
, _bitpos
)
2191 ent
.setEntityData('width', _width
)
2192 _bitpos
, _ob
= dwgutil
.get_bit_double(data
, _bitpos
)
2193 ent
.setEntityData('oblique', _ob
)
2194 _bitpos
, _th
= dwgutil
.get_bit_double(data
, _bitpos
)
2195 ent
.setEntityData('thickness', _th
)
2196 _bitpos
, _snum
= dwgutil
.get_bit_short(data
, _bitpos
)
2197 ent
.setEntityData('shape_number', _snum
)
2198 _bitpos
, _x
= dwgutil
.get_bit_double(data
, _bitpos
)
2199 _bitpos
, _y
= dwgutil
.get_bit_double(data
, _bitpos
)
2200 _bitpos
, _z
= dwgutil
.get_bit_double(data
, _bitpos
)
2201 ent
.setEntityData('extrusion', (_x
, _y
, _z
))
2202 _bitpos
= tail_read(ent
, data
, _bitpos
)
2203 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
2204 ent
.setEntityData('shapefile_handle', _handle
)
2206 def viewport_reader(ent
, data
, offset
):
2208 _bitpos
= header_read(ent
, data
, _bitpos
)
2209 _bitpos
, _x
= dwgutil
.get_bit_double(data
, _bitpos
)
2210 _bitpos
, _y
= dwgutil
.get_bit_double(data
, _bitpos
)
2211 _bitpos
, _z
= dwgutil
.get_bit_double(data
, _bitpos
)
2212 ent
.setEntityData('center', (_x
, _y
, _z
))
2213 _bitpos
, _val
= dwgutil
.get_bit_double(data
, _bitpos
)
2214 ent
.setEntityData('width', _val
)
2215 _bitpos
, _val
= dwgutil
.get_bit_double(data
, _bitpos
)
2216 ent
.setEntityData('height', _val
)
2217 _bitpos
, _x
= dwgutil
.get_bit_double(data
, _bitpos
)
2218 _bitpos
, _y
= dwgutil
.get_bit_double(data
, _bitpos
)
2219 _bitpos
, _z
= dwgutil
.get_bit_double(data
, _bitpos
)
2220 ent
.setEntityData('view_target', (_x
, _y
, _z
))
2221 _bitpos
, _x
= dwgutil
.get_bit_double(data
, _bitpos
)
2222 _bitpos
, _y
= dwgutil
.get_bit_double(data
, _bitpos
)
2223 _bitpos
, _z
= dwgutil
.get_bit_double(data
, _bitpos
)
2224 ent
.setEntityData('view_direction', (_x
, _y
, _z
))
2225 _bitpos
, _val
= dwgutil
.get_bit_double(data
, _bitpos
)
2226 ent
.setEntityData('view_twist_angle', _val
)
2227 _bitpos
, _val
= dwgutil
.get_bit_double(data
, _bitpos
)
2228 ent
.setEntityData('view_height', _val
)
2229 _bitpos
, _val
= dwgutil
.get_bit_double(data
, _bitpos
)
2230 ent
.setEntityData('lens_length', _val
)
2231 _bitpos
, _val
= dwgutil
.get_bit_double(data
, _bitpos
)
2232 ent
.setEntityData('front_clip_z', _val
)
2233 _bitpos
, _val
= dwgutil
.get_bit_double(data
, _bitpos
)
2234 ent
.setEntityData('back_clip_z', _val
)
2235 _bitpos
, _val
= dwgutil
.get_bit_double(data
, _bitpos
)
2236 ent
.setEntityData('snap_angle', _val
)
2237 _bitpos
, _x
= dwgutil
.get_raw_double(data
, _bitpos
)
2238 _bitpos
, _y
= dwgutil
.get_raw_double(data
, _bitpos
)
2239 ent
.setEntityData('view_center', (_x
, _y
))
2240 _bitpos
, _x
= dwgutil
.get_raw_double(data
, _bitpos
)
2241 _bitpos
, _y
= dwgutil
.get_raw_double(data
, _bitpos
)
2242 ent
.setEntityData('snap_base', (_x
, _y
))
2243 _bitpos
, _x
= dwgutil
.get_raw_double(data
, _bitpos
)
2244 _bitpos
, _y
= dwgutil
.get_raw_double(data
, _bitpos
)
2245 ent
.setEntityData('snap_spacing', (_x
, _y
))
2246 _bitpos
, _x
= dwgutil
.get_raw_double(data
, _bitpos
)
2247 _bitpos
, _y
= dwgutil
.get_raw_double(data
, _bitpos
)
2248 ent
.setEntityData('grid_spacing', (_x
, _y
))
2249 _bitpos
, _val
= dwgutil
.get_bit_short(data
, _bitpos
)
2250 ent
.setEntityData('circle_zoom', _val
)
2251 _bitpos
, _flc
= dwgutil
.get_bit_long(data
, _bitpos
)
2252 _bitpos
, _flags
= dwgutil
.get_bit_long(data
, _bitpos
)
2253 ent
.setEntityData('status_flags', _flags
)
2254 _bitpos
, _text
= dwgutil
.get_text_string(data
, _bitpos
)
2255 ent
.setEntityData('stylesheet', _text
)
2256 _bitpos
, _val
= dwgutil
.get_raw_char(data
, _bitpos
)
2257 ent
.setEntityData('render_mode', _val
)
2258 _bitpos
, _val
= dwgutil
.test_bit(data
, _bitpos
)
2259 ent
.setEntityData('ucs_at_origin', _val
)
2260 _bitpos
, _val
= dwgutil
.test_bit(data
, _bitpos
)
2261 ent
.setEntityData('ucs_per_viewport', _val
)
2262 _bitpos
, _x
= dwgutil
.get_bit_double(data
, _bitpos
)
2263 _bitpos
, _y
= dwgutil
.get_bit_double(data
, _bitpos
)
2264 _bitpos
, _z
= dwgutil
.get_bit_double(data
, _bitpos
)
2265 ent
.setEntityData('ucs_origin', (_x
, _y
, _z
))
2266 _bitpos
, _x
= dwgutil
.get_bit_double(data
, _bitpos
)
2267 _bitpos
, _y
= dwgutil
.get_bit_double(data
, _bitpos
)
2268 _bitpos
, _z
= dwgutil
.get_bit_double(data
, _bitpos
)
2269 ent
.setEntityData('ucs_x_axis', (_x
, _y
, _z
))
2270 _bitpos
, _x
= dwgutil
.get_bit_double(data
, _bitpos
)
2271 _bitpos
, _y
= dwgutil
.get_bit_double(data
, _bitpos
)
2272 _bitpos
, _z
= dwgutil
.get_bit_double(data
, _bitpos
)
2273 ent
.setEntityData('ucs_y_axis', (_x
, _y
, _z
))
2274 _bitpos
, _val
= dwgutil
.get_bit_double(data
, _bitpos
)
2275 ent
.setEntityData('elevation', _val
)
2276 _bitpos
, _val
= dwgutil
.get_bit_short(data
, _bitpos
)
2277 ent
.setEntityData('ucs_ortho_view', _val
)
2278 _bitpos
= tail_read(ent
, data
, _bitpos
)
2281 for _i
in range(_flc
):
2282 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
2283 _handles
.append(_handles
)
2284 ent
.setEntityData('frozen_layer_handles', _handles
)
2285 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
2286 ent
.setEntityData('clip_boundary_handle', _handle
)
2287 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
2288 ent
.setEntityData('viewport_ent_handle', _handle
)
2289 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
2290 ent
.setEntityData('named_ucs_handle', _handle
)
2291 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
2292 ent
.setEntityData('base_ucs_handle', _handle
)
2294 def ellipse_reader(ent
, data
, offset
):
2296 _bitpos
= header_read(ent
, data
, _bitpos
)
2297 _bitpos
, _x
= dwgutil
.get_bit_double(data
, _bitpos
)
2298 _bitpos
, _y
= dwgutil
.get_bit_double(data
, _bitpos
)
2299 _bitpos
, _z
= dwgutil
.get_bit_double(data
, _bitpos
)
2300 ent
.setEntityData('center', (_x
, _y
, _z
))
2301 _bitpos
, _x
= dwgutil
.get_bit_double(data
, _bitpos
)
2302 _bitpos
, _y
= dwgutil
.get_bit_double(data
, _bitpos
)
2303 _bitpos
, _z
= dwgutil
.get_bit_double(data
, _bitpos
)
2304 ent
.setEntityData('major_axis_vector', (_x
, _y
, _z
))
2305 _bitpos
, _x
= dwgutil
.get_bit_double(data
, _bitpos
)
2306 _bitpos
, _y
= dwgutil
.get_bit_double(data
, _bitpos
)
2307 _bitpos
, _z
= dwgutil
.get_bit_double(data
, _bitpos
)
2308 ent
.setEntityData('extrusion', (_x
, _y
, _z
))
2309 _bitpos
, _val
= dwgutil
.get_bit_double(data
, _bitpos
)
2310 ent
.setEntityData('axis_ratio', _val
)
2311 _bitpos
, _val
= dwgutil
.get_bit_double(data
, _bitpos
)
2312 ent
.setEntityData('start_angle', _val
)
2313 _bitpos
, _val
= dwgutil
.get_bit_double(data
, _bitpos
)
2314 ent
.setEntityData('end_angle', _val
)
2315 _bitpos
= tail_read(ent
, data
, _bitpos
)
2317 def spline_reader(ent
, data
, offset
):
2319 _bitpos
= header_read(ent
, data
, _bitpos
)
2320 _bitpos
, _sc
= dwgutil
.get_bit_short(data
, _bitpos
)
2321 _bitpos
, _deg
= dwgutil
.get_bit_short(data
, _bitpos
)
2322 ent
.setEntityData('degree', _deg
)
2323 _nknots
= _nctlpts
= _nfitpts
= 0
2326 _bitpos
, _ft
= dwgutil
.get_bit_double(data
, _bitpos
)
2327 ent
.setEntityData('fit_tolerance', _ft
)
2328 _bitpos
, _x
= dwgutil
.get_bit_double(data
, _bitpos
)
2329 _bitpos
, _y
= dwgutil
.get_bit_double(data
, _bitpos
)
2330 _bitpos
, _z
= dwgutil
.get_bit_double(data
, _bitpos
)
2331 ent
.setEntityData('begin_tan_vector', (_x
, _y
, _z
))
2332 _bitpos
, _x
= dwgutil
.get_bit_double(data
, _bitpos
)
2333 _bitpos
, _y
= dwgutil
.get_bit_double(data
, _bitpos
)
2334 _bitpos
, _z
= dwgutil
.get_bit_double(data
, _bitpos
)
2335 ent
.setEntityData('end_tan_vector', (_x
, _y
, _z
))
2336 _bitpos
, _nfitpts
= dwgutil
.get_bit_short(data
, _bitpos
)
2338 _bitpos
, _rat
= dwgutil
.test_bit(data
, _bitpos
)
2339 ent
.setEntityData('rational', _rat
)
2340 _bitpos
, _closed
= dwgutil
.test_bit(data
, _bitpos
)
2341 ent
.setEntityData('closed', _closed
)
2342 _bitpos
, _per
= dwgutil
.test_bit(data
, _bitpos
)
2343 ent
.setEntityData('periodic', _per
)
2344 _bitpos
, _ktol
= dwgutil
.get_bit_double(data
, _bitpos
)
2345 ent
.setEntityData('knot_tolerance', _ktol
)
2346 _bitpos
, _ctol
= dwgutil
.get_bit_double(data
, _bitpos
)
2347 ent
.setEntityData('control_tolerance', _ctol
)
2348 _bitpos
, _nknots
= dwgutil
.get_bit_long(data
, _bitpos
)
2349 _bitpos
, _nctlpts
= dwgutil
.get_bit_long(data
, _bitpos
)
2350 _bitpos
, _weight
= dwgutil
.test_bit(data
, _bitpos
)
2352 raise ValueError, "Unexpected scenario: %d" % _sc
2355 for _i
in range(_nknots
):
2356 _bitpos
, _knot
= dwgutil
.get_bit_double(data
, _bitpos
)
2357 _knotpts
.append(_knot
)
2358 ent
.setEntityData('knot_points', _knotpts
)
2362 for _i
in range(_nctlpts
):
2363 _bitpos
, _x
= dwgutil
.get_bit_double(data
, _bitpos
)
2364 _bitpos
, _y
= dwgutil
.get_bit_double(data
, _bitpos
)
2365 _bitpos
, _z
= dwgutil
.get_bit_double(data
, _bitpos
)
2366 _ctrlpts
.append((_x
, _y
, _z
))
2368 _bitpos
, _w
= dwgutil
.get_bit_double(data
, _bitpos
)
2370 ent
.setEntityData('control_points', _ctrlpts
)
2372 ent
.setEntityData('weights', _weights
)
2375 for _i
in range(_nfitpts
):
2376 _bitpos
, _x
= dwgutil
.get_bit_double(data
, _bitpos
)
2377 _bitpos
, _y
= dwgutil
.get_bit_double(data
, _bitpos
)
2378 _bitpos
, _z
= dwgutil
.get_bit_double(data
, _bitpos
)
2379 _fitpts
.append((_x
, _y
, _z
))
2380 ent
.setEntityData('fit_points', _fitpts
)
2381 _bitpos
= tail_read(ent
, data
, _bitpos
)
2383 def rsb_reader(ent
, data
, offset
):
2385 _bitpos
= header_read(ent
, data
, _bitpos
)
2386 _bitpos
, _itype
= dwgutil
.get_bit_short(data
, _bitpos
)
2388 _bitpos
, _val
= dwgutil
.get_bit_double(data
, _bitpos
)
2389 # print "unknown double: %g" % _val
2390 _bitpos
, _cib
= dwgutil
.get_bit_long(data
, _bitpos
)
2394 for _i
in range(_cib
):
2395 _bitpos
, _ch
= dwgutil
.get_raw_char(data
, _bitpos
)
2396 if (0x20 < _ch
< 0x7e):
2398 elif (_ch
== ord("\t")):
2403 _data
.append("".join(_chars
))
2404 _bitpos
, _cib
= dwgutil
.get_bit_long(data
, _bitpos
)
2406 raise ValueError, "Unexpected itemtype: %d" % _itype
2408 # OpenDWG specs say there is stuff here but they haven't
2409 # figured it out, plus there is the tailing handles
2410 # skip this for now ...
2411 # _bitpos = tail_read(ent, data, _bitpos)
2413 def ray_reader(ent
, data
, offset
):
2415 _bitpos
= header_read(ent
, data
, _bitpos
)
2416 _bitpos
, _x
= dwgutil
.get_bit_double(data
, _bitpos
)
2417 _bitpos
, _y
= dwgutil
.get_bit_double(data
, _bitpos
)
2418 _bitpos
, _z
= dwgutil
.get_bit_double(data
, _bitpos
)
2419 ent
.setEntityData('point', (_x
, _y
, _z
))
2420 _bitpos
, _x
= dwgutil
.get_bit_double(data
, _bitpos
)
2421 _bitpos
, _y
= dwgutil
.get_bit_double(data
, _bitpos
)
2422 _bitpos
, _z
= dwgutil
.get_bit_double(data
, _bitpos
)
2423 ent
.setEntityData('vector', (_x
, _y
, _z
))
2424 _bitpos
= tail_read(ent
, data
, _bitpos
)
2426 def xline_reader(ent
, data
, offset
):
2428 _bitpos
= header_read(ent
, data
, _bitpos
)
2429 _bitpos
, _x
= dwgutil
.get_bit_double(data
, _bitpos
)
2430 _bitpos
, _y
= dwgutil
.get_bit_double(data
, _bitpos
)
2431 _bitpos
, _z
= dwgutil
.get_bit_double(data
, _bitpos
)
2432 ent
.setEntityData('point', (_x
, _y
, _z
))
2433 _bitpos
, _x
= dwgutil
.get_bit_double(data
, _bitpos
)
2434 _bitpos
, _y
= dwgutil
.get_bit_double(data
, _bitpos
)
2435 _bitpos
, _z
= dwgutil
.get_bit_double(data
, _bitpos
)
2436 ent
.setEntityData('vector', (_x
, _y
, _z
))
2437 _bitpos
= tail_read(ent
, data
, _bitpos
)
2439 def dict_reader(ent
, data
, offset
):
2441 _bitpos
, _nr
= dwgutil
.get_bit_short(data
, _bitpos
)
2442 _bitpos
, _ni
= dwgutil
.get_bit_long(data
, _bitpos
)
2443 _bitpos
, _cflag
= dwgutil
.get_bit_short(data
, _bitpos
)
2444 ent
.setEntityData('cloning_flag', _cflag
)
2445 _bitpos
, _hoflag
= dwgutil
.get_raw_char(data
, _bitpos
)
2446 ent
.setEntityData('hard_owner_flag', _hoflag
) # ???
2449 for _i
in range(_ni
):
2450 _bitpos
, _text
= dwgutil
.get_text_string(data
, _bitpos
)
2451 _strings
.append(_text
)
2452 ent
.setEntityData('strings', _strings
)
2453 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
2454 ent
.setEntityData('parent_handle', _handle
)
2455 for _i
in range(_nr
):
2456 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
2457 ent
.addReactor(_handle
)
2458 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
2459 ent
.setXdicobj(_handle
)
2462 for _i
in range(_ni
):
2463 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
2464 _items
.append(_handle
)
2465 ent
.setEntityData('items', _items
)
2467 def mtext_reader(ent
, data
, offset
):
2469 _bitpos
= header_read(ent
, data
, _bitpos
)
2470 _bitpos
, _x
= dwgutil
.get_bit_double(data
, _bitpos
)
2471 _bitpos
, _y
= dwgutil
.get_bit_double(data
, _bitpos
)
2472 _bitpos
, _z
= dwgutil
.get_bit_double(data
, _bitpos
)
2473 ent
.setEntityData('insertion_point', (_x
, _y
, _z
))
2474 _bitpos
, _x
= dwgutil
.get_bit_double(data
, _bitpos
)
2475 _bitpos
, _y
= dwgutil
.get_bit_double(data
, _bitpos
)
2476 _bitpos
, _z
= dwgutil
.get_bit_double(data
, _bitpos
)
2477 ent
.setEntityData('extrusion', (_x
, _y
, _z
))
2478 _bitpos
, _x
= dwgutil
.get_bit_double(data
, _bitpos
)
2479 _bitpos
, _y
= dwgutil
.get_bit_double(data
, _bitpos
)
2480 _bitpos
, _z
= dwgutil
.get_bit_double(data
, _bitpos
)
2481 ent
.setEntityData('x_axis_direction', (_x
, _y
, _z
))
2482 _bitpos
, _width
= dwgutil
.get_bit_double(data
, _bitpos
)
2483 ent
.setEntityData('width', _width
)
2484 _bitpos
, _height
= dwgutil
.get_bit_double(data
, _bitpos
)
2485 ent
.setEntityData('height', _height
)
2486 _bitpos
, _att
= dwgutil
.get_bit_short(data
, _bitpos
)
2487 ent
.setEntityData('attachment', _att
)
2488 _bitpos
, _dd
= dwgutil
.get_bit_short(data
, _bitpos
)
2489 ent
.setEntityData('drawing_dir', _dd
) # ???
2490 _bitpos
, _exh
= dwgutil
.get_bit_double(data
, _bitpos
)
2491 ent
.setEntityData('ext_height', _exh
)
2492 _bitpos
, _exw
= dwgutil
.get_bit_double(data
, _bitpos
)
2493 ent
.setEntityData('ext_width', _exw
)
2494 _bitpos
, _text
= dwgutil
.get_text_string(data
, _bitpos
)
2495 ent
.setEntityData('text', _text
)
2496 _bitpos
, _lss
= dwgutil
.get_bit_short(data
, _bitpos
)
2497 ent
.setEntityData('line_spacing_style', _lss
)
2498 _bitpos
, _lsf
= dwgutil
.get_bit_double(data
, _bitpos
)
2499 ent
.setEntityData('line_spacing_factor:', _lsf
)
2500 _bitpos
, _val
= dwgutil
.test_bit(data
, _bitpos
)
2501 # print "unknown bit: " + str(_val)
2502 _bitpos
= tail_read(ent
, data
, _bitpos
)
2503 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
2504 ent
.setEntityData('style_handle', _handle
)
2506 def leader_reader(ent
, data
, offset
):
2508 _bitpos
= header_read(ent
, data
, _bitpos
)
2509 _bitpos
, _u
= dwgutil
.test_bit(data
, _bitpos
)
2510 # print "unknown bit: " + str(_u)
2511 _bitpos
, _at
= dwgutil
.get_bit_short(data
, _bitpos
)
2512 ent
.setEntityData('annotation_type', _at
)
2513 _bitpos
, _pt
= dwgutil
.get_bit_short(data
, _bitpos
)
2514 ent
.setEntityData('path_type', _pt
)
2515 _bitpos
, _npts
= dwgutil
.get_bit_short(data
, _bitpos
)
2517 for _i
in range(_npts
):
2518 _bitpos
, _x
= dwgutil
.get_bit_double(data
, _bitpos
)
2519 _bitpos
, _y
= dwgutil
.get_bit_double(data
, _bitpos
)
2520 _bitpos
, _z
= dwgutil
.get_bit_double(data
, _bitpos
)
2521 _points
.append((_x
, _y
, _z
))
2522 ent
.setEntityData('points', _points
)
2523 _bitpos
, _x
= dwgutil
.get_bit_double(data
, _bitpos
)
2524 _bitpos
, _y
= dwgutil
.get_bit_double(data
, _bitpos
)
2525 _bitpos
, _z
= dwgutil
.get_bit_double(data
, _bitpos
)
2526 ent
.setEntityData('end_pt_proj', (_x
, _y
, _z
))
2527 _bitpos
, _x
= dwgutil
.get_bit_double(data
, _bitpos
)
2528 _bitpos
, _y
= dwgutil
.get_bit_double(data
, _bitpos
)
2529 _bitpos
, _z
= dwgutil
.get_bit_double(data
, _bitpos
)
2530 ent
.setEntityData('extrusion', (_x
, _y
, _z
))
2531 _bitpos
, _x
= dwgutil
.get_bit_double(data
, _bitpos
)
2532 _bitpos
, _y
= dwgutil
.get_bit_double(data
, _bitpos
)
2533 _bitpos
, _z
= dwgutil
.get_bit_double(data
, _bitpos
)
2534 ent
.setEntityData('x_direction', (_x
, _y
, _z
))
2535 _bitpos
, _x
= dwgutil
.get_bit_double(data
, _bitpos
)
2536 _bitpos
, _y
= dwgutil
.get_bit_double(data
, _bitpos
)
2537 _bitpos
, _z
= dwgutil
.get_bit_double(data
, _bitpos
)
2538 ent
.setEntityData('offset_block_ins_pt', (_x
, _y
, _z
))
2539 _bitpos
, _x
= dwgutil
.get_bit_double(data
, _bitpos
)
2540 _bitpos
, _y
= dwgutil
.get_bit_double(data
, _bitpos
)
2541 _bitpos
, _z
= dwgutil
.get_bit_double(data
, _bitpos
)
2542 # print "unknown: (%g,%g,%g)" % (_x, _y, _z)
2543 _bitpos
, _bh
= dwgutil
.get_bit_double(data
, _bitpos
)
2544 ent
.setEntityData('box_height', _bh
)
2545 _bitpos
, _bw
= dwgutil
.get_bit_double(data
, _bitpos
)
2546 ent
.setEntityData('box_width', _bw
)
2547 _bitpos
, _hook
= dwgutil
.test_bit(data
, _bitpos
)
2548 ent
.setEntityData('hooklineoxdir', _hook
) # ???
2549 _bitpos
, _arrowon
= dwgutil
.test_bit(data
, _bitpos
)
2550 ent
.setEntityData('arrowhead_on', _arrowon
)
2551 _bitpos
, _us
= dwgutil
.get_bit_short(data
, _bitpos
)
2552 # print "unknown short: %d" % _us
2553 _bitpos
, _ub
= dwgutil
.test_bit(data
, _bitpos
)
2554 # print "unknown bit: " + str(_ub)
2555 _bitpos
, _ub
= dwgutil
.test_bit(data
, _bitpos
)
2556 # print "unknown bit: " + str(_ub)
2557 _bitpos
= tail_read(ent
, data
, _bitpos
)
2558 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
2559 ent
.setEntityData('associated_annotation_handle', _handle
)
2560 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
2561 ent
.setEntityData('dimstyle_handle', _handle
)
2563 def tolerance_reader(ent
, data
, offset
):
2565 _bitpos
= header_read(ent
, data
, _bitpos
)
2566 _bitpos
, _x
= dwgutil
.get_bit_double(data
, _bitpos
)
2567 _bitpos
, _y
= dwgutil
.get_bit_double(data
, _bitpos
)
2568 _bitpos
, _z
= dwgutil
.get_bit_double(data
, _bitpos
)
2569 ent
.setEntityData('insertion_point', (_x
, _y
, _z
))
2570 _bitpos
, _x
= dwgutil
.get_bit_double(data
, _bitpos
)
2571 _bitpos
, _y
= dwgutil
.get_bit_double(data
, _bitpos
)
2572 _bitpos
, _z
= dwgutil
.get_bit_double(data
, _bitpos
)
2573 ent
.setEntityData('x_direction', (_x
, _y
, _z
))
2574 _bitpos
, _x
= dwgutil
.get_bit_double(data
, _bitpos
)
2575 _bitpos
, _y
= dwgutil
.get_bit_double(data
, _bitpos
)
2576 _bitpos
, _z
= dwgutil
.get_bit_double(data
, _bitpos
)
2577 ent
.setEntityData('extrusion', (_x
, _y
, _z
))
2578 _bitpos
, _ts
= dwgutil
.get_bit_short(data
, _bitpos
) # should this be text_string?
2579 ent
.setEntityData('string', _ts
)
2580 _bitpos
= tail_read(ent
, data
, _bitpos
)
2581 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
2582 ent
.setEntityData('dimstyle_handle', _handle
)
2584 def mline_reader(ent
, data
, offset
):
2586 _bitpos
= header_read(ent
, data
, _bitpos
)
2587 _bitpos
, _scale
= dwgutil
.get_bit_double(data
, _bitpos
)
2588 ent
.setEntityData('scale', _scale
)
2589 _bitpos
, _just
= dwgutil
.get_raw_char(data
, _bitpos
)
2590 ent
.setEntityData('justification', _just
)
2591 _bitpos
, _x
= dwgutil
.get_bit_double(data
, _bitpos
)
2592 _bitpos
, _y
= dwgutil
.get_bit_double(data
, _bitpos
)
2593 _bitpos
, _z
= dwgutil
.get_bit_double(data
, _bitpos
)
2594 ent
.setEntityData('base_point', (_x
, _y
, _z
))
2595 _bitpos
, _x
= dwgutil
.get_bit_double(data
, _bitpos
)
2596 _bitpos
, _y
= dwgutil
.get_bit_double(data
, _bitpos
)
2597 _bitpos
, _z
= dwgutil
.get_bit_double(data
, _bitpos
)
2598 ent
.setEntityData('extrusion', (_x
, _y
, _z
))
2599 _bitpos
, _oc
= dwgutil
.get_bit_short(data
, _bitpos
)
2600 ent
.setEntityData('open_closed', _oc
)
2601 _bitpos
, _lis
= dwgutil
.get_raw_char(data
, _bitpos
)
2602 _bitpos
, _nv
= dwgutil
.get_bit_short(data
, _bitpos
)
2604 for _i
in range(_nv
):
2605 _bitpos
, _x
= dwgutil
.get_bit_double(data
, _bitpos
)
2606 _bitpos
, _y
= dwgutil
.get_bit_double(data
, _bitpos
)
2607 _bitpos
, _z
= dwgutil
.get_bit_double(data
, _bitpos
)
2608 _vertex
= (_x
, _y
, _z
)
2609 _bitpos
, _x
= dwgutil
.get_bit_double(data
, _bitpos
)
2610 _bitpos
, _y
= dwgutil
.get_bit_double(data
, _bitpos
)
2611 _bitpos
, _z
= dwgutil
.get_bit_double(data
, _bitpos
)
2612 _vertex_dir
= (_x
, _y
, _z
)
2613 _bitpos
, _x
= dwgutil
.get_bit_double(data
, _bitpos
)
2614 _bitpos
, _y
= dwgutil
.get_bit_double(data
, _bitpos
)
2615 _bitpos
, _z
= dwgutil
.get_bit_double(data
, _bitpos
)
2616 _miter_dir
= (_x
, _y
, _z
)
2618 for _j
in range(_lis
):
2619 _bitpos
, _ns
= dwgutil
.get_bit_short(data
, _bitpos
)
2621 for _k
in range(_ns
):
2622 _bitpos
, _sp
= dwgutil
.get_bit_double(data
, _bitpos
)
2623 _segparms
.append(_sp
)
2624 _bitpos
, _na
= dwgutil
.get_bit_short(data
, _bitpos
)
2626 for _k
in range(_na
):
2627 _bitpos
, _afp
= dwgutil
.get_bit_double(data
, _bitpos
)
2628 _fillparms
.append(_afp
)
2629 _lines
.append((_segparms
, _fillparms
))
2630 _points
.append((_vertex
, _vertex_dir
, _miter_dir
, _lines
))
2631 ent
.setEntityData('points', _points
)
2632 _bitpos
= tail_read(ent
, data
, _bitpos
)
2633 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
2634 ent
.setEntityData('mline_style_object_handle', _handle
)
2636 def block_control_reader(ent
, data
, offset
):
2638 _bitpos
, _nr
= dwgutil
.get_bit_long(data
, _bitpos
)
2639 ent
.setNumReactors(_nr
)
2640 _bitpos
, _enum
= dwgutil
.get_bit_short(data
, _bitpos
)
2641 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
2642 ent
.setEntityData('null_handle', _handle
)
2643 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
2644 ent
.setXdicobj(_handle
)
2647 for _i
in range(_enum
):
2648 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
2649 _handles
.append(_handle
)
2650 ent
.setEntityData('code_2_handles', _handles
)
2651 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
2652 ent
.setEntityData('*model_space_handle', _handle
)
2653 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
2654 ent
.setEntityData('*paper_space_handle', _handle
)
2656 def block_header_reader(ent
, data
, offset
):
2658 _bitpos
, _nr
= dwgutil
.get_bit_long(data
, _bitpos
)
2659 ent
.setNumReactors(_nr
)
2660 _bitpos
, _name
= dwgutil
.get_text_string(data
, _bitpos
)
2661 ent
.setEntityData('name', _name
)
2662 _bitpos
, _flag
= dwgutil
.test_bit(data
, _bitpos
)
2663 ent
.setEntityData('64-flag', _flag
)
2664 # print "bitpos: %d" % _bitpos
2665 _bitpos
, _xrefplus1
= dwgutil
.get_bit_short(data
, _bitpos
)
2666 ent
.setEntityData('xrefplus', _xrefplus1
)
2667 _bitpos
, _xdep
= dwgutil
.test_bit(data
, _bitpos
)
2668 ent
.setEntityData('xdep', _xdep
)
2669 _bitpos
, _anon
= dwgutil
.test_bit(data
, _bitpos
)
2670 ent
.setEntityData('anonymous', _anon
)
2671 # print "bitpos: %d" % _bitpos
2672 _bitpos
, _hasatts
= dwgutil
.test_bit(data
, _bitpos
)
2673 ent
.setEntityData('has_attrs', _hasatts
)
2674 _bitpos
, _bxref
= dwgutil
.test_bit(data
, _bitpos
)
2675 ent
.setEntityData('blk_is_xref', _bxref
)
2676 _bitpos
, _xover
= dwgutil
.test_bit(data
, _bitpos
)
2677 ent
.setEntityData('xrefoverlaid', _xover
)
2678 # print "bitpos: %d" % _bitpos
2679 _bitpos
, _loaded
= dwgutil
.test_bit(data
, _bitpos
)
2680 ent
.setEntityData('loaded', _loaded
)
2681 _bitpos
, _bx
= dwgutil
.get_bit_double(data
, _bitpos
)
2682 _bitpos
, _by
= dwgutil
.get_bit_double(data
, _bitpos
)
2683 _bitpos
, _bz
= dwgutil
.get_bit_double(data
, _bitpos
)
2684 ent
.setEntityData('base_point', (_bx
, _by
, _bz
))
2685 # print "bitpos: %d" % _bitpos
2686 _bitpos
, _pname
= dwgutil
.get_text_string(data
, _bitpos
)
2687 ent
.setEntityData('xref_pname', _pname
)
2688 # print "bitpos: %d" % _bitpos
2691 _bitpos
, _val
= dwgutil
.get_raw_char(data
, _bitpos
)
2694 _icount
= _icount
+ 1
2695 # print "insert count: %#x" % _icount
2696 # print "bitpos: %d" % _bitpos
2697 _bitpos
, _desc
= dwgutil
.get_text_string(data
, _bitpos
)
2698 ent
.setEntityData('block_description', _desc
)
2699 # print "bitpos: %d" % _bitpos
2700 _bitpos
, _pdsize
= dwgutil
.get_bit_long(data
, _bitpos
)
2701 # print "preview data size: %d" % _pdsize
2702 # print "bitpos: %d" % _bitpos
2704 _count
= _pdsize
* _icount
2705 _pdata
= dwgutil
.get_bits(data
, _count
, _bitpos
)
2706 ent
.setEntityData('preview_data', _pdata
)
2707 _bitpos
= _bitpos
+ _count
2708 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
2709 ent
.setEntityData('block_control_handle', _handle
)
2710 # print "bitpos: %d" % _bitpos
2711 for _i
in range(_nr
):
2712 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
2713 ent
.addReactor(_handle
)
2714 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
2715 ent
.setXdicobj(_handle
)
2716 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
2717 ent
.setEntityData('null_handle', _handle
)
2718 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
2719 ent
.setEntityData('block_entity_handle', _handle
)
2720 if not _bxref
and not _xover
:
2721 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
2722 ent
.setEntityData('first_entity_handle', _handle
)
2723 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
2724 ent
.setEntityData('last_entity_handle', _handle
)
2725 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
2726 ent
.setEntityData('endblk_entity_handle', _handle
)
2729 for _i
in range(_icount
):
2730 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
2731 _handles
.append(_handle
)
2732 ent
.setEntityData('insert_handles', _handles
)
2733 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
2734 ent
.setEntityData('layout_handle', _handle
)
2736 def layer_control_reader(ent
, data
, offset
):
2738 _bitpos
, _nr
= dwgutil
.get_bit_long(data
, _bitpos
)
2739 ent
.setNumReactors(_nr
)
2740 _bitpos
, _ne
= dwgutil
.get_bit_short(data
, _bitpos
)
2741 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
2742 ent
.setEntityData('null_handle', _handle
)
2743 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
2744 ent
.setXdicobj(_handle
)
2747 for _i
in range(_ne
):
2748 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
2749 _handles
.append(_handle
)
2750 ent
.setEntityData('code_2_handles', _handles
)
2752 def layer_reader(ent
, data
, offset
):
2754 _bitpos
, _nr
= dwgutil
.get_bit_long(data
, _bitpos
)
2755 ent
.setNumReactors(_nr
)
2756 _bitpos
, _name
= dwgutil
.get_text_string(data
, _bitpos
)
2757 ent
.setEntityData('name', _name
)
2758 _bitpos
, _flag
= dwgutil
.test_bit(data
, _bitpos
)
2759 ent
.setEntityData('64-flag', _flag
)
2760 _bitpos
, _xrefplus1
= dwgutil
.get_bit_short(data
, _bitpos
)
2761 ent
.setEntityData('xrefplus', _xrefplus1
)
2762 _bitpos
, _xdep
= dwgutil
.test_bit(data
, _bitpos
)
2763 ent
.setEntityData('xdep', _xdep
)
2764 _bitpos
, _flags
= dwgutil
.get_bit_short(data
, _bitpos
)
2765 ent
.setEntityData('flags', _flags
)
2766 _bitpos
, _color
= dwgutil
.get_bit_short(data
, _bitpos
)
2767 ent
.setEntityData('color', _color
)
2768 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
2769 ent
.setEntityData('layer_control_handle', _handle
)
2770 for _i
in range(_nr
):
2771 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
2772 ent
.addReactor(_handle
)
2773 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
2774 ent
.setXdicobj(_handle
)
2775 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
2776 ent
.setEntityData('null_handle', _handle
)
2777 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
2778 ent
.setEntityData('plotstyle_handle', _handle
)
2779 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
2780 ent
.setEntityData('linetype_handle', _handle
)
2782 def shapefile_control_reader(ent
, data
, offset
):
2784 _bitpos
, _nr
= dwgutil
.get_bit_long(data
, _bitpos
)
2785 ent
.setNumReactors(_nr
)
2786 _bitpos
, _ne
= dwgutil
.get_bit_short(data
, _bitpos
)
2787 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
2788 ent
.setEntityData('null_handle', _handle
)
2789 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
2790 ent
.setXdicobj(_handle
)
2793 for _i
in range(_ne
):
2794 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
2795 _handles
.append(_handle
)
2796 ent
.setEntityData('shapefile_handles', _handles
)
2798 def shapefile_reader(ent
, data
, offset
):
2800 _bitpos
, _nr
= dwgutil
.get_bit_long(data
, _bitpos
)
2801 ent
.setNumReactors(_nr
)
2802 _bitpos
, _name
= dwgutil
.get_text_string(data
, _bitpos
)
2803 ent
.setEntityData('name', _name
)
2804 _bitpos
, _flag
= dwgutil
.test_bit(data
, _bitpos
)
2805 ent
.setEntityData('64-flag', _flag
)
2806 _bitpos
, _xrefplus1
= dwgutil
.get_bit_short(data
, _bitpos
)
2807 ent
.setEntityData('xrefplus', _xrefplus1
)
2808 _bitpos
, _xdep
= dwgutil
.test_bit(data
, _bitpos
)
2809 ent
.setEntityData('xdep', _xdep
)
2810 _bitpos
, _vert
= dwgutil
.test_bit(data
, _bitpos
)
2811 ent
.setEntityData('vertical', _vert
)
2812 _bitpos
, _sf
= dwgutil
.test_bit(data
, _bitpos
)
2813 ent
.setEntityData('shape_file', _sf
)
2814 _bitpos
, _fh
= dwgutil
.get_bit_double(data
, _bitpos
)
2815 ent
.setEntityData('fixed_height', _fh
)
2816 _bitpos
, _fw
= dwgutil
.get_bit_double(data
, _bitpos
)
2817 ent
.setEntityData('fixed_width', _fw
)
2818 _bitpos
, _ob
= dwgutil
.get_bit_double(data
, _bitpos
)
2819 ent
.setEntityData('oblique_angle', _ob
)
2820 _bitpos
, _gen
= dwgutil
.get_raw_char(data
, _bitpos
)
2821 ent
.setEntityData('generation', _gen
)
2822 _bitpos
, _lh
= dwgutil
.get_bit_double(data
, _bitpos
)
2823 ent
.setEntityData('last_height', _lh
)
2824 _bitpos
, _fn
= dwgutil
.get_text_string(data
, _bitpos
)
2825 ent
.setEntityData('font_name', _fn
)
2826 _bitpos
, _bfn
= dwgutil
.get_text_string(data
, _bitpos
)
2827 ent
.setEntityData('big_font_name', _bfn
)
2828 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
2829 ent
.setEntityData('shapefile_control_handle', _handle
)
2830 for _i
in range(_nr
):
2831 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
2832 ent
.addReactor(_handle
)
2833 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
2834 ent
.setXdicobj(_handle
)
2835 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
2836 ent
.setEntityData('null_handle', _handle
)
2838 def linetype_control_reader(ent
, data
, offset
):
2840 _bitpos
, _nr
= dwgutil
.get_bit_long(data
, _bitpos
)
2841 ent
.setNumReactors(_nr
)
2842 _bitpos
, _ne
= dwgutil
.get_bit_short(data
, _bitpos
)
2843 ent
.setEntityData('entity_count', _ne
)
2844 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
2845 ent
.setEntityData('null_handle', _handle
)
2846 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
2847 ent
.setXdicobj(_handle
)
2850 for _i
in range(_ne
):
2851 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
2852 _handles
.append(_handle
)
2853 ent
.setEntityData('handles', _handles
)
2855 def linetype_reader(ent
, data
, offset
):
2857 _bitpos
, _nr
= dwgutil
.get_bit_long(data
, _bitpos
)
2858 ent
.setNumReactors(_nr
)
2859 _bitpos
, _name
= dwgutil
.get_text_string(data
, _bitpos
)
2860 ent
.setEntityData('name', _name
)
2861 _bitpos
, _flag
= dwgutil
.test_bit(data
, _bitpos
)
2862 ent
.setEntityData('64-flag', _flag
)
2863 _bitpos
, _xrefplus1
= dwgutil
.get_bit_short(data
, _bitpos
)
2864 ent
.setEntityData('xrefplus', _xrefplus1
)
2865 _bitpos
, _xdep
= dwgutil
.test_bit(data
, _bitpos
)
2866 ent
.setEntityData('xdep', _xdep
)
2867 _bitpos
, _desc
= dwgutil
.get_text_string(data
, _bitpos
)
2868 ent
.setEntityData('description', _desc
)
2869 _bitpos
, _pl
= dwgutil
.get_bit_double(data
, _bitpos
)
2870 ent
.setEntityData('pattern_length', _pl
)
2871 _bitpos
, _align
= dwgutil
.get_raw_char(data
, _bitpos
)
2872 ent
.setEntityData('alignment', _align
)
2873 _bitpos
, _nd
= dwgutil
.get_raw_char(data
, _bitpos
)
2876 for _i
in range(_nd
):
2877 _bitpos
, _dl
= dwgutil
.get_bit_double(data
, _bitpos
)
2878 _bitpos
, _cs
= dwgutil
.get_bit_short(data
, _bitpos
)
2879 _bitpos
, _xo
= dwgutil
.get_raw_double(data
, _bitpos
)
2880 _bitpos
, _yo
= dwgutil
.get_raw_double(data
, _bitpos
)
2881 _bitpos
, _scale
= dwgutil
.get_bit_double(data
, _bitpos
)
2882 _bitpos
, _rot
= dwgutil
.get_bit_double(data
, _bitpos
)
2883 _bitpos
, _sf
= dwgutil
.get_bit_short(data
, _bitpos
)
2884 _dashes
.append((_dl
, _cs
, _xo
, _yo
, _scale
, _rot
, _sf
))
2885 ent
.setEntityData('dashes', _dashes
)
2886 _strings
= dwgutil
.get_bits(data
, 256, _bitpos
)
2887 _bitpos
= _bitpos
+ 256
2888 ent
.setEntityData('strings', _strings
)
2889 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
2890 ent
.setEntityData('linetype_control_handle', _handle
)
2891 for _i
in range(_nr
):
2892 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
2893 ent
.addReactor(_handle
)
2894 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
2895 ent
.setXdicobj(_handle
)
2896 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
2897 ent
.setEntityData('null_handle', _handle
)
2899 def view_control_reader(ent
, data
, offset
):
2901 _bitpos
, _nr
= dwgutil
.get_bit_long(data
, _bitpos
)
2902 ent
.setNumReactors(_nr
)
2903 _bitpos
, _ne
= dwgutil
.get_bit_short(data
, _bitpos
)
2904 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
2905 ent
.setEntityData('null_handle', _handle
)
2906 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
2907 ent
.setXdicobj(_handle
)
2910 for _i
in range(_ne
):
2911 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
2912 _handles
.append(_handle
)
2913 ent
.setEntityData('view_handles', _handles
)
2915 def view_reader(ent
, data
, offset
):
2917 _bitpos
, _nr
= dwgutil
.get_bit_long(data
, _bitpos
)
2918 ent
.setNumReactors(_nr
)
2919 _bitpos
, _name
= dwgutil
.get_text_string(data
, _bitpos
)
2920 ent
.setEntityData('name', _name
)
2921 _bitpos
, _flag
= dwgutil
.test_bit(data
, _bitpos
)
2922 ent
.setEntityData('64-flag', _flag
)
2923 _bitpos
, _xrefplus1
= dwgutil
.get_bit_short(data
, _bitpos
)
2924 ent
.setEntityData('xrefplus', _xrefplus1
)
2925 _bitpos
, _xdep
= dwgutil
.test_bit(data
, _bitpos
)
2926 ent
.setEntityData('xdep', _xdep
)
2927 _bitpos
, _vh
= dwgutil
.get_bit_double(data
, _bitpos
)
2928 ent
.setEntityData('view_height', _vh
)
2929 _bitpos
, _vw
= dwgutil
.get_bit_double(data
, _bitpos
)
2930 ent
.setEntityData('view_width', _vw
)
2931 _bitpos
, _x
= dwgutil
.get_raw_double(data
, _bitpos
)
2932 _bitpos
, _y
= dwgutil
.get_raw_double(data
, _bitpos
)
2933 ent
.setEntityData('view_center', (_x
, _y
))
2934 _bitpos
, _x
= dwgutil
.get_bit_double(data
, _bitpos
)
2935 _bitpos
, _y
= dwgutil
.get_bit_double(data
, _bitpos
)
2936 _bitpos
, _z
= dwgutil
.get_bit_double(data
, _bitpos
)
2937 ent
.setEntityData('target', (_x
, _y
, _z
))
2938 _bitpos
, _x
= dwgutil
.get_bit_double(data
, _bitpos
)
2939 _bitpos
, _y
= dwgutil
.get_bit_double(data
, _bitpos
)
2940 _bitpos
, _z
= dwgutil
.get_bit_double(data
, _bitpos
)
2941 ent
.setEntityData('view_dir', (_x
, _y
, _z
))
2942 _bitpos
, _ta
= dwgutil
.get_bit_double(data
, _bitpos
)
2943 ent
.setEntityData('twist_angle', _ta
)
2944 _bitpos
, _ll
= dwgutil
.get_bit_double(data
, _bitpos
)
2945 ent
.setEntityData('lens_length', _ll
)
2946 _bitpos
, _fc
= dwgutil
.get_bit_double(data
, _bitpos
)
2947 ent
.setEntityData('front_clip', _fc
)
2948 _bitpos
, _bc
= dwgutil
.get_bit_double(data
, _bitpos
)
2949 ent
.setEntityData('back_clip', _bc
)
2950 _vm
= dwgutil
.get_bits(data
, 4, _bitpos
)
2951 _bitpos
= _bitpos
+ 4
2952 ent
.setEntityData('view_control_flags', _vm
)
2953 _bitpos
, _rmode
= dwgutil
.get_raw_char(data
, _bitpos
)
2954 ent
.setEntityData('render_mode', _rmode
)
2955 _bitpos
, _flag
= dwgutil
.test_bit(data
, _bitpos
)
2956 ent
.setEntityData('pspace_flag', _flag
)
2957 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
2958 ent
.setEntityData('view_control_handle', _handle
)
2959 _bitpos
, _val
= dwgutil
.test_bit(data
, _bitpos
)
2960 ent
.setEntityData('associated_ucs', _val
)
2962 _bitpos
, _x
= dwgutil
.get_bit_double(data
, _bitpos
)
2963 _bitpos
, _y
= dwgutil
.get_bit_double(data
, _bitpos
)
2964 _bitpos
, _z
= dwgutil
.get_bit_double(data
, _bitpos
)
2965 ent
.setEntityData('ucs_origin', (_x
, _y
, _z
))
2966 _bitpos
, _x
= dwgutil
.get_bit_double(data
, _bitpos
)
2967 _bitpos
, _y
= dwgutil
.get_bit_double(data
, _bitpos
)
2968 _bitpos
, _z
= dwgutil
.get_bit_double(data
, _bitpos
)
2969 ent
.setEntityData('ucs_x_axis', (_x
, _y
, _z
))
2970 _bitpos
, _x
= dwgutil
.get_bit_double(data
, _bitpos
)
2971 _bitpos
, _y
= dwgutil
.get_bit_double(data
, _bitpos
)
2972 _bitpos
, _z
= dwgutil
.get_bit_double(data
, _bitpos
)
2973 ent
.setEntityData('ucs_y_axis', (_x
, _y
, _z
))
2974 _bitpos
, _elev
= dwgutil
.get_bit_double(data
, _bitpos
)
2975 ent
.setEntityData('elevation', _elev
)
2976 _bitpos
, _ovtype
= dwgutil
.get_bit_short(data
, _bitpos
)
2977 ent
.setEntityData('orthographic_view_type', _ovtype
)
2978 for _i
in range(_nr
):
2979 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
2980 ent
.addReactor(_handle
)
2981 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
2982 ent
.setXdicobj(_handle
)
2983 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
2984 ent
.setEntityData('null_handle', _handle
)
2985 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
2986 ent
.setEntityData('base_ucs_handle', _handle
)
2987 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
2988 ent
.setEntityData('named_ucs_handle', _handle
)
2990 def ucs_control_reader(ent
, data
, offset
):
2992 _bitpos
, _nr
= dwgutil
.get_bit_long(data
, _bitpos
)
2993 ent
.setNumReactors(_nr
)
2994 _bitpos
, _ne
= dwgutil
.get_bit_short(data
, _bitpos
)
2995 # print "numentries: %d" % _ne
2996 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
2997 ent
.setEntityData('null_handle', _handle
)
2998 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
2999 ent
.setXdicobj(_handle
)
3002 for _i
in range(_ne
):
3003 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
3004 _handles
.append(_handle
)
3005 ent
.setEntityData('ucs_handles', _handles
)
3007 def ucs_reader(ent
, data
, offset
):
3009 _bitpos
, _nr
= dwgutil
.get_bit_long(data
, _bitpos
)
3010 ent
.setNumReactors(_nr
)
3011 _bitpos
, _name
= dwgutil
.get_text_string(data
, _bitpos
)
3012 ent
.setEntityData('name', _name
)
3013 _bitpos
, _flag
= dwgutil
.test_bit(data
, _bitpos
)
3014 ent
.setEntityData('64-flag', _flag
)
3015 _bitpos
, _xrefplus1
= dwgutil
.get_bit_short(data
, _bitpos
)
3016 ent
.setEntityData('xrefplus', _xrefplus1
)
3017 _bitpos
, _xdep
= dwgutil
.test_bit(data
, _bitpos
)
3018 ent
.setEntityData('xdep', _xdep
)
3019 _bitpos
, _x
= dwgutil
.get_bit_double(data
, _bitpos
)
3020 _bitpos
, _y
= dwgutil
.get_bit_double(data
, _bitpos
)
3021 _bitpos
, _z
= dwgutil
.get_bit_double(data
, _bitpos
)
3022 ent
.setEntityData('origin', (_x
, _y
, _z
))
3023 _bitpos
, _x
= dwgutil
.get_bit_double(data
, _bitpos
)
3024 _bitpos
, _y
= dwgutil
.get_bit_double(data
, _bitpos
)
3025 _bitpos
, _z
= dwgutil
.get_bit_double(data
, _bitpos
)
3026 ent
.setEntityData('x_direction', (_x
, _y
, _z
))
3027 _bitpos
, _x
= dwgutil
.get_bit_double(data
, _bitpos
)
3028 _bitpos
, _y
= dwgutil
.get_bit_double(data
, _bitpos
)
3029 _bitpos
, _z
= dwgutil
.get_bit_double(data
, _bitpos
)
3030 ent
.setEntityData('y_direction', (_x
, _y
, _z
))
3031 _bitpos
, _elev
= dwgutil
.get_bit_double(data
, _bitpos
)
3032 ent
.setEntityData('elevation', _elev
)
3033 _bitpos
, _ovtype
= dwgutil
.get_bit_short(data
, _bitpos
)
3034 ent
.setEntityData('orthographic_view_type', _ovtype
)
3035 _bitpos
, _otype
= dwgutil
.get_bit_short(data
, _bitpos
)
3036 ent
.setEntityData('orthographic_type', _otype
)
3037 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
3038 ent
.setEntityData('ucs_control_handle', _handle
)
3039 for _i
in range(_nr
):
3040 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
3041 ent
.addReactor(_handle
)
3042 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
3043 ent
.setXdicobj(_handle
)
3044 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
3045 ent
.setEntityData('null_handle', _handle
)
3046 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
3047 ent
.setEntityData('base_ucs_handle',_handle
)
3048 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
3049 ent
.setEntityData('unknown_handle', _handle
)
3051 def vport_control_reader(ent
, data
, offset
):
3053 _bitpos
, _nr
= dwgutil
.get_bit_long(data
, _bitpos
)
3054 ent
.setNumReactors(_nr
)
3055 _bitpos
, _ne
= dwgutil
.get_bit_short(data
, _bitpos
)
3056 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
3057 ent
.setEntityData('null_handle', _handle
)
3058 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
3059 ent
.setXdicobj(_handle
)
3062 for _i
in range(_ne
):
3063 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
3064 _handles
.append(_handle
)
3065 ent
.setEntityData('vport_handles', _handles
)
3067 def vport_reader(ent
, data
, offset
):
3069 _bitpos
, _nr
= dwgutil
.get_bit_long(data
, _bitpos
)
3070 ent
.setNumReactors(_nr
)
3071 _bitpos
, _text
= dwgutil
.get_text_string(data
, _bitpos
)
3072 ent
.setEntityData('name', _text
)
3073 _bitpos
, _flag
= dwgutil
.test_bit(data
, _bitpos
)
3074 ent
.setEntityData('64-flag', _flag
)
3075 _bitpos
, _val
= dwgutil
.get_bit_short(data
, _bitpos
)
3076 ent
.setEntityData('xrefplus', _val
)
3077 _bitpos
, _flag
= dwgutil
.test_bit(data
, _bitpos
)
3078 ent
.setEntityData('xdep', _flag
)
3079 _bitpos
, _val
= dwgutil
.get_bit_double(data
, _bitpos
)
3080 ent
.setEntityData('view_height', _val
)
3081 _bitpos
, _val
= dwgutil
.get_bit_double(data
, _bitpos
)
3082 ent
.setEntityData('aspect_ratio', _val
)
3083 _bitpos
, _x
= dwgutil
.get_raw_double(data
, _bitpos
)
3084 _bitpos
, _y
= dwgutil
.get_raw_double(data
, _bitpos
)
3085 ent
.setEntityData('view_center', (_x
, _y
))
3086 _bitpos
, _x
= dwgutil
.get_bit_double(data
, _bitpos
)
3087 _bitpos
, _y
= dwgutil
.get_bit_double(data
, _bitpos
)
3088 _bitpos
, _z
= dwgutil
.get_bit_double(data
, _bitpos
)
3089 ent
.setEntityData('target', (_x
, _y
, _z
))
3090 _bitpos
, _x
= dwgutil
.get_bit_double(data
, _bitpos
)
3091 _bitpos
, _y
= dwgutil
.get_bit_double(data
, _bitpos
)
3092 _bitpos
, _z
= dwgutil
.get_bit_double(data
, _bitpos
)
3093 ent
.setEntityData('view_dir', (_x
, _y
, _z
))
3094 _bitpos
, _val
= dwgutil
.get_bit_double(data
, _bitpos
)
3095 ent
.setEntityData('twist_angle', _val
)
3096 _bitpos
, _val
= dwgutil
.get_bit_double(data
, _bitpos
)
3097 ent
.setEntityData('lens_length', _val
)
3098 _bitpos
, _val
= dwgutil
.get_bit_double(data
, _bitpos
)
3099 ent
.setEntityData('front_clip', _val
)
3100 _bitpos
, _val
= dwgutil
.get_bit_double(data
, _bitpos
)
3101 ent
.setEntityData('back_clip', _val
)
3102 _flags
= dwgutil
.get_bits(data
, 4, _bitpos
)
3103 _bitpos
= _bitpos
+ 4
3104 ent
.setEntityData('vport_flags', _flags
)
3105 _bitpos
, _val
= dwgutil
.get_raw_char(data
, _bitpos
)
3106 ent
.setEntityData('render_mode', _val
)
3107 _bitpos
, _x
= dwgutil
.get_raw_double(data
, _bitpos
)
3108 _bitpos
, _y
= dwgutil
.get_raw_double(data
, _bitpos
)
3109 ent
.setEntityData('lower_left', (_x
, _y
))
3110 _bitpos
, _x
= dwgutil
.get_raw_double(data
, _bitpos
)
3111 _bitpos
, _y
= dwgutil
.get_raw_double(data
, _bitpos
)
3112 ent
.setEntityData('upper_right', (_x
, _y
))
3113 _bitpos
, _flag
= dwgutil
.test_bit(data
, _bitpos
)
3114 ent
.setEntityData('ucsfollow', _flag
)
3115 _bitpos
, _val
= dwgutil
.get_bit_short(data
, _bitpos
)
3116 ent
.setEntityData('circle_zoom', _val
)
3117 _bitpos
, _flag
= dwgutil
.test_bit(data
, _bitpos
)
3118 ent
.setEntityData('fast_zoom', _flag
)
3119 _flags
= dwgutil
.get_bits(data
, 2, _bitpos
)
3120 _bitpos
= _bitpos
+ 2
3121 ent
.setEntityData('ucsicon', _flags
)
3122 _bitpos
, _flag
= dwgutil
.test_bit(data
, _bitpos
)
3123 ent
.setEntityData('grid_status', _flag
)
3124 _bitpos
, _x
= dwgutil
.get_raw_double(data
, _bitpos
)
3125 _bitpos
, _y
= dwgutil
.get_raw_double(data
, _bitpos
)
3126 ent
.setEntityData('grid_spacing', (_x
, _y
))
3127 _bitpos
, _flag
= dwgutil
.test_bit(data
, _bitpos
)
3128 ent
.setEntityData('snap_status', _flag
)
3129 _bitpos
, _flag
= dwgutil
.test_bit(data
, _bitpos
)
3130 ent
.setEntityData('snap_style', _flag
)
3131 _bitpos
, _val
= dwgutil
.get_bit_short(data
, _bitpos
)
3132 ent
.setEntityData('snap_isopair', _val
)
3133 _bitpos
, _val
= dwgutil
.get_bit_double(data
, _bitpos
)
3134 ent
.setEntityData('snap_rotation', _val
)
3135 _bitpos
, _x
= dwgutil
.get_raw_double(data
, _bitpos
)
3136 _bitpos
, _y
= dwgutil
.get_raw_double(data
, _bitpos
)
3137 ent
.setEntityData('snap_base', (_x
, _y
))
3138 _bitpos
, _x
= dwgutil
.get_raw_double(data
, _bitpos
)
3139 _bitpos
, _y
= dwgutil
.get_raw_double(data
, _bitpos
)
3140 ent
.setEntityData('snap_spacing', (_x
, _y
))
3141 _bitpos
, _val
= dwgutil
.test_bit(data
, _bitpos
)
3142 ent
.setEntityData('unknown_bit', _val
)
3143 _bitpos
, _val
= dwgutil
.test_bit(data
, _bitpos
)
3144 ent
.setEntityData('ucs_per_viewport', _val
)
3145 _bitpos
, _x
= dwgutil
.get_bit_double(data
, _bitpos
)
3146 _bitpos
, _y
= dwgutil
.get_bit_double(data
, _bitpos
)
3147 _bitpos
, _z
= dwgutil
.get_bit_double(data
, _bitpos
)
3148 ent
.setEntityData('origin', (_x
, _y
, _z
))
3149 _bitpos
, _x
= dwgutil
.get_bit_double(data
, _bitpos
)
3150 _bitpos
, _y
= dwgutil
.get_bit_double(data
, _bitpos
)
3151 _bitpos
, _z
= dwgutil
.get_bit_double(data
, _bitpos
)
3152 ent
.setEntityData('x_direction', (_x
, _y
, _z
))
3153 _bitpos
, _x
= dwgutil
.get_bit_double(data
, _bitpos
)
3154 _bitpos
, _y
= dwgutil
.get_bit_double(data
, _bitpos
)
3155 _bitpos
, _z
= dwgutil
.get_bit_double(data
, _bitpos
)
3156 ent
.setEntityData('y_direction', (_x
, _y
, _z
))
3157 _bitpos
, _val
= dwgutil
.get_bit_double(data
, _bitpos
)
3158 ent
.setEntityData('elevation', _val
)
3159 _bitpos
, _val
= dwgutil
.get_bit_short(data
, _bitpos
)
3160 ent
.setEntityData('orthographic_view_type', _val
)
3161 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
3162 ent
.setEntityData('vport_control_handle', _handle
)
3163 for _i
in range(_nr
):
3164 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
3165 ent
.addReactor(_handle
)
3166 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
3167 ent
.setXdicobj(_handle
)
3168 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
3169 ent
.setEntityData('null_handle', _handle
)
3170 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
3171 ent
.setEntityData('base_ucs_handle', _handle
)
3172 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
3173 ent
.setEntityData('named_handle', _handle
)
3175 def appid_control_reader(ent
, data
, offset
):
3177 _bitpos
, _nr
= dwgutil
.get_bit_long(data
, _bitpos
)
3178 ent
.setNumReactors(_nr
)
3179 _bitpos
, _ne
= dwgutil
.get_bit_short(data
, _bitpos
)
3180 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
3181 ent
.setEntityData('null_handle', _handle
)
3182 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
3183 ent
.setXdicobj(_handle
)
3186 for _i
in range(_ne
):
3187 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
3188 _handles
.append(_handle
)
3189 ent
.setEntityData('appid_handles', _handles
)
3191 def appid_reader(ent
, data
, offset
):
3193 _bitpos
, _nr
= dwgutil
.get_bit_long(data
, _bitpos
)
3194 ent
.setNumReactors(_nr
)
3195 _bitpos
, _name
= dwgutil
.get_text_string(data
, _bitpos
)
3196 ent
.setEntityData('name', _name
)
3197 _bitpos
, _flag
= dwgutil
.test_bit(data
, _bitpos
)
3198 ent
.setEntityData('64-flag', _flag
)
3199 _bitpos
, _xrefplus1
= dwgutil
.get_bit_short(data
, _bitpos
)
3200 ent
.setEntityData('xrefplus', _xrefplus1
)
3201 _bitpos
, _xdep
= dwgutil
.test_bit(data
, _bitpos
)
3202 ent
.setEntityData('xdep', _xdep
)
3203 _bitpos
, _u
= dwgutil
.get_raw_char(data
, _bitpos
)
3204 ent
.setEntityData('unknown_char', _u
)
3205 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
3206 ent
.setEntityData('appid_control_handle', _handle
)
3207 for _i
in range(_nr
):
3208 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
3209 ent
.addReactor(_handle
)
3210 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
3211 ent
.setXdicobj(_handle
)
3212 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
3213 ent
.setEntityData('null_handle', _handle
)
3215 def dimstyle_control_reader(ent
, data
, offset
):
3217 _bitpos
, _nr
= dwgutil
.get_bit_long(data
, _bitpos
)
3218 ent
.setNumReactors(_nr
)
3219 # print "bitpos: %d" % _bitpos
3220 _bitpos
, _ne
= dwgutil
.get_bit_short(data
, _bitpos
)
3221 # print "numentries: %d" % _ne
3222 # print "bitpos: %d" % _bitpos
3223 _bitpos
, _nc5
= dwgutil
.get_raw_char(data
, _bitpos
) # code 5 handles not in spec
3224 # print "bitpos: %d" % _bitpos
3225 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
3226 ent
.setEntityData('null_handle', _handle
)
3227 # print "bitpos: %d" % _bitpos
3228 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
3229 ent
.setXdicobj(_handle
)
3230 # print "bitpos: %d" % _bitpos
3233 for _i
in range(_ne
):
3234 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
3235 _handles
.append(_handle
)
3236 ent
.setEntityData('dimstyle_handles', _handles
)
3237 # print "bitpos: %d" % _bitpos
3240 for _i
in range(_nc5
): # not in spec
3241 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
3242 _handles
.append(_handle
)
3243 ent
.setEntityData('code_5_handles', _handles
)
3244 # print "bitpos: %d" % _bitpos
3246 def dimstyle_reader(ent
, data
, offset
):
3248 _bitpos
, _nr
= dwgutil
.get_bit_long(data
, _bitpos
)
3249 ent
.setNumReactors(_nr
)
3250 _bitpos
, _name
= dwgutil
.get_text_string(data
, _bitpos
)
3251 ent
.setEntityData('name', _name
)
3252 _bitpos
, _flag
= dwgutil
.test_bit(data
, _bitpos
)
3253 ent
.setEntityData('64-flag', _flag
)
3254 _bitpos
, _xrefplus1
= dwgutil
.get_bit_short(data
, _bitpos
)
3255 ent
.setEntityData('xrefplus', _xrefplus1
)
3256 _bitpos
, _xdep
= dwgutil
.test_bit(data
, _bitpos
)
3257 ent
.setEntityData('xdep', _xdep
)
3258 _bitpos
, _string
= dwgutil
.get_text_string(data
, _bitpos
)
3259 ent
.setEntityData('DIMPOST', _string
)
3260 _bitpos
, _string
= dwgutil
.get_text_string(data
, _bitpos
)
3261 ent
.setEntityData('DIMAPOST', _string
)
3262 _bitpos
, _val
= dwgutil
.get_bit_double(data
, _bitpos
)
3263 ent
.setEntityData('DIMSCALE', _val
)
3264 _bitpos
, _val
= dwgutil
.get_bit_double(data
, _bitpos
)
3265 ent
.setEntityData('DIMASZ', _val
)
3266 _bitpos
, _val
= dwgutil
.get_bit_double(data
, _bitpos
)
3267 ent
.setEntityData('DIMEXO', _val
)
3268 _bitpos
, _val
= dwgutil
.get_bit_double(data
, _bitpos
)
3269 ent
.setEntityData('DIMDLI', _val
)
3270 _bitpos
, _val
= dwgutil
.get_bit_double(data
, _bitpos
)
3271 ent
.setEntityData('DIMEXE', _val
)
3272 _bitpos
, _val
= dwgutil
.get_bit_double(data
, _bitpos
)
3273 ent
.setEntityData('DIMRND', _val
)
3274 _bitpos
, _val
= dwgutil
.get_bit_double(data
, _bitpos
)
3275 ent
.setEntityData('DIMDLE', _val
)
3276 _bitpos
, _val
= dwgutil
.get_bit_double(data
, _bitpos
)
3277 ent
.setEntityData('DIMTP', _val
)
3278 _bitpos
, _val
= dwgutil
.get_bit_double(data
, _bitpos
)
3279 ent
.setEntityData('DIMTM', _val
)
3280 _bitpos
, _flag
= dwgutil
.test_bit(data
, _bitpos
)
3281 ent
.setEntityData('DIMTOL', _flag
)
3282 _bitpos
, _flag
= dwgutil
.test_bit(data
, _bitpos
)
3283 ent
.setEntityData('DIMLIM', _flag
)
3284 _bitpos
, _flag
= dwgutil
.test_bit(data
, _bitpos
)
3285 ent
.setEntityData('DIMTIH', _flag
)
3286 _bitpos
, _flag
= dwgutil
.test_bit(data
, _bitpos
)
3287 ent
.setEntityData('DIMTOH', _flag
)
3288 _bitpos
, _flag
= dwgutil
.test_bit(data
, _bitpos
)
3289 ent
.setEntityData('DIMSE1', _flag
)
3290 _bitpos
, _flag
= dwgutil
.test_bit(data
, _bitpos
)
3291 ent
.setEntityData('DIMSE2', _flag
)
3292 _bitpos
, _val
= dwgutil
.get_bit_short(data
, _bitpos
)
3293 ent
.setEntityData('DIMTAD', _val
)
3294 _bitpos
, _val
= dwgutil
.get_bit_short(data
, _bitpos
)
3295 ent
.setEntityData('DIMZIN', _val
)
3296 _bitpos
, _val
= dwgutil
.get_bit_short(data
, _bitpos
)
3297 ent
.setEntityData('DIMAZIN', _val
)
3298 _bitpos
, _val
= dwgutil
.get_bit_double(data
, _bitpos
)
3299 ent
.setEntityData('DIMTXT', _val
)
3300 _bitpos
, _val
= dwgutil
.get_bit_double(data
, _bitpos
)
3301 ent
.setEntityData('DIMCEN', _val
)
3302 _bitpos
, _val
= dwgutil
.get_bit_double(data
, _bitpos
)
3303 ent
.setEntityData('DIMTSZ', _val
)
3304 _bitpos
, _val
= dwgutil
.get_bit_double(data
, _bitpos
)
3305 ent
.setEntityData('DIMALTF', _val
)
3306 _bitpos
, _val
= dwgutil
.get_bit_double(data
, _bitpos
)
3307 ent
.setEntityData('DIMLFAC', _val
)
3308 _bitpos
, _val
= dwgutil
.get_bit_double(data
, _bitpos
)
3309 ent
.setEntityData('DIMTVP', _val
)
3310 _bitpos
, _val
= dwgutil
.get_bit_double(data
, _bitpos
)
3311 ent
.setEntityData('DIMTFAC', _val
)
3312 _bitpos
, _val
= dwgutil
.get_bit_double(data
, _bitpos
)
3313 ent
.setEntityData('DIMGAP', _val
)
3314 _bitpos
, _val
= dwgutil
.get_bit_double(data
, _bitpos
)
3315 ent
.setEntityData('DIMALTRND', _val
)
3316 _bitpos
, _flag
= dwgutil
.test_bit(data
, _bitpos
)
3317 ent
.setEntityData('DIMALT', _flag
)
3318 _bitpos
, _val
= dwgutil
.get_bit_short(data
, _bitpos
)
3319 ent
.setEntityData('DIMALTD', _val
)
3320 _bitpos
, _flag
= dwgutil
.test_bit(data
, _bitpos
)
3321 ent
.setEntityData('DIMTOFL', _flag
)
3322 _bitpos
, _flag
= dwgutil
.test_bit(data
, _bitpos
)
3323 ent
.setEntityData('DIMSAH', _flag
)
3324 _bitpos
, _flag
= dwgutil
.test_bit(data
, _bitpos
)
3325 ent
.setEntityData('DIMTIX', _flag
)
3326 _bitpos
, _flag
= dwgutil
.test_bit(data
, _bitpos
)
3327 ent
.setEntityData('DIMSOXD', _flag
)
3328 _bitpos
, _val
= dwgutil
.get_bit_short(data
, _bitpos
)
3329 ent
.setEntityData('DIMCLRD', _val
)
3330 _bitpos
, _val
= dwgutil
.get_bit_short(data
, _bitpos
)
3331 ent
.setEntityData('DIMCLRE', _val
)
3332 _bitpos
, _val
= dwgutil
.get_bit_short(data
, _bitpos
)
3333 ent
.setEntityData('DIMCLRT', _val
)
3334 _bitpos
, _val
= dwgutil
.get_bit_short(data
, _bitpos
)
3335 ent
.setEntityData('DIMADEC', _val
)
3336 _bitpos
, _val
= dwgutil
.get_bit_short(data
, _bitpos
)
3337 ent
.setEntityData('DIMDEC', _val
)
3338 _bitpos
, _val
= dwgutil
.get_bit_short(data
, _bitpos
)
3339 ent
.setEntityData('DIMTDEC', _val
)
3340 _bitpos
, _val
= dwgutil
.get_bit_short(data
, _bitpos
)
3341 ent
.setEntityData('DIMALTU', _val
)
3342 _bitpos
, _val
= dwgutil
.get_bit_short(data
, _bitpos
)
3343 ent
.setEntityData('DIMALTTD', _val
)
3344 _bitpos
, _val
= dwgutil
.get_bit_short(data
, _bitpos
)
3345 ent
.setEntityData('DIMAUNIT', _val
)
3346 _bitpos
, _val
= dwgutil
.get_bit_short(data
, _bitpos
)
3347 ent
.setEntityData('DIMFRAC', _val
)
3348 _bitpos
, _val
= dwgutil
.get_bit_short(data
, _bitpos
)
3349 ent
.setEntityData('DIMLUNIT', _val
)
3350 _bitpos
, _val
= dwgutil
.get_bit_short(data
, _bitpos
)
3351 ent
.setEntityData('DIMDSEP', _val
)
3352 _bitpos
, _val
= dwgutil
.get_bit_short(data
, _bitpos
)
3353 ent
.setEntityData('DIMTMOVE', _val
)
3354 _bitpos
, _val
= dwgutil
.get_bit_short(data
, _bitpos
)
3355 ent
.setEntityData('DIMJUST', _val
)
3356 _bitpos
, _flag
= dwgutil
.test_bit(data
, _bitpos
)
3357 ent
.setEntityData('DIMSD1', _flag
)
3358 _bitpos
, _flag
= dwgutil
.test_bit(data
, _bitpos
)
3359 ent
.setEntityData('DIMSD2', _flag
)
3360 _bitpos
, _val
= dwgutil
.get_bit_short(data
, _bitpos
)
3361 ent
.setEntityData('DIMTOLJ', _val
)
3362 _bitpos
, _val
= dwgutil
.get_bit_short(data
, _bitpos
)
3363 ent
.setEntityData('DIMTZIN', _val
)
3364 _bitpos
, _val
= dwgutil
.get_bit_short(data
, _bitpos
)
3365 ent
.setEntityData('DIMALTZ', _val
)
3366 _bitpos
, _val
= dwgutil
.get_bit_short(data
, _bitpos
)
3367 ent
.setEntityData('DIMALTTZ', _val
)
3368 _bitpos
, _flag
= dwgutil
.test_bit(data
, _bitpos
)
3369 ent
.setEntityData('DIMUPT', _flag
)
3370 _bitpos
, _val
= dwgutil
.get_bit_short(data
, _bitpos
)
3371 ent
.setEntityData('DIMFIT', _val
)
3372 _bitpos
, _val
= dwgutil
.get_bit_short(data
, _bitpos
)
3373 ent
.setEntityData('DIMLWD', _val
)
3374 _bitpos
, _val
= dwgutil
.get_bit_short(data
, _bitpos
)
3375 ent
.setEntityData('DIMLWE', _val
)
3376 _bitpos
, _flag
= dwgutil
.test_bit(data
, _bitpos
)
3377 ent
.setEntityData('unknown', _flag
)
3378 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
3379 ent
.setEntityData('dimstyle_control_handle', _handle
)
3380 for _i
in range(_nr
):
3381 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
3382 ent
.addReactor(_handle
)
3383 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
3384 ent
.setXdicobj(_handle
)
3385 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
3386 ent
.setEntityData('null_handle', _handle
)
3387 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
3388 ent
.setEntityData('shapefile_handle', _handle
)
3389 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
3390 ent
.setEntityData('leader_block_handle', _handle
)
3391 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
3392 ent
.setEntityData('dimblk_handle', _handle
)
3393 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
3394 ent
.setEntityData('dimblk1_handle', _handle
)
3395 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
3396 ent
.setEntityData('dimblk2_handle', _handle
)
3398 def vpentity_control_reader(ent
, data
, offset
):
3400 _bitpos
, _nr
= dwgutil
.get_bit_long(data
, _bitpos
)
3401 ent
.setNumReactors(_nr
)
3402 _bitpos
, _ne
= dwgutil
.get_bit_short(data
, _bitpos
)
3403 # print "numentries: %d" % _ne
3404 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
3405 ent
.setEntityData('null_handle', _handle
)
3406 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
3407 ent
.setXdicobj(_handle
)
3410 for _i
in range(_ne
):
3411 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
3412 _handles
.append(_handle
)
3413 ent
.setEntityData('vpentity_handles', _handles
)
3415 def vpentity_reader(ent
, data
, offset
):
3417 _bitpos
, _nr
= dwgutil
.get_bit_long(data
, _bitpos
)
3418 ent
.setNumReactors(_nr
)
3419 _bitpos
, _name
= dwgutil
.get_text_string(data
, _bitpos
)
3420 ent
.setEntityData('name', _name
)
3421 _bitpos
, _flag
= dwgutil
.test_bit(data
, _bitpos
)
3422 ent
.setEntityData('64-flag', _flag
)
3423 _bitpos
, _xrefplus1
= dwgutil
.get_bit_short(data
, _bitpos
)
3424 ent
.setEntityData('xrefplus', _xrefplus1
)
3425 _bitpos
, _xdep
= dwgutil
.test_bit(data
, _bitpos
)
3426 ent
.setEntityData('xdep', _xdep
)
3427 _bitpos
, _flag
= dwgutil
.test_bit(data
, _bitpos
)
3428 ent
.setEntityData('1-flag', _flag
)
3429 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
3430 ent
.setEntityData('vpentity_handle', _handle
)
3431 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
3432 ent
.setXdicobj(_handle
)
3433 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
3434 ent
.setEntityData('null_handle', _handle
)
3435 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
3436 ent
.setEntityData('next_vpentity_handle', _handle
)
3438 def group_reader(ent
, data
, offset
):
3440 _bitpos
, _nr
= dwgutil
.get_bit_long(data
, _bitpos
)
3441 ent
.setNumReactors(_nr
)
3442 _bitpos
, _name
= dwgutil
.get_text_string(data
, _bitpos
)
3443 ent
.setEntityData('name', _name
)
3444 _bitpos
, _unnamed
= dwgutil
.get_bit_short(data
, _bitpos
)
3445 ent
.setEntityData('unnamed', _unnamed
)
3446 _bitpos
, _selectable
= dwgutil
.get_bit_short(data
, _bitpos
)
3447 ent
.setEntityData('selectable', _selectable
)
3448 _bitpos
, _nh
= dwgutil
.get_bit_long(data
, _bitpos
)
3449 # print "numhandles: %d" % _nh
3450 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
3451 ent
.setEntityData('parent_handle', _handle
)
3452 for _i
in range(_nr
):
3453 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
3454 ent
.addReactor(_handle
)
3455 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
3456 ent
.setXdicobj(_handle
)
3459 for _i
in range(_nh
):
3460 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
3461 _handles
.append(_handle
)
3462 ent
.setEntityData('entry_handles', _handles
)
3464 def mlinestyle_reader(ent
, data
, offset
):
3466 _bitpos
, _nr
= dwgutil
.get_bit_long(data
, _bitpos
)
3467 ent
.setNumReactors(_nr
)
3468 _bitpos
, _name
= dwgutil
.get_text_string(data
, _bitpos
)
3469 ent
.setEntityData('name', _name
)
3470 _bitpos
, _desc
= dwgutil
.get_text_string(data
, _bitpos
)
3471 ent
.setEntityData('description', _desc
)
3472 _bitpos
, _flags
= dwgutil
.get_bit_short(data
, _bitpos
)
3473 ent
.setEntityData('flags', _flags
)
3474 _bitpos
, _fc
= dwgutil
.get_bit_short(data
, _bitpos
)
3475 ent
.setEntityData('fill_color', _fc
)
3476 _bitpos
, _sa
= dwgutil
.get_bit_double(data
, _bitpos
)
3477 ent
.setEntityData('start_angle', _sa
)
3478 _bitpos
, _ea
= dwgutil
.get_bit_double(data
, _bitpos
)
3479 ent
.setEntityData('end_angle', _ea
)
3480 _bitpos
, _lc
= dwgutil
.get_raw_char(data
, _bitpos
)
3483 for _i
in range(_lc
):
3484 _bitpos
, _offset
= dwgutil
.get_bit_double(data
, _bitpos
)
3485 _bitpos
, _color
= dwgutil
.get_bit_short(data
, _bitpos
)
3486 _bitpos
, _ltindex
= dwgutil
.get_bit_short(data
, _bitpos
)
3487 _lines
.append((_offset
, _color
, _ltindex
))
3488 ent
.setEntityData('lines', _lines
)
3489 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
3490 ent
.setEntityData('parent_handle', _handle
)
3491 for _i
in range(_nr
):
3492 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
3493 ent
.addReactor(_handle
)
3494 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
3495 ent
.setXdicobj(_handle
)
3497 def dictionaryvar_reader(ent
, data
, offset
):
3499 _bitpos
, _nr
= dwgutil
.get_bit_long(data
, _bitpos
)
3500 ent
.setNumReactors(_nr
)
3501 _bitpos
, _iv
= dwgutil
.get_raw_char(data
, _bitpos
)
3502 ent
.setEntityData('intval', _iv
)
3503 _bitpos
, _s
= dwgutil
.get_text_string(data
, _bitpos
) # spec says bit_short
3504 ent
.setEntityData('string', _s
)
3505 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
3506 ent
.setEntityData('parent_handle', _handle
)
3507 for _i
in range(_nr
):
3508 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
3509 ent
.addReactor(_handle
)
3510 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
3511 ent
.setXdicobj(_handle
)
3513 def hatch_reader(ent
, data
, offset
):
3515 _bitpos
= header_read(ent
, data
, _bitpos
)
3516 _bitpos
, _z
= dwgutil
.get_bit_double(data
, _bitpos
)
3517 ent
.setEntityData('z_coord', _z
)
3518 _bitpos
, _x
= dwgutil
.get_bit_double(data
, _bitpos
)
3519 _bitpos
, _y
= dwgutil
.get_bit_double(data
, _bitpos
)
3520 _bitpos
, _z
= dwgutil
.get_bit_double(data
, _bitpos
)
3521 ent
.setEntityData('extrusion', (_x
, _y
, _z
))
3522 _bitpos
, _name
= dwgutil
.get_text_string(data
, _bitpos
)
3523 ent
.setEntityData('name', _name
)
3524 _bitpos
, _sfill
= dwgutil
.test_bit(data
, _bitpos
)
3525 ent
.setEntityData('solid_fill', _sfill
)
3526 _bitpos
, _assoc
= dwgutil
.test_bit(data
, _bitpos
)
3527 ent
.setEntityData('associative', _assoc
)
3528 _bitpos
, _np
= dwgutil
.get_bit_long(data
, _bitpos
)
3529 # print "numpaths: %d" % _np
3533 for _i
in range(_np
):
3534 _bitpos
, _pf
= dwgutil
.get_bit_long(data
, _bitpos
)
3537 if (_pf
& 0x2): # POLYLINE
3538 _bitpos
, _bulges
= dwgutil
.test_bit(data
, _bitpos
)
3539 _bitpos
, _closed
= dwgutil
.test_bit(data
, _bitpos
)
3540 _bitpos
, _nps
= dwgutil
.get_bit_long(data
, _bitpos
)
3542 for _j
in range(_nps
):
3543 _bitpos
, _x1
= dwgutil
.get_raw_double(data
, _bitpos
)
3544 _bitpos
, _y1
= dwgutil
.get_raw_double(data
, _bitpos
)
3547 _bitpos
, _bulge
= dwgutil
.get_bit_double(data
, _bitpos
)
3548 _segs
.append((_x1
, _y1
, _bulge
))
3549 _paths
.append(('polyline', _segs
))
3551 _bitpos
, _nps
= dwgutil
.get_bit_long(data
, _bitpos
)
3553 for _j
in range(_nps
):
3554 _bitpos
, _pts
= dwgutil
.get_raw_char(data
, _bitpos
)
3555 if (_pts
== 1): # LINE
3556 _bitpos
, _x1
= dwgutil
.get_raw_double(data
, _bitpos
)
3557 _bitpos
, _y1
= dwgutil
.get_raw_double(data
, _bitpos
)
3558 _bitpos
, _x2
= dwgutil
.get_raw_double(data
, _bitpos
)
3559 _bitpos
, _y2
= dwgutil
.get_raw_double(data
, _bitpos
)
3560 _segs
.append(('line', _x1
, _y1
, _x2
, _y2
))
3561 elif (_pts
== 2): # CIRCULAR ARC
3562 _bitpos
, _xc
= dwgutil
.get_raw_double(data
, _bitpos
)
3563 _bitpos
, _yc
= dwgutil
.get_raw_double(data
, _bitpos
)
3564 _bitpos
, _r
= dwgutil
.get_bit_double(data
, _bitpos
)
3565 _bitpos
, _sa
= dwgutil
.get_bit_double(data
, _bitpos
)
3566 _bitpos
, _ea
= dwgutil
.get_bit_double(data
, _bitpos
)
3567 _bitpos
, _isccw
= dwgutil
.test_bit(data
, _bitpos
)
3568 _segs
.append(('arc', _xc
, _yc
, _r
, _sa
, _ea
, _isccw
))
3569 elif (_pts
== 3): # ELLIPTICAL ARC
3570 _bitpos
, _xc
= dwgutil
.get_raw_double(data
, _bitpos
)
3571 _bitpos
, _yc
= dwgutil
.get_raw_double(data
, _bitpos
)
3572 _bitpos
, _xe
= dwgutil
.get_raw_double(data
, _bitpos
)
3573 _bitpos
, _ye
= dwgutil
.get_raw_double(data
, _bitpos
)
3574 _bitpos
, _ratio
= dwgutil
.get_bit_double(data
, _bitpos
)
3575 _bitpos
, _sa
= dwgutil
.get_bit_double(data
, _bitpos
)
3576 _bitpos
, _ea
= dwgutil
.get_bit_double(data
, _bitpos
)
3577 _bitpos
, _isccw
= dwgutil
.test_bit(data
, _bitpos
)
3578 _segs
.append(('elliptical_arc', _xc
, _yc
, _xe
, _ye
, _ratio
, _sa
, _ea
, _isccw
))
3579 elif (_pts
== 4): # SPLINE
3580 _bitpos
, _deg
= dwgutil
.get_bit_long(data
, _bitpos
)
3581 _bitpos
, _israt
= dwgutil
.test_bit(data
, _bitpos
)
3582 _bitpos
, _isper
= dwgutil
.test_bit(data
, _bitpos
)
3583 _bitpos
, _nknots
= dwgutil
.get_bit_long(data
, _bitpos
)
3584 _bitpos
, _nctlpts
= dwgutil
.get_bit_long(data
, _bitpos
)
3586 for _k
in range(_nknots
):
3587 _bitpos
, _knot
= dwgutil
.get_bit_double(data
, _bitpos
)
3588 _knots
.append(_knot
)
3590 for _k
in range(_nctlpts
):
3591 _bitpos
, _x1
= dwgutil
.get_raw_double(data
, _bitpos
)
3592 _bitpos
, _y1
= dwgutil
.get_raw_double(data
, _bitpos
)
3595 _bitpos
, _weight
= dwgutil
.get_bit_double(data
, _bitpos
)
3596 _ctlpts
.append((_x1
, _y1
, _weight
))
3597 _segs
.append(('spline', _israt
, _isper
, _knots
, _ctlpts
))
3599 raise ValueError, "Unexpected path type: %d" % _pts
3600 _paths
.append(('stdpath', _segs
))
3601 _bitpos
, _nbh
= dwgutil
.get_bit_long(data
, _bitpos
)
3602 _allbounds
= _allbounds
+ _nbh
3603 _bitpos
, _style
= dwgutil
.get_bit_short(data
, _bitpos
)
3604 ent
.setEntityData('style', _style
)
3605 _bitpos
, _pattype
= dwgutil
.get_bit_short(data
, _bitpos
)
3606 ent
.setEntityData('pattern_type', _pattype
)
3608 _bitpos
, _angle
= dwgutil
.get_bit_double(data
, _bitpos
)
3609 ent
.setEntityData('fill_angle', _angle
)
3610 _bitpos
, _sos
= dwgutil
.get_bit_double(data
, _bitpos
)
3611 ent
.setEntityData('fill_scale_or_spacing', _sos
)
3612 _bitpos
, _dh
= dwgutil
.test_bit(data
, _bitpos
)
3613 ent
.setEntityData('fill_doublehatch', _dh
)
3614 _bitpos
, _ndf
= dwgutil
.get_bit_short(data
, _bitpos
)
3616 for _i
in range(_ndf
):
3617 _bitpos
, _angle
= dwgutil
.get_bit_double(data
, _bitpos
)
3618 _bitpos
, _x1
= dwgutil
.get_bit_double(data
, _bitpos
)
3619 _bitpos
, _y1
= dwgutil
.get_bit_double(data
, _bitpos
)
3620 _bitpos
, _ox
= dwgutil
.get_bit_double(data
, _bitpos
)
3621 _bitpos
, _oy
= dwgutil
.get_bit_double(data
, _bitpos
)
3622 _bitpos
, _nds
= dwgutil
.get_bit_short(data
, _bitpos
)
3624 for _j
in range(_nds
):
3625 _bitpos
, _dl
= dwgutil
.get_bit_double(data
, _bitpos
)
3627 _lines
.append((_angle
, _x1
, _y1
, _ox
, _oy
, _dashes
))
3628 ent
.setEntityData('fill_lines', _lines
)
3630 _bitpos
, _ps
= dwgutil
.get_bit_double(data
, _bitpos
)
3631 ent
.setEntityData('pixel_size', _ps
)
3632 _bitpos
, _nsp
= dwgutil
.get_bit_long(data
, _bitpos
)
3635 for _i
in range(_nsp
):
3636 _bitpos
, _x
= dwgutil
.get_raw_double(data
, _bitpos
)
3637 _bitpos
, _y
= dwgutil
.get_raw_double(data
, _bitpos
)
3638 _seedpts
.append((_x
, _y
))
3639 ent
.setEntityData('seed_points', _seedpts
)
3640 _bitpos
= tail_read(ent
, data
, _bitpos
)
3643 for _i
in range(_allbounds
):
3644 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
3645 _boundaries
.append(_handle
)
3646 ent
.setEntityData('boundary_handles', _boundaries
)
3648 def idbuffer_reader(ent
, data
, offset
):
3650 _bitpos
, _nr
= dwgutil
.get_bit_long(data
, _bitpos
)
3651 ent
.setNumReactors(_nr
)
3652 _bitpos
, _u
= dwgutil
.get_raw_char(data
, _bitpos
)
3653 # print "unknown char: %#02x" % _u
3654 _bitpos
, _nids
= dwgutil
.get_bit_long(data
, _bitpos
)
3655 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
3656 ent
.setEntityData('parent_handle', _handle
)
3657 for _i
in range(_nr
):
3658 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
3659 ent
.addReactor(_handle
)
3660 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
3661 ent
.setXdicobj(_handle
)
3664 for _i
in range(_nids
):
3665 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
3666 _handles
.append(_handle
)
3667 ent
.setEntityData('objid_handles', _handles
)
3669 def image_reader(ent
, data
, offset
):
3671 _bitpos
= header_read(ent
, data
, _bitpos
)
3672 _bitpos
, _val
= dwgutil
.get_bit_long(data
, _bitpos
)
3673 ent
.setEntityData('class_version', _val
)
3674 _bitpos
, _x
= dwgutil
.get_bit_double(data
, _bitpos
)
3675 _bitpos
, _y
= dwgutil
.get_bit_double(data
, _bitpos
)
3676 _bitpos
, _z
= dwgutil
.get_bit_double(data
, _bitpos
)
3677 ent
.setEntityData('pt0', (_x
, _y
, _z
))
3678 _bitpos
, _x
= dwgutil
.get_bit_double(data
, _bitpos
)
3679 _bitpos
, _y
= dwgutil
.get_bit_double(data
, _bitpos
)
3680 _bitpos
, _z
= dwgutil
.get_bit_double(data
, _bitpos
)
3681 ent
.setEntityData('uvec', (_x
, _y
, _z
))
3682 _bitpos
, _x
= dwgutil
.get_bit_double(data
, _bitpos
)
3683 _bitpos
, _y
= dwgutil
.get_bit_double(data
, _bitpos
)
3684 _bitpos
, _z
= dwgutil
.get_bit_double(data
, _bitpos
)
3685 ent
.setEntityData('vvec', (_x
, _y
, _z
))
3686 _bitpos
, _val
= dwgutil
.get_raw_double(data
, _bitpos
)
3687 ent
.setEntityData('height', _val
)
3688 _bitpos
, _val
= dwgutil
.get_raw_double(data
, _bitpos
)
3689 ent
.setEntityData('width', _val
)
3690 _bitpos
, _val
= dwgutil
.get_bit_short(data
, _bitpos
)
3691 ent
.setEntityData('display_props', _val
)
3692 _bitpos
, _flag
= dwgutil
.test_bit(data
, _bitpos
)
3693 ent
.setEntityData('clipping', _flag
)
3694 _bitpos
, _val
= dwgutil
.get_raw_char(data
, _bitpos
)
3695 ent
.setEntityData('brightness', _val
)
3696 _bitpos
, _val
= dwgutil
.get_raw_char(data
, _bitpos
)
3697 ent
.setEntityData('contrast', _val
)
3698 _bitpos
, _val
= dwgutil
.get_raw_char(data
, _bitpos
)
3699 ent
.setEntityData('fade', _val
)
3700 _bitpos
, _cbt
= dwgutil
.get_bit_short(data
, _bitpos
)
3701 ent
.setEntityData('clip_type', _cbt
)
3703 _bitpos
, _x
= dwgutil
.get_raw_double(data
, _bitpos
)
3704 _bitpos
, _y
= dwgutil
.get_raw_double(data
, _bitpos
)
3705 ent
.setEntityData('corner1', (_x
, _y
))
3706 _bitpos
, _x
= dwgutil
.get_raw_double(data
, _bitpos
)
3707 _bitpos
, _y
= dwgutil
.get_raw_double(data
, _bitpos
)
3708 ent
.setEntityData('corner2', (_x
, _y
))
3710 _bitpos
, _ncv
= dwgutil
.get_bit_long(data
, _bitpos
)
3712 for _i
in range(_ncv
):
3713 _bitpos
, _x
= dwgutil
.get_raw_double(data
, _bitpos
)
3714 _bitpos
, _y
= dwgutil
.get_raw_double(data
, _bitpos
)
3715 _verts
.append((_x
, _y
))
3716 ent
.setEntityData('vertices', _verts
)
3717 _bitpos
= tail_read(ent
, data
, _bitpos
)
3718 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
3719 ent
.setEntityData('imagedef_handle', _handle
)
3720 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
3721 ent
.setEntityData('imagedef_reactor_handle', _handle
)
3723 def imagedef_reader(ent
, data
, offset
):
3725 _bitpos
, _nr
= dwgutil
.get_bit_long(data
, _bitpos
)
3726 ent
.setNumReactors(_nr
)
3727 _bitpos
, _clsver
= dwgutil
.get_bit_long(data
, _bitpos
)
3728 ent
.setEntityData('class_version', _clsver
)
3729 _bitpos
, _val
= dwgutil
.get_raw_double(data
, _bitpos
)
3730 ent
.setEntityData('width', _val
)
3731 _bitpos
, _h
= dwgutil
.get_raw_double(data
, _bitpos
)
3732 ent
.setEntityData('height', _val
)
3733 _bitpos
, _filepath
= dwgutil
.get_text_string(data
, _bitpos
)
3734 ent
.setEntityData('filepath', _filepath
)
3735 _bitpos
, _isloaded
= dwgutil
.test_bit(data
, _bitpos
)
3736 ent
.setEntityData('is_loaded', _isloaded
)
3737 _bitpos
, _res
= dwgutil
.get_raw_char(data
, _bitpos
)
3738 ent
.setEntityData('res_units', _res
)
3739 _bitpos
, _val
= dwgutil
.get_raw_double(data
, _bitpos
)
3740 ent
.setEntityData('pixel_width', _val
)
3741 _bitpos
, _val
= dwgutil
.get_raw_double(data
, _bitpos
)
3742 ent
.setEntityData('pixel_height', _val
)
3743 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
3744 ent
.setEntityData('parent_handle', _handle
)
3745 for _i
in range(_nr
):
3746 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
3747 ent
.addReactor(_handle
)
3748 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
3749 ent
.setXdicobj(_handle
)
3751 def imagedefreactor_reader(ent
, data
, offset
):
3753 _bitpos
, _nr
= dwgutil
.get_bit_long(data
, _bitpos
)
3754 ent
.setNumReactors(_nr
)
3755 _bitpos
, _clsver
= dwgutil
.get_bit_long(data
, _bitpos
)
3756 ent
.setEntityData('class version', _clsver
)
3757 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
3758 ent
.setEntityData('parent_handle', _handle
)
3759 for _i
in range(_nr
):
3760 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
3761 ent
.addReactor(_handle
)
3762 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
3763 ent
.setXdicobj(_handle
)
3765 def layer_index_reader(ent
, data
, offset
):
3767 _bitpos
, _nr
= dwgutil
.get_bit_long(data
, _bitpos
)
3768 ent
.setNumReactors(_nr
)
3769 _bitpos
, _ts1
= dwgutil
.get_bit_long(data
, _bitpos
)
3770 ent
.setEntityData('timestamp1', _ts1
)
3771 _bitpos
, _ts2
= dwgutil
.get_bit_long(data
, _bitpos
)
3772 ent
.setEntityData('timestamp2', _ts2
)
3773 _bitpos
, _ne
= dwgutil
.get_bit_long(data
, _bitpos
)
3776 for _i
in range(_ne
):
3777 _bitpos
, _il
= dwgutil
.get_bit_long(data
, _bitpos
)
3778 _bitpos
, _is
= dwgutil
.get_text_string(data
, _bitpos
)
3779 _indicies
.append((_il
, _is
))
3780 ent
.setEntityData('index_handles', _indicies
)
3781 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
3782 ent
.setEntityData('parent_handle', _handle
)
3783 for _i
in range(_nr
):
3784 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
3785 ent
.addReactor(_handle
)
3786 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
3787 ent
.setXdicobj(_handle
)
3790 for _i
in range(_ne
):
3791 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
3792 _entries
.append(_handle
)
3793 ent
.setEntityData('entry_handles', _entries
)
3795 def layout_reader(ent
, data
, offset
):
3797 _bitpos
, _nr
= dwgutil
.get_bit_long(data
, _bitpos
)
3798 ent
.setNumReactors(_nr
)
3799 _bitpos
, _string
= dwgutil
.get_text_string(data
, _bitpos
)
3800 ent
.setEntityData('page_setup_name', _string
)
3801 _bitpos
, _string
= dwgutil
.get_text_string(data
, _bitpos
)
3802 ent
.setEntityData('printer_config', _string
)
3803 _bitpos
, _val
= dwgutil
.get_bit_short(data
, _bitpos
)
3804 ent
.setEntityData('plot_layout_flags', _val
)
3805 _bitpos
, _lm
= dwgutil
.get_bit_double(data
, _bitpos
)
3806 _bitpos
, _bm
= dwgutil
.get_bit_double(data
, _bitpos
)
3807 _bitpos
, _rm
= dwgutil
.get_bit_double(data
, _bitpos
)
3808 _bitpos
, _tm
= dwgutil
.get_bit_double(data
, _bitpos
)
3809 ent
.setEntityData('margins', (_lm
, _bm
, _rm
, _tm
))
3810 _bitpos
, _pw
= dwgutil
.get_bit_double(data
, _bitpos
)
3811 _bitpos
, _ph
= dwgutil
.get_bit_double(data
, _bitpos
)
3812 ent
.setEntityData('paper_dim', (_pw
, _ph
))
3813 _bitpos
, _string
= dwgutil
.get_text_string(data
, _bitpos
)
3814 ent
.setEntityData('paper_size', _string
)
3815 _bitpos
, _x
= dwgutil
.get_bit_double(data
, _bitpos
)
3816 _bitpos
, _y
= dwgutil
.get_bit_double(data
, _bitpos
)
3817 ent
.setEntityData('plot_origin', (_x
, _y
))
3818 _bitpos
, _val
= dwgutil
.get_bit_short(data
, _bitpos
)
3819 ent
.setEntityData('paper_units', _val
)
3820 _bitpos
, _val
= dwgutil
.get_bit_short(data
, _bitpos
)
3821 ent
.setEntityData('plot_rotation', _val
)
3822 _bitpos
, _val
= dwgutil
.get_bit_short(data
, _bitpos
)
3823 ent
.setEntityData('plot_type', _val
)
3824 _bitpos
, _x
= dwgutil
.get_bit_double(data
, _bitpos
)
3825 _bitpos
, _y
= dwgutil
.get_bit_double(data
, _bitpos
)
3826 ent
.setEntityData('window_min', (_x
, _y
))
3827 _bitpos
, _x
= dwgutil
.get_bit_double(data
, _bitpos
)
3828 _bitpos
, _y
= dwgutil
.get_bit_double(data
, _bitpos
)
3829 ent
.setEntityData('window_max', (_x
, _y
))
3830 _bitpos
, _string
= dwgutil
.get_text_string(data
, _bitpos
)
3831 ent
.setEntityData('plot_view_name', _string
)
3832 _bitpos
, _val
= dwgutil
.get_bit_double(data
, _bitpos
)
3833 ent
.setEntityData('real_world_units', _val
)
3834 _bitpos
, _val
= dwgutil
.get_bit_double(data
, _bitpos
)
3835 ent
.setEntityData('drawing_units', _val
)
3836 _bitpos
, _string
= dwgutil
.get_text_string(data
, _bitpos
)
3837 ent
.setEntityData('current_style_sheet', _string
)
3838 _bitpos
, _val
= dwgutil
.get_bit_short(data
, _bitpos
)
3839 ent
.setEntityData('scale_type', _val
)
3840 _bitpos
, _val
= dwgutil
.get_bit_double(data
, _bitpos
)
3841 ent
.setEntityData('scale_factor', _val
)
3842 _bitpos
, _x
= dwgutil
.get_bit_double(data
, _bitpos
)
3843 _bitpos
, _y
= dwgutil
.get_bit_double(data
, _bitpos
)
3844 ent
.setEntityData('paper_image_origin', (_x
, _y
))
3845 _bitpos
, _string
= dwgutil
.get_text_string(data
, _bitpos
)
3846 ent
.setEntityData('layout_name', _string
)
3847 _bitpos
, _val
= dwgutil
.get_bit_short(data
, _bitpos
)
3848 ent
.setEntityData('tab_order', _val
)
3849 _bitpos
, _val
= dwgutil
.get_bit_short(data
, _bitpos
)
3850 ent
.setEntityData('layout_flag', _val
)
3851 _bitpos
, _x
= dwgutil
.get_bit_double(data
, _bitpos
)
3852 _bitpos
, _y
= dwgutil
.get_bit_double(data
, _bitpos
)
3853 _bitpos
, _z
= dwgutil
.get_bit_double(data
, _bitpos
)
3854 ent
.setEntityData('ucs_origin', (_x
, _y
, _z
))
3855 _bitpos
, _x
= dwgutil
.get_raw_double(data
, _bitpos
)
3856 _bitpos
, _y
= dwgutil
.get_raw_double(data
, _bitpos
)
3857 ent
.setEntityData('layout_minima', (_x
, _y
))
3858 _bitpos
, _x
= dwgutil
.get_raw_double(data
, _bitpos
)
3859 _bitpos
, _y
= dwgutil
.get_raw_double(data
, _bitpos
)
3860 ent
.setEntityData('layout_maxima', (_x
, _y
))
3861 _bitpos
, _x
= dwgutil
.get_bit_double(data
, _bitpos
)
3862 _bitpos
, _y
= dwgutil
.get_bit_double(data
, _bitpos
)
3863 _bitpos
, _z
= dwgutil
.get_bit_double(data
, _bitpos
)
3864 ent
.setEntityData('ins_point', (_x
, _y
, _z
))
3865 _bitpos
, _x
= dwgutil
.get_bit_double(data
, _bitpos
)
3866 _bitpos
, _y
= dwgutil
.get_bit_double(data
, _bitpos
)
3867 _bitpos
, _z
= dwgutil
.get_bit_double(data
, _bitpos
)
3868 ent
.setEntityData('ucs_x_axis', (_x
, _y
, _z
))
3869 _bitpos
, _x
= dwgutil
.get_bit_double(data
, _bitpos
)
3870 _bitpos
, _y
= dwgutil
.get_bit_double(data
, _bitpos
)
3871 _bitpos
, _z
= dwgutil
.get_bit_double(data
, _bitpos
)
3872 ent
.setEntityData('ucs_y_axis', (_x
, _y
, _z
))
3873 _bitpos
, _val
= dwgutil
.get_bit_double(data
, _bitpos
)
3874 ent
.setEntityData('elevation', _val
)
3875 _bitpos
, _val
= dwgutil
.get_bit_short(data
, _bitpos
)
3876 ent
.setEntityData('orthoview_type', _val
)
3877 _bitpos
, _x
= dwgutil
.get_bit_double(data
, _bitpos
)
3878 _bitpos
, _y
= dwgutil
.get_bit_double(data
, _bitpos
)
3879 _bitpos
, _z
= dwgutil
.get_bit_double(data
, _bitpos
)
3880 ent
.setEntityData('extmin', (_x
, _y
, _z
))
3881 _bitpos
, _x
= dwgutil
.get_bit_double(data
, _bitpos
)
3882 _bitpos
, _y
= dwgutil
.get_bit_double(data
, _bitpos
)
3883 _bitpos
, _z
= dwgutil
.get_bit_double(data
, _bitpos
)
3884 ent
.setEntityData('extmax', (_x
, _y
, _z
))
3885 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
3886 ent
.setEntityData('parent_handle', _handle
)
3887 for _i
in range(_nr
):
3888 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
3889 ent
.addReactor(_handle
)
3890 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
3891 ent
.setXdicobj(_handle
)
3892 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
3893 ent
.setEntityData('paperspace_block_handle', _handle
)
3894 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
3895 ent
.setEntityData('last_active_viewport_handle', _handle
)
3896 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
3897 ent
.setEntityData('base_ucs_handle', _handle
)
3898 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
3899 ent
.setEntityData('named_ucs_handle', _handle
)
3901 def lwpline_reader(ent
, data
, offset
):
3903 _bitpos
= header_read(ent
, data
, _bitpos
)
3904 _bitpos
, _flag
= dwgutil
.get_bit_short(data
, _bitpos
)
3905 ent
.setEntityData('flag', _flag
)
3908 _bitpos
, _cw
= dwgutil
.get_bit_double(data
, _bitpos
)
3909 ent
.setEntityData('const_width', _cw
)
3912 _bitpos
, _elev
= dwgutil
.get_bit_double(data
, _bitpos
)
3913 ent
.setEntityData('elevation', _elev
)
3916 _bitpos
, _th
= dwgutil
.get_bit_double(data
, _bitpos
)
3917 ent
.setEntityData('thickness', _th
)
3918 _nx
= _ny
= _nz
= 0.0
3920 _bitpos
, _nx
= dwgutil
.get_bit_double(data
, _bitpos
)
3921 _bitpos
, _ny
= dwgutil
.get_bit_double(data
, _bitpos
)
3922 _bitpos
, _nz
= dwgutil
.get_bit_double(data
, _bitpos
)
3923 ent
.setEntityData('normal', (_nx
, _ny
, _nz
))
3924 _bitpos
, _np
= dwgutil
.get_bit_long(data
, _bitpos
)
3927 _bitpos
, _nb
= dwgutil
.get_bit_long(data
, _bitpos
)
3930 _bitpos
, _nw
= dwgutil
.get_bit_long(data
, _bitpos
)
3932 _bitpos
, _vx
= dwgutil
.get_raw_double(data
, _bitpos
)
3933 _bitpos
, _vy
= dwgutil
.get_raw_double(data
, _bitpos
)
3934 # print "first vertex: (%g,%g)" % (_vx, _vy)
3935 _verticies
.append((_vx
, _vy
))
3936 for _i
in range((_np
- 1)):
3937 _bitpos
, _x
= dwgutil
.get_default_double(data
, _bitpos
, _vx
)
3938 _bitpos
, _y
= dwgutil
.get_default_double(data
, _bitpos
, _vy
)
3939 _verticies
.append((_x
, _y
))
3942 ent
.setEntityData('verticies', _verticies
)
3945 for _i
in range(_nb
):
3946 _bitpos
, _bulge
= dwgutil
.get_raw_double(data
, _bitpos
)
3947 _bulges
.append(_bulge
)
3948 ent
.setEntityData('bulges', _bulges
)
3951 for _i
in range(_nw
):
3952 _bitpos
, _sw
= dwgutil
.get_bit_double(data
, _bitpos
)
3953 _bitpos
, _ew
= dwgutil
.get_bit_double(data
, _bitpos
)
3954 _widths
.append((_sw
, _ew
))
3955 ent
.setEntityData('widths', _widths
)
3956 _bitpos
= tail_read(ent
, data
, _bitpos
)
3958 def rastervariables_reader(ent
, data
, offset
):
3960 _bitpos
, _nr
= dwgutil
.get_bit_long(data
, _bitpos
)
3961 ent
.setNumReactors(_nr
)
3962 _bitpos
, _clsver
= dwgutil
.get_bit_long(data
, _bitpos
)
3963 ent
.setEntityData('class_version', _clsver
)
3964 _bitpos
, _df
= dwgutil
.get_bit_short(data
, _bitpos
)
3965 ent
.setEntityData('dispfrm', _df
)
3966 _bitpos
, _dq
= dwgutil
.get_bit_short(data
, _bitpos
)
3967 ent
.setEntityData('dispqual', _dq
)
3968 _bitpos
, _units
= dwgutil
.get_bit_short(data
, _bitpos
)
3969 ent
.setEntityData('units', _units
)
3970 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
3971 ent
.setEntityData('parent_handle', _handle
)
3972 for _i
in range(_nr
):
3973 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
3974 ent
.addReactor(_handle
)
3975 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
3976 ent
.setXdicobj(_handle
)
3978 def sortentstable_reader(ent
, data
, offset
):
3980 _bitpos
, _nr
= dwgutil
.get_bit_long(data
, _bitpos
)
3981 ent
.setNumReactors(_nr
)
3982 _bitpos
, _ne
= dwgutil
.get_bit_long(data
, _bitpos
)
3983 # print "numentries: %d" % _ne
3986 for _i
in range(_ne
):
3987 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
3988 _handles
.append(_handle
)
3989 ent
.setEntityData('sort_handles', _handles
)
3990 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
3991 ent
.setEntityData('parent_handle', _handle
)
3992 for _i
in range(_nr
):
3993 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
3994 ent
.addReactor(_handle
)
3995 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
3996 ent
.setXdicobj(_handle
)
3998 # the spec says there is an owner handle here
4000 # _bitpos, _handle = dwgutil.get_handle(data, _bitpos)
4001 # print "owner handle: " + str(_handle)
4004 for _i
in range(_ne
):
4005 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
4006 _handles
.append(_handle
)
4007 ent
.setEntityData('obj_handles', _handles
)
4009 def spatial_filter_reader(ent
, data
, offset
):
4011 _bitpos
, _nr
= dwgutil
.get_bit_long(data
, _bitpos
)
4012 ent
.setNumReactors(_nr
)
4013 _bitpos
, _npts
= dwgutil
.get_bit_short(data
, _bitpos
)
4016 for _i
in range(_npts
):
4017 _bitpos
, _x
= dwgutil
.get_raw_double(data
, _bitpos
)
4018 _bitpos
, _y
= dwgutil
.get_raw_double(data
, _bitpos
)
4019 _points
.append((_x
, _y
))
4020 ent
.setEntityData('points', _points
)
4021 _bitpos
, _ex
= dwgutil
.get_bit_double(data
, _bitpos
)
4022 _bitpos
, _ey
= dwgutil
.get_bit_double(data
, _bitpos
)
4023 _bitpos
, _ez
= dwgutil
.get_bit_double(data
, _bitpos
)
4024 ent
.setEntityData('extrusion', (_ex
, _ey
, _ez
))
4025 _bitpos
, _cx
= dwgutil
.get_bit_double(data
, _bitpos
)
4026 _bitpos
, _cy
= dwgutil
.get_bit_double(data
, _bitpos
)
4027 _bitpos
, _cz
= dwgutil
.get_bit_double(data
, _bitpos
)
4028 ent
.setEntityData('clip_bound_origin', (_cx
, _cy
, _cz
))
4029 _bitpos
, _db
= dwgutil
.get_bit_short(data
, _bitpos
)
4030 ent
.setEntityData('disp_bound', _db
)
4031 _bitpos
, _fc
= dwgutil
.get_bit_short(data
, _bitpos
)
4032 ent
.setEntityData('front_clip_on', _fc
)
4033 _bitpos
, _fd
= dwgutil
.get_bit_double(data
, _bitpos
)
4034 ent
.setEntityData('front_dist', _fd
)
4035 _bitpos
, _bc
= dwgutil
.get_bit_short(data
, _bitpos
)
4036 ent
.setEntityData('back_clip_on', _bc
)
4037 _bitpos
, _bd
= dwgutil
.get_bit_double(data
, _bitpos
)
4038 ent
.setEntityData('back_dist', _bd
)
4039 _invtr
= array
.array('d', 12 * [0.0])
4040 for _i
in range(12):
4041 _bitpos
, _invtr
[_i
] = dwgutil
.get_bit_double(data
, _bitpos
)
4042 ent
.setEntityData('inv_array', _invtr
)
4043 _clptr
= array
.array('d', 12 * [0.0])
4044 for _i
in range(12):
4045 _bitpos
, _clptr
[_i
] = dwgutil
.get_bit_double(data
, _bitpos
)
4046 ent
.setEntityData('clip_array', _clptr
)
4047 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
4048 ent
.setEntityData('parent_handle', _handle
)
4049 for _i
in range(_nr
):
4050 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
4051 ent
.addReactor(_handle
)
4052 _bitpos
, _handle
= dwgutil
.get_handle(data
, _bitpos
)
4053 ent
.setXdicobj(_handle
)
4055 def spatial_index_reader(ent
, data
, offset
):
4057 _bitpos
, _nr
= dwgutil
.get_bit_long(data
, _bitpos
)
4058 ent
.setNumReactors(_nr
)
4059 _bitpos
, _ts1
= dwgutil
.get_bit_long(data
, _bitpos
)
4060 ent
.setEntityData('timestamp1', _ts1
)
4061 _bitpos
, _ts2
= dwgutil
.get_bit_long(data
, _bitpos
)
4062 ent
.setEntityData('timestamp2', _ts2
)
4064 # fixme - lots of unknown stuff here
4067 def xrecord_reader(ent
, data
, offset
):
4069 _bitpos
, _nr
= dwgutil
.get_bit_long(data
, _bitpos
)
4070 ent
.setNumReactors(_nr
)
4071 _bitpos
, _ndb
= dwgutil
.get_bit_long(data
, _bitpos
)
4072 ent
.setEntityData('data_bytes', _ndb
)
4074 # fixme - more stuff here ...
4078 (False, None), # Unused [0x00]
4079 (True, text_reader
), # Text
4080 (True, attrib_reader
), # Attrib
4081 (True, attdef_reader
), # Attdef
4082 (True, block_reader
), # Block
4083 (True, endblk_reader
), # Endblk
4084 (True, seqend_reader
), # Seqend
4085 (True, insert_reader
), # Insert
4086 (True, minsert_reader
), # Minsert [0x08]
4087 (False, None), # Skipped [0x09]
4088 (True, vertex2d_reader
), # Vertex_2D
4089 (True, vertex3d_reader
), # Vertex_3D
4090 (True, vertex_mesh_reader
), # Vertex_mesh
4091 (True, vertex_pface_reader
), # Vertex_pface
4092 (True, vertex_pface_face_reader
), # Vertex_pface_face
4093 (True, polyline2d_reader
), # Polyline_2D
4094 (True, polyline3d_reader
), # Polyline_3D [0x10]
4095 (True, arc_reader
), # Arc,
4096 (True, circle_reader
), # Circle,
4097 (True, line_reader
), # Line
4098 (True, dimord_reader
), # Dimension_ord
4099 (True, dimlin_reader
), # Dimension_lin
4100 (True, dimalign_reader
), # Dimension_align
4101 (True, dimang3p_reader
), # Dimension_angle_3pt
4102 (True, dimang2l_reader
), # Dimension_angle_2ln [0x18]
4103 (True, dimrad_reader
), # Dimension_radius
4104 (True, dimdia_reader
), # Dimension_diameter
4105 (True, point_reader
), # Point
4106 (True, face3d_reader
), # Face3D
4107 (True, pface_reader
), # Polyline_pface
4108 (True, mesh_reader
), # Polyline_mesh
4109 (True, solid_reader
), # Solid
4110 (True, trace_reader
), # Trace [0x20]
4111 (True, shape_reader
), # Shape
4112 (True, viewport_reader
), # Viewport
4113 (True, ellipse_reader
), # Ellipse
4114 (True, spline_reader
), # Spline
4115 (True, rsb_reader
), # Region
4116 (True, rsb_reader
), # Solid3D
4117 (True, rsb_reader
), # Body
4118 (True, ray_reader
), # Ray [0x28]
4119 (True, xline_reader
), # Xline
4120 (False, dict_reader
), # Dictionary
4121 (False, None), # Skipped [0x2b]
4122 (True, mtext_reader
), # Mtext
4123 (True, leader_reader
), # Leader
4124 (True, tolerance_reader
), # Tolerance
4125 (True, mline_reader
), # Mline
4126 (False, block_control_reader
), # Block control [0x30]
4127 (False, block_header_reader
), # Block header
4128 (False, layer_control_reader
), # Layer control
4129 (False, layer_reader
), # Layer
4130 (False, shapefile_control_reader
), # Style control
4131 (False, shapefile_reader
), # Style
4132 (False, None), # Skipped [0x36]
4133 (False, None), # Skipped [0x37]
4134 (False, linetype_control_reader
), # Linetype control [0x38]
4135 (False, linetype_reader
), # Linetype
4136 (False, None), # Skipped [0x3a]
4137 (False, None), # Skipped [0x3b]
4138 (False, view_control_reader
), # View control [0x3c]
4139 (False, view_reader
), # View
4140 (False, ucs_control_reader
), # UCS control,
4141 (False, ucs_reader
), # UCS
4142 (False, vport_control_reader
), # Vport control [0x40]
4143 (False, vport_reader
), # Vport
4144 (False, appid_control_reader
), # Appid control
4145 (False, appid_reader
), # Appid
4146 (False, dimstyle_control_reader
), # Dimstyle control
4147 (False, dimstyle_reader
), # Dimstyle
4148 (False, vpentity_control_reader
), # VP ENT HDR control
4149 (False, vpentity_reader
), # VP ENT HDR
4150 (False, group_reader
), # Group [0x48]
4151 (False, mlinestyle_reader
), # Mlinestyle
4155 'DICTIONARYVAR' : dictionaryvar_reader
,
4156 'HATCH' : hatch_reader
,
4157 'IDBUFFER' : idbuffer_reader
,
4158 'IMAGE' : image_reader
,
4159 'IMAGEDEF' : imagedef_reader
,
4160 'IMAGEDEFREACTOR' : imagedefreactor_reader
,
4161 'LAYER_INDEX' : layer_index_reader
,
4162 'LAYOUT' : layout_reader
,
4163 'LWPLINE' : lwpline_reader
,
4164 # 'OLE2FRAME' : ole2frame_reader,
4165 'RASTERVARIABLES' : rastervariables_reader
,
4166 'SORTENTSTABLE' : sortentstable_reader
,
4167 'SPATIAL_FILTER' : spatial_filter_reader
,
4168 'SPATIAL_INDEX' : spatial_index_reader
,
4169 'XRECORD' : xrecord_reader
4172 def get_object(dwg
, offset
):
4173 _handle
= dwg
.getHandle()
4174 _handle
.seek(offset
, 0)
4175 _size
= dwgutil
.get_modular_short(_handle
)
4176 _data
= array
.array('B')
4177 _data
.fromfile(_handle
, _size
)
4178 _ent
= dwgbase
.dwgEntity()
4179 # _ent.setEntityData('bitstream', data) # save the bitstream data
4181 _bitpos
, _type
= dwgutil
.get_bit_short(_data
, _bitpos
)
4183 _bitpos
, _objbsize
= dwgutil
.get_raw_long(_data
, _bitpos
)
4184 _ent
.setEntityData('size_in_bits', _objbsize
)
4185 _bitpos
, _handle
= dwgutil
.get_handle(_data
, _bitpos
)
4186 _ent
.setHandle(_handle
)
4187 _bitpos
, _extdata
= dwgutil
.read_extended_data(_data
, _bitpos
)
4188 _ent
.setEntityData('extended_data', _extdata
)
4190 # use the objprops table to determine if the _entity
4191 # has a graphics bit and the appropriate bitstream
4196 if _type
< len(_objprops
):
4197 _gflag
, _reader
= _objprops
[_type
]
4199 _bitpos
, _val
= dwgutil
.test_bit(_data
, _bitpos
)
4201 _bitpos
, _size
= dwgutil
.get_raw_long(_data
, _bitpos
)
4203 _gidata
= dwgutil
.get_bits(_data
, _bgsize
, _bitpos
)
4204 _ent
.setEntityData('graphic_data', _gidata
)
4205 _bitpos
= _bitpos
+ _bgsize
4206 if _reader
is not None:
4207 _reader(_ent
, _data
, _bitpos
)
4209 _stype
= dwg
.getDxfName(_type
)
4210 if _stype
is not None:
4211 if _stype
== 'HATCH': # where is the data kept?
4212 _bitpos
, _val
= dwgutil
.test_bit(_data
, _bitpos
)
4213 if _stype
in _vobjmap
:
4214 _vobjmap
[_stype
](_ent
, _data
, _bitpos
)
4217 def read_second_header(handle
, offset
):
4218 # print "read_second_header() ..."
4219 handle
.seek(offset
, 0)
4221 # print "offset at %d [%#x]" % (_at, _at)
4222 _s
= array
.array('B')
4223 _s
.fromfile(handle
, 16)
4224 if _s
[0] != 0xd4: raise ValueError, "_s[0] != 0xd4"
4225 if _s
[1] != 0x7b: raise ValueError, "_s[1] != 0x7b"
4226 if _s
[2] != 0x21: raise ValueError, "_s[2] != 0x21"
4227 if _s
[3] != 0xce: raise ValueError, "_s[3] != 0xce"
4228 if _s
[4] != 0x28: raise ValueError, "_s[4] != 0x28"
4229 if _s
[5] != 0x93: raise ValueError, "_s[5] != 0x93"
4230 if _s
[6] != 0x9f: raise ValueError, "_s[6] != 0x9f"
4231 if _s
[7] != 0xbf: raise ValueError, "_s[7] != 0xbf"
4232 if _s
[8] != 0x53: raise ValueError, "_s[8] != 0x53"
4233 if _s
[9] != 0x24: raise ValueError, "_s[9] != 0x24"
4234 if _s
[10] != 0x40: raise ValueError, "_s[10] != 0x40"
4235 if _s
[11] != 0x09: raise ValueError, "_s[11] != 0x09"
4236 if _s
[12] != 0x12: raise ValueError, "_s[12] != 0x12"
4237 if _s
[13] != 0x3c: raise ValueError, "_s[13] != 0x3c"
4238 if _s
[14] != 0xaa: raise ValueError, "_s[14] != 0xaa"
4239 if _s
[15] != 0x01: raise ValueError, "_s[15] != 0x01"
4240 # _at = handle.tell()
4241 # print "offset at %d [%#x]" % (_at, _at)
4242 _size
= struct
.unpack('<l', handle
.read(4))[0]
4243 # print "section size: %d" % _size
4245 # print "second header data offset at %d [%#x]" % (_at, _at)
4246 _data
= array
.array('B')
4247 _data
.fromfile(handle
, (_size
- 4)) # size includes itself in byte count
4248 # _at = handle.tell()
4249 # print "offset at %d [%#x]" % (_at, _at)
4250 _s
.fromfile(handle
, 16)
4251 if _s
[16] != 0x2b: raise ValueError, "_s[16] != 0x2b"
4252 if _s
[17] != 0x84: raise ValueError, "_s[17] != 0x84"
4253 if _s
[18] != 0xde: raise ValueError, "_s[18] != 0xde"
4254 if _s
[19] != 0x31: raise ValueError, "_s[19] != 0x31"
4255 if _s
[20] != 0xd7: raise ValueError, "_s[20] != 0xd7"
4256 if _s
[21] != 0x6c: raise ValueError, "_s[21] != 0x6c"
4257 if _s
[22] != 0x60: raise ValueError, "_s[22] != 0x60"
4258 if _s
[23] != 0x40: raise ValueError, "_s[23] != 0x40"
4259 if _s
[24] != 0xac: raise ValueError, "_s[24] != 0xac"
4260 if _s
[25] != 0xdb: raise ValueError, "_s[25] != 0xdb"
4261 if _s
[26] != 0xbf: raise ValueError, "_s[26] != 0xbf"
4262 if _s
[27] != 0xf6: raise ValueError, "_s[27] != 0xf6"
4263 if _s
[28] != 0xed: raise ValueError, "_s[28] != 0xed"
4264 if _s
[29] != 0xc3: raise ValueError, "_s[29] != 0xc3"
4265 if _s
[30] != 0x55: raise ValueError, "_s[30] != 0x55"
4266 if _s
[31] != 0xfe: raise ValueError, "_s[31] != 0xfe"
4268 # print "offset at %d [%#x]" % (_at, _at)
4271 def decode_second_header(data
):
4272 # print "decode_second_header() ..."
4275 _bitpos
, _loc
= dwgutil
.get_bit_long(data
, _bitpos
)
4276 # print "location: %d" % _loc
4277 # print "bitpos: %d" % _bitpos
4278 _bitpos
, _char
= dwgutil
.get_raw_char(data
, _bitpos
)
4279 # print "char: %#x" % _char # A
4280 _bitpos
, _char
= dwgutil
.get_raw_char(data
, _bitpos
)
4281 # print "char: %#x" % _char # C
4282 _bitpos
, _char
= dwgutil
.get_raw_char(data
, _bitpos
)
4283 # print "char: %#x" % _char # 1
4284 _bitpos
, _char
= dwgutil
.get_raw_char(data
, _bitpos
)
4285 # print "char: %#x" % _char # 0
4286 _bitpos
, _char
= dwgutil
.get_raw_char(data
, _bitpos
)
4287 # print "char: %#x" % _char # 1
4288 _bitpos
, _char
= dwgutil
.get_raw_char(data
, _bitpos
)
4289 # print "char: %#x" % _char # 2 or 4
4290 # print "bitpos: %d" % _bitpos
4291 _bitpos
, _char
= dwgutil
.get_raw_char(data
, _bitpos
)
4292 # print "char: %#x" % _char # 0
4293 _bitpos
, _char
= dwgutil
.get_raw_char(data
, _bitpos
)
4294 # print "char: %#x" % _char # 0
4295 _bitpos
, _char
= dwgutil
.get_raw_char(data
, _bitpos
)
4296 # print "char: %#x" % _char # 0
4297 _bitpos
, _char
= dwgutil
.get_raw_char(data
, _bitpos
)
4298 # print "char: %#x" % _char # 0
4299 _bitpos
, _char
= dwgutil
.get_raw_char(data
, _bitpos
)
4300 # print "char: %#x" % _char # 0
4301 _bitpos
, _char
= dwgutil
.get_raw_char(data
, _bitpos
)
4302 # print "char: %#x" % _char # 0 in spec, not always in files ...
4303 # print "bitpos: %d" % _bitpos
4304 _bitpos
, _val
= dwgutil
.test_bit(data
, _bitpos
)
4305 # print "val1: " + str(_val)
4306 _bitpos
, _val
= dwgutil
.test_bit(data
, _bitpos
)
4307 # print "val1: " + str(_val)
4308 _bitpos
, _val
= dwgutil
.test_bit(data
, _bitpos
)
4309 # print "val1: " + str(_val)
4310 _bitpos
, _val
= dwgutil
.test_bit(data
, _bitpos
)
4311 # print "val1: " + str(_val)
4312 # print "bitpos: %d" % _bitpos
4313 _bitpos
, _char
= dwgutil
.get_raw_char(data
, _bitpos
)
4314 # print "char: %#x" % _char # 0x18 in spec
4315 _bitpos
, _char
= dwgutil
.get_raw_char(data
, _bitpos
)
4316 # print "char: %#x" % _char # 0x78 in spec
4317 _bitpos
, _char
= dwgutil
.get_raw_char(data
, _bitpos
)
4318 # print "char: %#x" % _char # 0x01 in spec
4319 _bitpos
, _char
= dwgutil
.get_raw_char(data
, _bitpos
)
4320 # print "char: %#x" % _char # 0x04 for R13, 0x05 for R14, in spec
4321 # print "bitpos: %d" % _bitpos
4324 # bail out - some R15 drawings make it through reading the
4325 # class 0, class1, and class 2 stuff, others only make it
4326 # through reading class 0 and class 1 - these files don't
4327 # match at all the spec ...
4329 _bitpos
, _char
= dwgutil
.get_raw_char(data
, _bitpos
)
4330 # print "char: %#x" % _char # class 0
4331 _bitpos
, _haddr
= dwgutil
.get_bit_long(data
, _bitpos
)
4332 # print "header address: %d [%#x]" % (_haddr, _haddr)
4333 _bitpos
, _hsize
= dwgutil
.get_bit_long(data
, _bitpos
)
4334 # print "header size: %d" % _hsize
4335 # print "bitpos: %d" % _bitpos
4336 _bitpos
, _char
= dwgutil
.get_raw_char(data
, _bitpos
)
4337 # print "char: %#x" % _char # class 1
4338 _bitpos
, _caddr
= dwgutil
.get_bit_long(data
, _bitpos
)
4339 # print "class address: %d [%#x]" % (_caddr, _caddr)
4340 _bitpos
, _csize
= dwgutil
.get_bit_long(data
, _bitpos
)
4341 # print "class size: %d" % _csize
4342 # print "bitpos: %d" % _bitpos
4343 _bitpos
, _char
= dwgutil
.get_raw_char(data
, _bitpos
)
4344 # print "char: %#x" % _char # class 2
4345 _bitpos
, _omaddr
= dwgutil
.get_bit_long(data
, _bitpos
)
4346 # print "objmap address: %d [%#x]" % (_omaddr, _omaddr)
4347 _bitpos
, _omsize
= dwgutil
.get_bit_long(data
, _bitpos
)
4348 # print "objmap size: %d" % _omsize
4349 # print "bitpos: %d" % _bitpos
4350 # return _map # bail out - R15 is different ...
4351 _bitpos
, _char
= dwgutil
.get_raw_char(data
, _bitpos
)
4352 # print "char: %#x" % _char # class 3
4353 _bitpos
, _uaddr
= dwgutil
.get_bit_long(data
, _bitpos
)
4354 # print "unknown address: %d [%#x]" % (_uaddr, _uaddr)
4355 _bitpos
, _usize
= dwgutil
.get_bit_long(data
, _bitpos
)
4356 # print "unknown size: %d" % _usize
4357 # print "bitpos: %d" % _bitpos
4358 _bitpos
, _nrh
= dwgutil
.get_bit_short(data
, _bitpos
)
4359 # print "nrh: %d" % _nrh
4360 _bitpos
, _recnum
= dwgutil
.get_bit_short(data
, _bitpos
)
4361 # print "num of following handle records: %d" % _recnum
4363 # for _i in range(_recnum):
4364 # print "record %d" % _i
4365 # _bitpos, _sizeof = dwgutil.get_raw_char(data, _bitpos)
4366 # print "size of chars: %d" % _sizeof
4367 # _bitpos, _val = dwgutil.get_raw_char(data, _bitpos)
4368 # print "val: %d" % _val
4369 # _bitpos, _size = dwgutil.get_raw_char(data, _bitpos)
4370 # print "size chars: %d" % _size
4372 # there is more stuff left in data that we ignore ...