From 17739859b35687372224b96e85a1a9743cbc7d0d Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Sat, 27 Jan 2018 17:32:59 +0100 Subject: [PATCH] DXF plot: fix incorrect plotting of oval holes Due to missing DXF_PLOTTER::ThickSegment code to plot a thick segment in SKETCH mode (outline mode) --- common/common_plotDXF_functions.cpp | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/common/common_plotDXF_functions.cpp b/common/common_plotDXF_functions.cpp index 8807591a2a..fe5fc8718b 100644 --- a/common/common_plotDXF_functions.cpp +++ b/common/common_plotDXF_functions.cpp @@ -586,8 +586,28 @@ void DXF_PLOTTER::SetDash( int dashed ) void DXF_PLOTTER::ThickSegment( const wxPoint& aStart, const wxPoint& aEnd, int aWidth, EDA_DRAW_MODE_T aPlotMode, void* aData ) { - MoveTo( aStart ); - FinishTo( aEnd ); + if( aPlotMode == SKETCH ) + { + std::vector cornerList; + SHAPE_POLY_SET outlineBuffer; + TransformOvalClearanceToPolygon( outlineBuffer, + aStart, aEnd, aWidth, 32 , 1.0 ); + const SHAPE_LINE_CHAIN& path = outlineBuffer.COutline(0 ); + + for( int jj = 0; jj < path.PointCount(); jj++ ) + cornerList.push_back( wxPoint( path.CPoint( jj ).x , path.CPoint( jj ).y ) ); + + // Ensure the polygon is closed + if( cornerList[0] != cornerList[cornerList.size() - 1] ) + cornerList.push_back( cornerList[0] ); + + PlotPoly( cornerList, NO_FILL ); + } + else + { + MoveTo( aStart ); + FinishTo( aEnd ); + } } /* Plot an arc in DXF format