From 31aee8ef3ed6c4d7573b8f8a978e244f011bc703 Mon Sep 17 00:00:00 2001 From: dickelbeck Date: Fri, 6 Feb 2009 14:23:56 +0000 Subject: [PATCH] specctra export zone 'cutout' support --- CHANGELOG.txt | 8 ++++++- pcbnew/specctra.h | 12 ++++++++-- pcbnew/specctra_export.cpp | 46 ++++++++++++++++++++++++++++++++------ 3 files changed, 56 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 9484d950e4..d248d394f8 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -5,6 +5,11 @@ Started 2007-June-11 Please add newer entries at the top, list the date and your name with email address. +2009-Feb-06 UPDATE Dick Hollenbeck +================================================================================ +++pcbnew + added "cutout" from a ZONE_CONTAINER capability to the SPECCTRA export. + 2009-Feb-6 Jean-Pierre Charras ================================================================================ @@ -19,7 +24,7 @@ email address. more refinements in user grid mode. new grid implementation does not used floats when user grid is selected to calculate coordinates. so it is unable to handle a metric grid. Todo: see what happened. - + ++eeschema: Zoom factors in 1.5 progression, and limited to 15 values according to Wayne Stambaugh's changes. @@ -37,6 +42,7 @@ email address. automatically scrolling the drawing. +>>>>>>> .r1562 2009-Feb-4 UPDATE Vesa Solonen ================================================================================ ++pcbnew: diff --git a/pcbnew/specctra.h b/pcbnew/specctra.h index 4e531ade78..1bb3faaff0 100644 --- a/pcbnew/specctra.h +++ b/pcbnew/specctra.h @@ -1005,6 +1005,12 @@ public: } } + void AddWindow( WINDOW* aWindow ) + { + aWindow->SetParent( this ); + windows.push_back( aWindow ); + } + void Format( OUTPUTFORMATTER* out, int nestLevel ) throw( IOError ) { const char* newline = "\n"; @@ -1047,9 +1053,11 @@ public: for( WINDOWS::iterator i=windows.begin(); i!=windows.end(); ++i ) i->Format( out, nestLevel+1 ); - } - out->Print( 0, ")\n" ); + out->Print( nestLevel, ")\n" ); + } + else + out->Print( 0, ")\n" ); } }; typedef boost::ptr_vector KEEPOUTS; diff --git a/pcbnew/specctra_export.cpp b/pcbnew/specctra_export.cpp index d84cf494bf..bf2a62fb73 100644 --- a/pcbnew/specctra_export.cpp +++ b/pcbnew/specctra_export.cpp @@ -1036,19 +1036,51 @@ void SPECCTRA_DB::FromBOARD( BOARD* aBoard ) throw( IOError ) COPPER_PLANE* plane = new COPPER_PLANE( pcb->structure ); pcb->structure->planes.push_back( plane ); - PATH* polygon = new PATH( plane, T_polygon ); - plane->SetShape( polygon ); + PATH* mainPolygon = new PATH( plane, T_polygon ); + plane->SetShape( mainPolygon ); plane->name = CONV_TO_UTF8( item->m_Netname ); - polygon->layer_id = layerIds[ kicadLayer2pcb[ item->GetLayer() ] ]; + mainPolygon->layer_id = layerIds[ kicadLayer2pcb[ item->GetLayer() ] ]; int count = item->m_Poly->corner.size(); - for( int j=0; jm_Poly->corner[j].x, - item->m_Poly->corner[j].y ); - polygon->AppendPoint( mapPt(point) ); + wxPoint point( item->m_Poly->corner[ndx].x, + item->m_Poly->corner[ndx].y ); + mainPolygon->AppendPoint( mapPt(point) ); + + // this was the end of the main polygon + if( item->m_Poly->corner[ndx].end_contour ) + break; + } + + WINDOW* window = 0; + PATH* cutout = 0; + + // handle the cutouts + // http://www.freerouting.net/fen/viewtopic.php?f=6&t=19 + for( ++ndx; ndxm_Poly->corner[ndx-1].end_contour ) + { + window = new WINDOW( plane ); + plane->AddWindow( window ); + + cutout = new PATH( window, T_path ); + // cutout = new PATH( window, T_polygon ); + window->SetShape( cutout ); + + cutout->layer_id = layerIds[ kicadLayer2pcb[ item->GetLayer() ] ]; + } + + wxASSERT( window ); + wxASSERT( cutout ); + + wxPoint point(item->m_Poly->corner[ndx].x, + item->m_Poly->corner[ndx].y ); + cutout->AppendPoint( mapPt(point) ); } } }