Search code examples
pythonpython-3.xautocaddxf

Extracting arc parameters from a DXF using EZDXF Python


I am trying to extract the Arc Parameters from a DXF using Ezdxf.

So far I have been able to extract the center, start_angle, end_angle and radius.

Is there a way, I can find out the direction of the arc, i.e., clockwise or anti-clockwise?

I am using the code :

dwg_file = ezdxf.readfile("drawing.DXF")
modelspace = dwg_file.modelspace()
for entity in modelspace:
        dxf_type = entity.dxftype()
        print " Entity attributes ", entity.dxfattribs()

For an Arc, all I receive is :

{u'layer': u'0', u'handle': u'8A', u'center': (1713.461909760174, 1108.553092696682, 0.0), u'start_angle': 359.9999999999935, u'end_angle': 70.0000000000344, u'radius': 4.999999999995392, u'owner': u'2'}

Solution

  • ARC goes always counter clockwise around the extrusion vector, which is (0, 0, 1) by default and the usual case for 2D arcs.