Getting Custom\visibility1 from DXF\LWPolyline using Python and ezdxf

46 views Asked by At
  1. I can read DXF using Python and ezdxf library.
  2. I can read the LWPolylines
  3. I want to read all custom data fields Custom \ Visibility1, Visibility,Distance1,Angle1 .

How can I read those custom data from a LWPolyline object?

I use the following code:

    import ezdxf
    
    path =  ....
    filename = path + ....
    doc = ezdxf.readzip(filename)
    msp = doc.modelspace() 
    polylines = msp.query('LWPOLYLINE')
    poly1 = polylines[30]
    poly2 = polylines[31] 
    
    xd= poly1.get_xdata('Custom')
    print(xd[0])   

I got the error:

Traceback (most recent call last):
  File "C:\Users\Alex Wen\source\dxf1\dxf3.py", line 20, in <module>
    xd= poly1.get_xdata('Custom')
  File "C:\py\anaconda3\lib\site-packages\ezdxf\entities\dxfentity.py", line 870, in get_xdata
    raise const.DXFValueError(appid)
ezdxf.lldxf.const.DXFValueError: Custom
0

There are 0 answers