netless zone support fix to specctra export

This commit is contained in:
dickelbeck 2009-02-07 16:06:55 +00:00
parent 1d3f2d520c
commit d58296c804
2 changed files with 21 additions and 0 deletions

View File

@ -19,6 +19,7 @@ email address.
================================================================================
++pcbnew
added "cutout" from a ZONE_CONTAINER capability to the SPECCTRA export.
added "netless zone" support to SPECCTRA export.
2009-Feb-6 Jean-Pierre Charras <jean-pierre.charras@inpg.fr>

View File

@ -1026,6 +1026,8 @@ void SPECCTRA_DB::FromBOARD( BOARD* aBoard ) throw( IOError )
//-----<zone containers become planes>--------------------------------
{
int netlessZones = 0;
static const KICAD_T scanZONEs[] = { TYPE_ZONE_CONTAINER, EOT };
items.Collect( aBoard, scanZONEs );
@ -1041,6 +1043,24 @@ void SPECCTRA_DB::FromBOARD( BOARD* aBoard ) throw( IOError )
plane->name = CONV_TO_UTF8( item->m_Netname );
if( plane->name.size() == 0 )
{
char name[32];
// This is one of those no connection zones, netcode=0, and it has no name.
// Create a unique, bogus netname.
NET* no_net = new NET( pcb->network );
sprintf( name, "@:no_net_%d", netlessZones++ );
no_net->net_id = name;
// add the bogus net name to network->nets.
pcb->network->nets.push_back( no_net );
// use the bogus net name in the netless zone.
plane->name = no_net->net_id;
}
mainPolygon->layer_id = layerIds[ kicadLayer2pcb[ item->GetLayer() ] ];
int count = item->m_Poly->corner.size();