Commit 93eeb75c authored by Dick Hollenbeck's avatar Dick Hollenbeck
Browse files

Use via layers which are determined in only one place, this is a cheap trick...

Use via layers which are determined in only one place, this is a cheap trick to support blind vias in the export.
parent e3c104d6
Loading
Loading
Loading
Loading
+4 −0
Original line number Original line Diff line number Diff line
@@ -3595,6 +3595,10 @@ class SPECCTRA_DB : public SPECCTRA_LEXER
    /// we don't want ownership here permanently, so we don't use boost::ptr_vector
    /// we don't want ownership here permanently, so we don't use boost::ptr_vector
    std::vector<NET*>   nets;
    std::vector<NET*>   nets;


    /// specctra cu layers, 0 based index:
    int     m_top_via_layer;
    int     m_bot_via_layer;



    /**
    /**
     * Function buildLayerMaps
     * Function buildLayerMaps
+56 −37
Original line number Original line Diff line number Diff line
@@ -150,6 +150,8 @@ void PCB_EDIT_FRAME::ExportToSpecctra( wxCommandEvent& event )


    try
    try
    {
    {


        GetBoard()->SynchronizeNetsAndNetClasses();
        GetBoard()->SynchronizeNetsAndNetClasses();
        db.FromBOARD( GetBoard() );
        db.FromBOARD( GetBoard() );
        db.ExportPCB(  fullFileName, true );
        db.ExportPCB(  fullFileName, true );
@@ -591,8 +593,6 @@ PADSTACK* SPECCTRA_DB::makePADSTACK( BOARD* aBoard, D_PAD* aPad )
                polygon->AppendPoint( lowerRight );
                polygon->AppendPoint( lowerRight );
            }
            }


            D( printf( "m_DeltaSize: %d,%d\n", aPad->GetDelta().x, aPad->GetDelta().y ); )

            // this string _must_ be unique for a given physical shape
            // this string _must_ be unique for a given physical shape
            snprintf( name, sizeof(name), "Trapz%sPad_%.6gx%.6g_%c%.6gx%c%.6g_um",
            snprintf( name, sizeof(name), "Trapz%sPad_%.6gx%.6g_%c%.6gx%c%.6g_um",
                     uniqifier.c_str(), IU2um( aPad->GetSize().x ), IU2um( aPad->GetSize().y ),
                     uniqifier.c_str(), IU2um( aPad->GetSize().x ), IU2um( aPad->GetSize().y ),
@@ -1727,13 +1727,32 @@ void SPECCTRA_DB::FromBOARD( BOARD* aBoard ) throw( IO_ERROR )
    {
    {
        NETCLASSES& nclasses = aBoard->m_NetClasses;
        NETCLASSES& nclasses = aBoard->m_NetClasses;


        // Assume the netclass vias are all the same kind of thru, blind, or buried vias.
        // This is in lieu of either having each netclass via have its own layer pair in
        // the netclass dialog, or such control in the specctra export dialog.


        // if( aBoard->GetDesignSettings().m_CurrentViaType == VIA_THROUGH )
        {
            m_top_via_layer = 0;       // first specctra cu layer is number zero.
            m_bot_via_layer = aBoard->GetCopperLayerCount()-1;
        }
        /*
        else
        {
            // again, should be in the BOARD:
            topLayer = kicadLayer2pcb[ GetScreen()->m_Route_Layer_TOP ];
            botLayer = kicadLayer2pcb[ GetScreen()->m_Route_Layer_BOTTOM ];
        }
        */

        // Add the via from the Default netclass first.  The via container
        // Add the via from the Default netclass first.  The via container
        // in pcb->library preserves the sequence of addition.
        // in pcb->library preserves the sequence of addition.


        NETCLASS*   netclass = nclasses.GetDefault();
        NETCLASS*   netclass = nclasses.GetDefault();


        PADSTACK*   via = makeVia( netclass->GetViaDiameter(), netclass->GetViaDrill(),
        PADSTACK*   via = makeVia( netclass->GetViaDiameter(), netclass->GetViaDrill(),
                                   FIRST_LAYER, aBoard->GetCopperLayerCount()-1 );
                                   m_top_via_layer, m_bot_via_layer );


        // we AppendVia() this first one, there is no way it can be a duplicate,
        // we AppendVia() this first one, there is no way it can be a duplicate,
        // the pcb->library via container is empty at this point.  After this,
        // the pcb->library via container is empty at this point.  After this,
