Commit 227fa1e2 authored by dickelbeck's avatar dickelbeck
Browse files

fixed specctra_export's net handling

parent 431a85e0
Loading
Loading
Loading
Loading
+27 −20
Original line number Original line Diff line number Diff line
@@ -5,6 +5,13 @@ 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:
+9 −5
Original line number Original line Diff line number Diff line
@@ -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;
        }
    }
    }
}
}


+2 −0
Original line number Original line Diff line number Diff line
@@ -3470,6 +3470,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[];
    
    
    
    /**
    /**
     * Function nextTok
     * Function nextTok
+34 −19
Original line number Original line Diff line number Diff line
@@ -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 )
@@ -1078,15 +1081,20 @@ 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;
@@ -1097,23 +1105,30 @@ 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( int m=0;  m<items.GetCount();  ++m )
            for(   ; ppad < kinet->m_PadzoneEnd;   ++ppad )
            {
            {
                D_PAD* pad = *ppad;
                MODULE* module = (MODULE*) items[m];


                wxASSERT( pad->Type() == TYPEPAD );
                pads.Collect( module, scanPADs );
                
                for( int p=0;  p<pads.GetCount();  ++p )
                {
                    D_PAD* pad = (D_PAD*) pads[p];
                    
                    
                    if( pad->GetNet() == kinet->GetNet() )
                    {
                        // push on an empty one, then fill it via 'pin_ref'
                        // push on an empty one, then fill it via 'pin_ref'
                        net->pins.push_back( emptypin );
                        net->pins.push_back( emptypin );
                        PIN_REF* pin_ref = &net->pins.back();
                        PIN_REF* pin_ref = &net->pins.back();
                        
                        
                        pin_ref->SetParent( net );
                        pin_ref->SetParent( net );
                pin_ref->component_id = CONV_TO_UTF8( ((MODULE*)pad->m_Parent)->GetReference() );;
                        pin_ref->component_id = CONV_TO_UTF8( module->GetReference() );
                        pin_ref->pin_id = CONV_TO_UTF8( pad->ReturnStringPadName() );
                        pin_ref->pin_id = CONV_TO_UTF8( pad->ReturnStringPadName() );
                    }
                    }
                }
                }
            }
            }
        }
    }




    //-----<create the wires from tracks>-----------------------------------
    //-----<create the wires from tracks>-----------------------------------