Search code examples
c#.netvisual-studiocaddxf

Retrieve start and end point of an arc using NetDxf for c#


I need to retrieve the start and end point of an Arc entity using NetDxf to analyze my .Dxf file. So far i was only able to retrieve the center and the angle of the arc. Is there a way to retrieve the start and the end point using NetDxf library for c#?


Solution

  • In a DXF file, an arc is defined by the following properties:

    • Center (DXF 10)
    • Radius (DXF 40)
    • Start Angle (DXF 50)
    • End Angle (DXF 51)

    Where the start/end angles are always measured counter-clockwise from the x-axis of the object-coordinate-system (OCS) plane in which the arc resides.

    From these properties, you can easily obtain the start & end points by calculating points at an angle equal to either the start or end angle from the center point, at a distance equal to the radius, i.e.:

    Start Point = Center + (Radius*cos(StartAngle), Radius*sin(StartAngle))