@@ -1742,10 +1761,11 @@ void SPECCTRA_DB::FromBOARD( BOARD* aBoard ) throw( IO_ERROR )
        pcb->library->AppendVia( via );
        pcb->library->AppendVia( via );


#if 0
#if 0
        // Stock vias have drill diameter of zero, this is not sensible to freerouter
        // I've seen no way to make stock vias useable by freerouter.  Also the
        // zero based diameter was leading to duplicates in the LookupVia() function.
        // User should use netclass based vias when going to freerouter.
        // User should use netclass based vias when going to freerouter.


        // output the stock vias, but preserve uniqueness in the via container by
        // Output the stock vias, but preserve uniqueness in the via container by
        // using LookupVia().
        // using LookupVia().
        for( unsigned i = 0; i < aBoard->m_ViasDimensionsList.size(); ++i )
        for( unsigned i = 0; i < aBoard->m_ViasDimensionsList.size(); ++i )
        {
        {
@@ -1753,7 +1773,7 @@ void SPECCTRA_DB::FromBOARD( BOARD* aBoard ) throw( IO_ERROR )
            int viaDrill    = aBoard->m_ViasDimensionsList[i].m_Drill;
            int viaDrill    = aBoard->m_ViasDimensionsList[i].m_Drill;


            via = makeVia( viaSize, viaDrill,
            via = makeVia( viaSize, viaDrill,
                           FIRST_LAYER, aBoard->GetCopperLayerCount()-1 );
                           m_top_via_layer, m_bot_via_layer );


            // maybe add 'via' to the library, but only if unique.
            // maybe add 'via' to the library, but only if unique.
            PADSTACK* registered = pcb->library->LookupVia( via );
            PADSTACK* registered = pcb->library->LookupVia( via );
@@ -1772,7 +1792,7 @@ void SPECCTRA_DB::FromBOARD( BOARD* aBoard ) throw( IO_ERROR )
            netclass = nc->second;
            netclass = nc->second;


            via = makeVia( netclass->GetViaDiameter(), netclass->GetViaDrill(),
            via = makeVia( netclass->GetViaDiameter(), netclass->GetViaDrill(),
                           FIRST_LAYER, aBoard->GetCopperLayerCount()-1 );
                           m_top_via_layer, m_bot_via_layer );


            // maybe add 'via' to the library, but only if unique.
            // maybe add 'via' to the library, but only if unique.
            PADSTACK* registered = pcb->library->LookupVia( via );
            PADSTACK* registered = pcb->library->LookupVia( via );
@@ -1854,8 +1874,7 @@ void SPECCTRA_DB::FromBOARD( BOARD* aBoard ) throw( IO_ERROR )


    //-----<export the existing real BOARD instantiated vias>-----------------
    //-----<export the existing real BOARD instantiated vias>-----------------
    {
    {
        // export all of them for now, later we'll decide what controls we need
        // Export all vias, once per unique size and drill diameter combo.
        // on this.
        static const KICAD_T scanVIAs[] = { PCB_VIA_T, EOT };
        static const KICAD_T scanVIAs[] = { PCB_VIA_T, EOT };


        items.Collect( aBoard, scanVIAs );
        items.Collect( aBoard, scanVIAs );
@@ -1995,7 +2014,7 @@ void SPECCTRA_DB::exportNETCLASS( NETCLASS* aNetClass, BOARD* aBoard )
    // this should never become a performance issue.
    // this should never become a performance issue.


    PADSTACK* via = makeVia( aNetClass->GetViaDiameter(), aNetClass->GetViaDrill(),
    PADSTACK* via = makeVia( aNetClass->GetViaDiameter(), aNetClass->GetViaDrill(),
                             FIRST_LAYER, aBoard->GetCopperLayerCount()-1 );
                             m_top_via_layer, m_bot_via_layer );


    snprintf( text, sizeof(text), "(use_via %s)", via->GetPadstackId().c_str() );
    snprintf( text, sizeof(text), "(use_via %s)", via->GetPadstackId().c_str() );
    clazz->circuit.push_back( text );
    clazz->circuit.push_back( text );