on export, test via for netcode == 0

This commit is contained in:
dickelbeck 2008-02-21 06:04:32 +00:00
parent acf03b7d55
commit 36554e68d4
2 changed files with 31 additions and 9 deletions

View File

@ -2413,20 +2413,17 @@ public:
* Class PIN_REF
* corresponds to the <pin_reference> definition in the specctra dsn spec.
*/
class PIN_REF : public ELEM
struct PIN_REF : public ELEM
{
friend class SPECCTRA_DB;
std::string component_id;
std::string pin_id;
public:
PIN_REF( ELEM* aParent ) :
ELEM( T_pin, aParent )
{
}
/**
* Function FormatIt
* is like Format() but is not virual and returns the number of characters
@ -2607,6 +2604,18 @@ public:
delete comp_order;
}
int FindPIN_REF( const std::string& aComponent )
{
for( unsigned i=0; i<pins.size(); ++i )
{
if( 0 == aComponent.compare( pins[i].component_id ) )
return int(i);
}
return -1;
}
void Format( OUTPUTFORMATTER* out, int nestLevel ) throw( IOError )
{
const char* quote = out->GetQuoteChar( net_id.c_str() );

View File

@ -1054,11 +1054,21 @@ void SPECCTRA_DB::FromBOARD( BOARD* aBoard ) throw( IOError )
pcb->library->AddPadstack( padstack );
}
D(std::string component = "U1";)
// copy our SPECCTRA_DB::nets to the pcb->network
for( unsigned n=1; n<nets.size(); ++n )
{
NET* net = nets[n];
if( net->pins.size() )
if( net->pins.size()
#if defined(DEBUG)
// experimenting with exporting a subset of all the nets
// and with incremental, iterative autorouting.
&& net->FindPIN_REF( component ) >= 0
#endif
)
{
// give ownership to pcb->network
pcb->network->nets.push_back( net );
@ -1149,7 +1159,7 @@ void SPECCTRA_DB::FromBOARD( BOARD* aBoard ) throw( IOError )
wiring->wires.push_back( wire );
wire->net_id = netname;
wire->wire_type = T_normal; // @todo, this should be configurable
wire->wire_type = T_protect; // @todo, this should be configurable
int kiLayer = track->GetLayer();
int pcbLayer = kicadLayer2pcb[kiLayer];
@ -1181,6 +1191,10 @@ void SPECCTRA_DB::FromBOARD( BOARD* aBoard ) throw( IOError )
SEGVIA* via = (SEGVIA*) items[i];
wxASSERT( via->Type() == TYPEVIA );
int netcode = via->GetNet();
if( netcode == 0 )
continue;
PADSTACK* padstack = makeVia( via );
PADSTACK* registered = pcb->library->LookupVia( padstack );
if( padstack != registered )
@ -1194,13 +1208,12 @@ void SPECCTRA_DB::FromBOARD( BOARD* aBoard ) throw( IOError )
dsnVia->padstack_id = registered->padstack_id;
dsnVia->vertexes.push_back( mapPt( via->GetPosition() ) );
int netcode = via->GetNet();
EQUIPOT* equipot = aBoard->FindNet( netcode );
wxASSERT( equipot );
dsnVia->net_id = CONV_TO_UTF8( equipot->m_Netname );
dsnVia->via_type = T_normal; // @todo, this should be configurable
dsnVia->via_type = T_protect; // @todo, this should be configurable
}
}