fixed specctra_export's net handling

This commit is contained in:
dickelbeck 2008-02-03 15:23:00 +00:00
parent 431a85e073
commit 227fa1e26e
4 changed files with 73 additions and 45 deletions

View File

@ -5,43 +5,50 @@ Started 2007-June-11
Please add newer entries at the top, list the date and your name with Please add newer entries at the top, list the date and your name with
email address. email address.
2008-Feb-3 UPDATE Dick Hollenbeck <dick@softplc.com>
================================================================================
+pcbnew
specctra_export.cpp was not exporting the nets correctly. beautification
of a few modules.
2008-Feb-1 UPDATE Dick Hollenbeck <dick@softplc.com> 2008-Feb-1 UPDATE Dick Hollenbeck <dick@softplc.com>
================================================================================ ================================================================================
+pcbnew: +pcbnew:
SPECCTRA export now exports pads with offset OK, exports oval pads OK, SPECCTRA export now exports pads with offset OK, exports oval pads OK,
and tries to do less with pcb edges that are not a connected set of lines, and tries to do less with pcb edges that are not a connected set of lines,
putting the burden back on the PCBNEW user to have clean perimeter lines. putting the burden back on the PCBNEW user to have clean perimeter lines.
Discovered that freerouter does not support oval pads yet, asked Discovered that freerouter does not support oval pads yet, asked
for enhancement. Discovered a small problem if you modify a PAD in for enhancement. Discovered a small problem if you modify a PAD in
the MODULE editor but do not replicate that change throughout all module the MODULE editor but do not replicate that change throughout all module
instances in the board. Is on my @todo list. Otherwise it is getting pretty instances in the board. Is on my @todo list. Otherwise it is getting pretty
good now. Most boards load into freerouter, except mine, which if exported good now. Most boards load into freerouter, except mine, which if exported
with part numbers, hangs the freerouter! I may be away for a few days doing with part numbers, hangs the freerouter! I may be away for a few days doing
billable work, after which I will begin the 2 imports, *.dsn and *.ses. billable work, after which I will begin the 2 imports, *.dsn and *.ses.
2008-Jan-31 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr> 2008-Jan-31 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
================================================================================ ================================================================================
+pcbnew: +pcbnew:
remove the old EDGEZONE class. remove the old EDGEZONE class.
A ZONE_CONTAINER class is used instead to handle the creation of a new zone outline A ZONE_CONTAINER class is used instead to handle the creation of a new zone outline
2008-Jan-29 UPDATE Dick Hollenbeck <dick@softplc.com> 2008-Jan-29 UPDATE Dick Hollenbeck <dick@softplc.com>
================================================================================ ================================================================================
+pcbnew: +pcbnew:
SPECCTRA export does most items now, except existing tracks. Soon will SPECCTRA export does most items now, except existing tracks. Soon will
need testing. need testing.
2008-Jan-28 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr> 2008-Jan-28 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
================================================================================ ================================================================================
+pcbnew: +pcbnew:
- Better criteria to find starting poind in zone filling: the filling alg. uses - Better criteria to find starting poind in zone filling: the filling alg. uses
pads, vias and track ends to find where start the filling. pads, vias and track ends to find where start the filling.
- Added a tool + option in popup menu in track mode (select track width): - Added a tool + option in popup menu in track mode (select track width):
when creating a track, if activated: if we starts on an existing track, when creating a track, if activated: if we starts on an existing track,
the new track takes the width of the existing track the new track takes the width of the existing track
2008-Jan-27 UPDATE Dick Hollenbeck <dick@softplc.com> 2008-Jan-27 UPDATE Dick Hollenbeck <dick@softplc.com>

View File

