specctra export zone 'cutout' support

This commit is contained in:
dickelbeck 2009-02-06 14:23:56 +00:00
parent d73e132455
commit 31aee8ef3e
3 changed files with 56 additions and 10 deletions

View File

@ -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 <dick@softplc.com>
================================================================================
++pcbnew
added "cutout" from a ZONE_CONTAINER capability to the SPECCTRA export.
2009-Feb-6 Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
================================================================================
@ -37,6 +42,7 @@ email address.
automatically scrolling the drawing.
>>>>>>> .r1562
2009-Feb-4 UPDATE Vesa Solonen <vesa.solonen@hut.fi>
================================================================================
++pcbnew:

View File

@ -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,8 +1053,10 @@ public:
for( WINDOWS::iterator i=windows.begin(); i!=windows.end(); ++i )
i->Format( out, nestLevel+1 );
}
out->Print( nestLevel, ")\n" );
}
else
out->Print( 0, ")\n" );
}
};

View File

@ -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; j<count; ++j )
int ndx = 0; // used in 2 for() loops below
for( ; ndx<count; ++ndx )
{
wxPoint point( item->m_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; ndx<count; ++ndx )
{
if( item->m_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) );
}
}
}