From 227fa1e26e7b9e1fd8a72c9d152dc31546d8caf0 Mon Sep 17 00:00:00 2001 From: dickelbeck Date: Sun, 3 Feb 2008 15:23:00 +0000 Subject: [PATCH] fixed specctra_export's net handling --- change_log.txt | 47 ++++++++++++++++++-------------- pcbnew/specctra.cpp | 14 ++++++---- pcbnew/specctra.h | 2 ++ pcbnew/specctra_export.cpp | 55 ++++++++++++++++++++++++-------------- 4 files changed, 73 insertions(+), 45 deletions(-) diff --git a/change_log.txt b/change_log.txt index 80be354013..26c672f177 100644 --- a/change_log.txt +++ b/change_log.txt @@ -5,43 +5,50 @@ Started 2007-June-11 Please add newer entries at the top, list the date and your name with email address. +2008-Feb-3 UPDATE Dick Hollenbeck +================================================================================ ++pcbnew + specctra_export.cpp was not exporting the nets correctly. beautification + of a few modules. + + 2008-Feb-1 UPDATE Dick Hollenbeck ================================================================================ +pcbnew: - 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, - putting the burden back on the PCBNEW user to have clean perimeter lines. - Discovered that freerouter does not support oval pads yet, asked - for enhancement. Discovered a small problem if you modify a PAD in - 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 - 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 - billable work, after which I will begin the 2 imports, *.dsn and *.ses. + 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, + putting the burden back on the PCBNEW user to have clean perimeter lines. + Discovered that freerouter does not support oval pads yet, asked + for enhancement. Discovered a small problem if you modify a PAD in + 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 + 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 + billable work, after which I will begin the 2 imports, *.dsn and *.ses. 2008-Jan-31 UPDATE Jean-Pierre Charras ================================================================================ +pcbnew: - remove the old EDGEZONE class. - A ZONE_CONTAINER class is used instead to handle the creation of a new zone outline - + remove the old EDGEZONE class. + A ZONE_CONTAINER class is used instead to handle the creation of a new zone outline + 2008-Jan-29 UPDATE Dick Hollenbeck ================================================================================ +pcbnew: - SPECCTRA export does most items now, except existing tracks. Soon will - need testing. + SPECCTRA export does most items now, except existing tracks. Soon will + need testing. 2008-Jan-28 UPDATE Jean-Pierre Charras ================================================================================ +pcbnew: - - Better criteria to find starting poind in zone filling: the filling alg. uses - pads, vias and track ends to find where start the filling. - - 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, - the new track takes the width of the existing track + - Better criteria to find starting poind in zone filling: the filling alg. uses + pads, vias and track ends to find where start the filling. + - 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, + the new track takes the width of the existing track 2008-Jan-27 UPDATE Dick Hollenbeck diff --git a/pcbnew/specctra.cpp b/pcbnew/specctra.cpp index fda75445f5..24afd7c96a 100644 --- a/pcbnew/specctra.cpp +++ b/pcbnew/specctra.cpp @@ -3563,12 +3563,16 @@ int STRINGFORMATTER::Print( int nestLevel, const char* fmt, ... ) throw( IOError 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=='"' ) - mystring.erase(i); - else - ++i; + if( !isspace( *i ) && *i!=')' && *i!='(' && *i!='"' ) + { + mystring += *i; + } } } diff --git a/pcbnew/specctra.h b/pcbnew/specctra.h index 022f3db3fa..8c5fb06f1c 100644 --- a/pcbnew/specctra.h +++ b/pcbnew/specctra.h @@ -3469,6 +3469,8 @@ class SPECCTRA_DB : public OUTPUTFORMATTER /// maps PCB layer number to BOARD layer numbers std::vector pcbLayer2kicad; + + static const KICAD_T scanPADs[]; /** diff --git a/pcbnew/specctra_export.cpp b/pcbnew/specctra_export.cpp index ac3d60d275..978ee6ac12 100644 --- a/pcbnew/specctra_export.cpp +++ b/pcbnew/specctra_export.cpp @@ -121,6 +121,9 @@ struct POINT_PAIR typedef std::vector POINT_PAIRS; +const KICAD_T SPECCTRA_DB::scanPADs[] = { TYPEPAD, EOT }; + + static inline void swap( POINT_PAIR& pair ) { POINT temp = pair.start; @@ -332,7 +335,6 @@ IMAGE* SPECCTRA_DB::makeIMAGE( MODULE* aModule ) PADSTACKS& padstacks = pcb->library->padstacks; TYPE_COLLECTOR pads; - static const KICAD_T scanPADs[] = { TYPEPAD, EOT }; // get all the MODULE's pads. pads.Collect( aModule, scanPADs ); @@ -772,6 +774,9 @@ void SPECCTRA_DB::FromBOARD( BOARD* aBoard ) POINT_PAIRS ppairs; POINT_PAIR pair; + static const KICAD_T scanMODULEs[] = { TYPEMODULE, EOT }; + + if( !pcb ) pcb = SPECCTRA_DB::MakePCB(); @@ -1021,7 +1026,6 @@ void SPECCTRA_DB::FromBOARD( BOARD* aBoard ) //------------------------------------- { TYPE_COLLECTOR pads; - static const KICAD_T scanPADs[] = { TYPEPAD, EOT }; // get all the D_PADs into 'pads'. pads.Collect( aBoard, scanPADs ); @@ -1037,7 +1041,6 @@ void SPECCTRA_DB::FromBOARD( BOARD* aBoard ) //-------------------------------------- { - static const KICAD_T scanMODULEs[] = { TYPEMODULE, EOT }; items.Collect( aBoard, scanMODULEs ); for( int m=0; m------------------------------------------------ { - NETWORK* network = pcb->network; + NETWORK* network = pcb->network; + TYPE_COLLECTOR nets; + TYPE_COLLECTOR pads; + 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); - for( int i=0; iGetNet() == 0 ) continue; @@ -1096,21 +1104,28 @@ void SPECCTRA_DB::FromBOARD( BOARD* aBoard ) net->net_id = CONV_TO_UTF8( kinet->m_Netname ); 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; mpins.push_back( emptypin ); - PIN_REF* pin_ref = &net->pins.back(); - - pin_ref->SetParent( net ); - pin_ref->component_id = CONV_TO_UTF8( ((MODULE*)pad->m_Parent)->GetReference() );; - pin_ref->pin_id = CONV_TO_UTF8( pad->ReturnStringPadName() ); + for( int p=0; pGetNet() == kinet->GetNet() ) + { + // 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() ); + } + } } } }