From 044a2305e3fcaace9625b48ad14fb465a698331e Mon Sep 17 00:00:00 2001 From: Alex Shvartzkop Date: Tue, 4 Jun 2024 07:16:42 +0300 Subject: [PATCH] Fix ellipse angles when importing DXF. Fixes https://gitlab.com/kicad/code/kicad/-/issues/18121 --- common/import_gfx/dxf_import_plugin.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/common/import_gfx/dxf_import_plugin.cpp b/common/import_gfx/dxf_import_plugin.cpp index f7e4bf8cbe..5429305bef 100644 --- a/common/import_gfx/dxf_import_plugin.cpp +++ b/common/import_gfx/dxf_import_plugin.cpp @@ -642,10 +642,6 @@ void DXF_IMPORT_PLUGIN::addEllipse( const DL_EllipseData& aData ) if( startAngle > endAngle ) endAngle += ANGLE_360; - // Angles are relative to major axis - startAngle -= EDA_ANGLE( major ); - endAngle -= EDA_ANGLE( major ); - if( aData.ratio == 1.0 ) { double radius = major.EuclideanNorm(); @@ -658,6 +654,10 @@ void DXF_IMPORT_PLUGIN::addEllipse( const DL_EllipseData& aData ) } else { + // Angles are relative to major axis + startAngle -= EDA_ANGLE( major ); + endAngle -= EDA_ANGLE( major ); + DL_ArcData arc( aData.cx, aData.cy, aData.cz, radius, startAngle.AsDegrees(), endAngle.AsDegrees() ); addArc( arc );