← Back to team overview

kicad-developers team mailing list archive

Re: DXF export broken?

 

On 09.09.2015 15:58, Wayne Stambaugh wrote:
> This board is exposing all kinds of issues.  First vrml export, now the
> DXF plots are wrong.  I know I've plotted dxfs for similar shaped boards
> in the past.  I don't know if it's this board in particular or something
> has been changed in the dxf plotter.  Could someone with experience with
> the dxf plotter please take look at this?  I'm a bit busy to look at it
> myself.
> 

Hi Wayne,

I'm the one to blame: the bug was caused by a stupid typo during
de-boostization which went unnoticed since it affects only DXF export. I
also fixed handling polygons with holes in DXF. Patch attached.

Cheers,
Tom
>From ea5ec8534dc78519f043fc5b40c3316e1ffeb50e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Tomasz=20W=C5=82ostowski?= <tomasz.wlostowski@xxxxxxx>
Date: Wed, 9 Sep 2015 16:32:14 +0200
Subject: [PATCH 2/2] PlotLayerOutlines: fixed typo causing incorrect DXF
 output, added support for holes

---
 pcbnew/plot_board_layers.cpp | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)

diff --git a/pcbnew/plot_board_layers.cpp b/pcbnew/plot_board_layers.cpp
index 364d40f..b79280f 100644
--- a/pcbnew/plot_board_layers.cpp
+++ b/pcbnew/plot_board_layers.cpp
@@ -566,17 +566,21 @@ void PlotLayerOutlines( BOARD* aBoard, PLOTTER* aPlotter,
         // Now we have one or more basic polygons: plot each polygon
         for( int ii = 0; ii < outlines.OutlineCount(); ii++ )
         {
-            cornerList.clear();
-            const SHAPE_LINE_CHAIN& path = outlines.COutline( ii );
+            for(int kk = 0; kk <= outlines.HoleCount (ii); kk++ )
+            {
+                cornerList.clear();
+                const SHAPE_LINE_CHAIN& path = (kk == 0) ? outlines.COutline( ii ) : outlines.CHole( ii, kk - 1 );
+
+                for( int jj = 0; jj < path.PointCount(); jj++ )
+                    cornerList.push_back( wxPoint( path.CPoint( jj ).x , path.CPoint( jj ).y ) );
 
-            for( int jj = 0; jj < path.PointCount(); jj++ )
-                cornerList.push_back( wxPoint( path.CPoint( jj ).x , path.CPoint( jj ).x ) );
 
-            // Ensure the polygon is closed
-            if( cornerList[0] != cornerList[cornerList.size() - 1] )
-                cornerList.push_back( cornerList[0] );
+                // Ensure the polygon is closed
+                if( cornerList[0] != cornerList[cornerList.size() - 1] )
+                    cornerList.push_back( cornerList[0] );
 
-            aPlotter->PlotPoly( cornerList, NO_FILL );
+                aPlotter->PlotPoly( cornerList, NO_FILL );
+            }
         }
 
         // Plot pad holes
-- 
1.9.1


Follow ups

References