svgcaddxf

How is an arc described in the DXF format if it is tilted out of the X-Y plane?


I am trying to make sense of the DXF CAD file format.

I have drawn an arc in my (intellicad) CAD software, centre at (5,5,5), radius of 300, start angle 40 degrees and end angle 110. I have then rotated the arc by 5 degrees in the Y-Z plane. I am doing this because I want to see what effect the 210, 220 and 230 group codes (which define the extrusion direction) have.

I am expecting to see this:

  0
ARC
 10
5.0
 20
5.0
 30
5.0
 40
300.0
210
0.0
220
0.08715574274765817
230
0.9961946980917455
 50
220.0
 51
290.0

Instead I see this:

  0
ARC
 10
-5.0
 20
-4.545194776720437
 30
5.416752204197018
 40
300.0
210
0.0
220
0.08715574274765817
230
0.9961946980917455
 50
220.0
 51
290.0

Why is the centre of the arc not on (5,5,5)?

I'm trying to parse DXF files in C++ and write it as an SVG, but the values I'm getting won't give me a true depiction.

How does the value of (5.0,5.0,5.0) get changed to (-5.0,-4.545194776720437,5.416752204197018)? Does anyone know?

I'm not sure that anyone can answer this for me, but I have seen questions on the DXF format answered here, so I'm hoping!


Solution

  • I am not a DXF expert. But..

    If you rotate something at (5,5) around the origin by 5 degrees, you get:

    5 * sin(5deg) - 5 * cos(5deg) = -4.54519
    5 * cos(5deg) + 5 * sin(5deg) = 5.41675