@ -3563,12 +3563,16 @@ int STRINGFORMATTER::Print( int nestLevel, const char* fmt, ... ) throw( IOError
void STRINGFORMATTER::StripUseless() void STRINGFORMATTER::StripUseless()
{ {
for( std::string::iterator i=mystring.begin(); i!=mystring.end(); ) std::string copy = mystring;
mystring.clear();
for( std::string::iterator i=copy.begin(); i!=copy.end(); ++i )
{ {
if( isspace( *i ) || *i==')' || *i=='(' || *i=='"' ) if( !isspace( *i ) && *i!=')' && *i!='(' && *i!='"' )
mystring.erase(i); {
else mystring += *i;
++i; }
} }
} }

View File

@ -3469,6 +3469,8 @@ class SPECCTRA_DB : public OUTPUTFORMATTER
/// maps PCB layer number to BOARD layer numbers /// maps PCB layer number to BOARD layer numbers
std::vector<int> pcbLayer2kicad; std::vector<int> pcbLayer2kicad;
static const KICAD_T scanPADs[];
/** /**

View File

@ -121,6 +121,9 @@ struct POINT_PAIR
typedef std::vector<POINT_PAIR> POINT_PAIRS; typedef std::vector<POINT_PAIR> POINT_PAIRS;
const KICAD_T SPECCTRA_DB::scanPADs[] = { TYPEPAD, EOT };
static inline void swap( POINT_PAIR& pair ) static inline void swap( POINT_PAIR& pair )
{ {
POINT temp = pair.start; POINT temp = pair.start;
@ -332,7 +335,6 @@ IMAGE* SPECCTRA_DB::makeIMAGE( MODULE* aModule )
PADSTACKS& padstacks = pcb->library->padstacks; PADSTACKS& padstacks = pcb->library->padstacks;
TYPE_COLLECTOR pads; TYPE_COLLECTOR pads;
static const KICAD_T scanPADs[] = { TYPEPAD, EOT };
// get all the MODULE's pads. // get all the MODULE's pads.
pads.Collect( aModule, scanPADs ); pads.Collect( aModule, scanPADs );
@ -772,6 +774,9 @@ void SPECCTRA_DB::FromBOARD( BOARD* aBoard )
POINT_PAIRS ppairs; POINT_PAIRS ppairs;
POINT_PAIR pair; POINT_PAIR pair;
static const KICAD_T scanMODULEs[] = { TYPEMODULE, EOT };
if( !pcb ) if( !pcb )
pcb = SPECCTRA_DB::MakePCB(); pcb = SPECCTRA_DB::MakePCB();
@ -1021,7 +1026,6 @@ void SPECCTRA_DB::FromBOARD( BOARD* aBoard )
//-----<build the initial padstack list>-------------------------------- //-----<build the initial padstack list>--------------------------------
{ {
TYPE_COLLECTOR pads; TYPE_COLLECTOR pads;
static const KICAD_T scanPADs[] = { TYPEPAD, EOT };
// get all the D_PADs into 'pads'. // get all the D_PADs into 'pads'.
pads.Collect( aBoard, scanPADs ); pads.Collect( aBoard, scanPADs );
@ -1037,7 +1041,6 @@ void SPECCTRA_DB::FromBOARD( BOARD* aBoard )
//-----<build the images and components>--------------------------------- //-----<build the images and components>---------------------------------
{ {
static const KICAD_T scanMODULEs[] = { TYPEMODULE, EOT };
items.Collect( aBoard, scanMODULEs ); items.Collect( aBoard, scanMODULEs );
for( int m=0; m<items.GetCount(); ++m ) for( int m=0; m<items.GetCount(); ++m )
@ -1077,16 +1080,21 @@ void SPECCTRA_DB::FromBOARD( BOARD* aBoard )
//-----<create the nets>------------------------------------------------ //-----<create the nets>------------------------------------------------
{ {
NETWORK* network = pcb->network; NETWORK* network = pcb->network;
TYPE_COLLECTOR nets;
TYPE_COLLECTOR pads;
static const KICAD_T scanNETs[] = { PCB_EQUIPOT_STRUCT_TYPE, EOT }; static const KICAD_T scanNETs[] = { PCB_EQUIPOT_STRUCT_TYPE, EOT };
items.Collect( aBoard, scanNETs ); nets.Collect( aBoard, scanNETs );
items.Collect( aBoard, scanMODULEs );
PIN_REF emptypin(0); PIN_REF emptypin(0);
for( int i=0; i<items.GetCount(); ++i ) for( int n=0; n<nets.GetCount(); ++n )
{ {
EQUIPOT* kinet = (EQUIPOT*) items[i]; EQUIPOT* kinet = (EQUIPOT*) nets[n];
if( kinet->GetNet() == 0 ) if( kinet->GetNet() == 0 )
continue; continue;
@ -1096,21 +1104,28 @@ void SPECCTRA_DB::FromBOARD( BOARD* aBoard )
net->net_id = CONV_TO_UTF8( kinet->m_Netname ); net->net_id = CONV_TO_UTF8( kinet->m_Netname );
net->net_number = kinet->GetNet(); net->net_number = kinet->GetNet();
D_PAD** ppad = kinet->m_PadzoneStart;
for( ; ppad < kinet->m_PadzoneEnd; ++ppad )
{
D_PAD* pad = *ppad;
wxASSERT( pad->Type() == TYPEPAD ); for( int m=0; m<items.GetCount(); ++m )
{
MODULE* module = (MODULE*) items[m];
pads.Collect( module, scanPADs );
// push on an empty one, then fill it via 'pin_ref' for( int p=0; p<pads.GetCount(); ++p )
net->pins.push_back( emptypin ); {
PIN_REF* pin_ref = &net->pins.back(); D_PAD* pad = (D_PAD*) pads[p];
pin_ref->SetParent( net ); if( pad->GetNet() == kinet->GetNet() )
pin_ref->component_id = CONV_TO_UTF8( ((MODULE*)pad->m_Parent)->GetReference() );; {
pin_ref->pin_id = CONV_TO_UTF8( pad->ReturnStringPadName() ); // push on an empty one, then fill it via 'pin_ref'
net->pins.push_back( emptypin );
PIN_REF* pin_ref = &net->pins.back();
pin_ref->SetParent( net );
pin_ref->component_id = CONV_TO_UTF8( module->GetReference() );
pin_ref->pin_id = CONV_TO_UTF8( pad->ReturnStringPadName() );
}
}
} }
} }
} }