Commit 36554e68 authored by dickelbeck's avatar dickelbeck

on export, test via for netcode == 0

parent acf03b7d
...@@ -2413,20 +2413,17 @@ public: ...@@ -2413,20 +2413,17 @@ public:
* Class PIN_REF * Class PIN_REF
* corresponds to the <pin_reference> definition in the specctra dsn spec. * 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 component_id;
std::string pin_id; std::string pin_id;
public:
PIN_REF( ELEM* aParent ) : PIN_REF( ELEM* aParent ) :
ELEM( T_pin, aParent ) ELEM( T_pin, aParent )
{ {
} }
/** /**
* Function FormatIt * Function FormatIt
* is like Format() but is not virual and returns the number of characters * is like Format() but is not virual and returns the number of characters
...@@ -2607,6 +2604,18 @@ public: ...@@ -2607,6 +2604,18 @@ public:
delete comp_order; 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 ) void Format( OUTPUTFORMATTER* out, int nestLevel ) throw( IOError )
{ {
const char* quote = out->GetQuoteChar( net_id.c_str() ); const char* quote = out->GetQuoteChar( net_id.c_str() );
......
...@@ -1054,11 +1054,21 @@ void SPECCTRA_DB::FromBOARD( BOARD* aBoard ) throw( IOError ) ...@@ -1054,11 +1054,21 @@ void SPECCTRA_DB::FromBOARD( BOARD* aBoard ) throw( IOError )
pcb->library->AddPadstack( padstack ); pcb->library->AddPadstack( padstack );
} }
D(std::string component = "U1";)
// copy our SPECCTRA_DB::nets to the pcb->network // copy our SPECCTRA_DB::nets to the pcb->network
for( unsigned n=1; n<nets.size(); ++n ) for( unsigned n=1; n<nets.size(); ++n )
{ {
NET* net = nets[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 // give ownership to pcb->network
pcb->network->nets.push_back( net ); pcb->network->nets.push_back( net );
...@@ -1149,7 +1159,7 @@ void SPECCTRA_DB::FromBOARD( BOARD* aBoard ) throw( IOError ) ...@@ -1149,7 +1159,7 @@ void SPECCTRA_DB::FromBOARD( BOARD* aBoard ) throw( IOError )
wiring->wires.push_back( wire ); wiring->wires.push_back( wire );
wire->net_id = netname; 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 kiLayer = track->GetLayer();
int pcbLayer = kicadLayer2pcb[kiLayer]; int pcbLayer = kicadLayer2pcb[kiLayer];
...@@ -1181,6 +1191,10 @@ void SPECCTRA_DB::FromBOARD( BOARD* aBoard ) throw( IOError ) ...@@ -1181,6 +1191,10 @@ void SPECCTRA_DB::FromBOARD( BOARD* aBoard ) throw( IOError )
SEGVIA* via = (SEGVIA*) items[i]; SEGVIA* via = (SEGVIA*) items[i];
wxASSERT( via->Type() == TYPEVIA ); wxASSERT( via->Type() == TYPEVIA );
int netcode = via->GetNet();
if( netcode == 0 )
continue;
PADSTACK* padstack = makeVia( via ); PADSTACK* padstack = makeVia( via );
PADSTACK* registered = pcb->library->LookupVia( padstack ); PADSTACK* registered = pcb->library->LookupVia( padstack );
if( padstack != registered ) if( padstack != registered )
...@@ -1194,13 +1208,12 @@ void SPECCTRA_DB::FromBOARD( BOARD* aBoard ) throw( IOError ) ...@@ -1194,13 +1208,12 @@ void SPECCTRA_DB::FromBOARD( BOARD* aBoard ) throw( IOError )
dsnVia->padstack_id = registered->padstack_id; dsnVia->padstack_id = registered->padstack_id;
dsnVia->vertexes.push_back( mapPt( via->GetPosition() ) ); dsnVia->vertexes.push_back( mapPt( via->GetPosition() ) );
int netcode = via->GetNet();
EQUIPOT* equipot = aBoard->FindNet( netcode ); EQUIPOT* equipot = aBoard->FindNet( netcode );
wxASSERT( equipot ); wxASSERT( equipot );
dsnVia->net_id = CONV_TO_UTF8( equipot->m_Netname ); 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
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment