From b60c368b3c1a6c90b4bc80a84f3b3e667b06a386 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Sat, 15 Sep 2018 18:18:33 +0200 Subject: [PATCH] DXF import: fix incorrect import of arcs. The new dxflib uses degrees, not radians for angles. Fixes: lp:1792413 https://bugs.launchpad.net/kicad/+bug/1792413 --- pcbnew/import_dxf/dxf2brd_items.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/pcbnew/import_dxf/dxf2brd_items.cpp b/pcbnew/import_dxf/dxf2brd_items.cpp index 51c4f23ad3..d739565b0a 100644 --- a/pcbnew/import_dxf/dxf2brd_items.cpp +++ b/pcbnew/import_dxf/dxf2brd_items.cpp @@ -297,16 +297,20 @@ void DXF2BRD_CONVERTER::addArc( const DL_ArcData& aData ) // Init arc start point double arcStartx = aData.radius; double arcStarty = 0; - double startangle = aData.angle1; - double endangle = aData.angle2; - RotatePoint( &arcStartx, &arcStarty, -RAD2DECIDEG( startangle ) ); + // aData.anglex is in degrees. Our internal units are 0.1 degree + // so convert DXF angles to our units + #define DXF2ANGLEUI 10 + double startangle = aData.angle1 * DXF2ANGLEUI; + double endangle = aData.angle2 * DXF2ANGLEUI; + + RotatePoint( &arcStartx, &arcStarty, -startangle ); wxPoint arcStart( mapX( arcStartx + aData.cx ), mapY( arcStarty + aData.cy ) ); segm->SetArcStart( arcStart ); // calculate arc angle (arcs are CCW, and should be < 0 in Pcbnew) - double angle = -RAD2DECIDEG( endangle - startangle ); + double angle = -( endangle - startangle ); if( angle > 0.0 ) angle -= 3600.0;