import ezdxf
from ezdxf import DXFStructureError
try:
doc = ezdxf.readfile("w3b1-0552-3250-PP-20200621.dxf")
msp = doc.modelspace()
polylines = msp.query('POLYLINE')
for polyline in polylines:
print('Polyline #{}'.format(polyline.dxf.handle))
for i, location in enumerate(polyline.points()):
print('Point at index {}: {}'.format(i, location))
except DXFStructureError as error:
print(error)
Regards,
Henry
import ezdxf
from ezdxf.tools.rgb import DXF_DEFAULT_COLORS, int2rgb
doc = ezdxf.readfile('w3b1-0552-3250-PP-20200621.dxf')
msp = doc.modelspace()
polylines = msp.query('POLYLINE')
for polyline in polylines:
print(str(polyline))The ACI color index 7 is special: white on dark background and black on light background.
# AutoCAD Color Index
aci = polyline.dxf.color
print(f'Color Index: {aci}')
# RGB values of default colors are not officially documented,
# but an accurate translation table is included in ezdxf
rgb24 = DXF_DEFAULT_COLORS[aci] # 24 bit value RRRRRRRRGGGGGGGGBBBBBBBB
print(f'RGB Hex Value: #{rgb24:06X}')
r, g, b = int2rgb(rgb24)
print(f'RGB Channel Values: R={r:02X} G={g:02X} b={b:02X}')
print()
--
You received this message because you are subscribed to the Google Groups "python-ezdxf" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python-ezdxf...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python-ezdxf/caa0fd04-ce20-4bd3-9c67-8435bb9a24eao%40googlegroups.com.