Loading pcbnew/specctra_export.cpp +11 −2 Original line number Original line Diff line number Diff line Loading @@ -913,7 +913,12 @@ void SPECCTRA_DB::FromBOARD( BOARD* aBoard ) throw( IOError ) int curTrackWidth = aBoard->m_BoardSettings->m_CurrentTrackWidth; int curTrackWidth = aBoard->m_BoardSettings->m_CurrentTrackWidth; int curTrackClear = aBoard->m_BoardSettings->m_TrackClearence; int curTrackClear = aBoard->m_BoardSettings->m_TrackClearence; double clearance = scale(curTrackClear); // The +5 is to give freerouter a little extra room, this is 0.5 mils. // If we export without this, then on import freerouter violates our // DRC checks with track to via spacing. double clearance = scale(curTrackClear+5); STRINGS& rules = pcb->structure->rules->rules; STRINGS& rules = pcb->structure->rules->rules; sprintf( rule, "(width %.6g)", scale( curTrackWidth ) ); sprintf( rule, "(width %.6g)", scale( curTrackWidth ) ); Loading Loading @@ -943,7 +948,11 @@ void SPECCTRA_DB::FromBOARD( BOARD* aBoard ) throw( IOError ) sprintf( rule, "(clearance %.6g (type smd_pin))", clearance ); sprintf( rule, "(clearance %.6g (type smd_pin))", clearance ); rules.push_back( rule ); rules.push_back( rule ); sprintf( rule, "(clearance %.6g (type smd_smd))", clearance/4 ); // well, the user is going to text edit these in the DSN file anyway, // at least until we have an export dialog. clearance = scale(curTrackClear)/4; sprintf( rule, "(clearance %.6g (type smd_smd))", clearance ); rules.push_back( rule ); rules.push_back( rule ); } } Loading pcbnew/specctra_import.cpp +13 −6 Original line number Original line Diff line number Diff line Loading @@ -146,7 +146,8 @@ static int scale( double distance, UNIT_RES* aResolution ) // used within Kicad. // used within Kicad. factor *= 10.0; factor *= 10.0; return (int) round(factor * distance / resValue); int ret = (int) round(factor * distance / resValue); return ret; } } static wxPoint mapPt( const POINT& aPoint, UNIT_RES* aResolution ) static wxPoint mapPt( const POINT& aPoint, UNIT_RES* aResolution ) Loading Loading @@ -202,8 +203,15 @@ SEGVIA* SPECCTRA_DB::makeVIA( PADSTACK* aPadstack, const POINT& aPoint, int aNet int drillEndNdx = aPadstack->padstack_id.rfind( '_' ); int drillEndNdx = aPadstack->padstack_id.rfind( '_' ); if( drillEndNdx != -1 ) if( drillEndNdx != -1 ) { { std::string drillDiam( aPadstack->padstack_id, drillStartNdx, drillEndNdx-drillStartNdx-1 ); std::string diamTxt( aPadstack->padstack_id, drillStartNdx+1, drillEndNdx-drillStartNdx-1 ); drillDiam = atoi( drillDiam.c_str() ); const char* sdiamTxt = diamTxt.c_str(); double drillMils = strtod( sdiamTxt, 0 ); // drillMils is not in the session units, but actual mils so we don't use scale() drillDiam = drillMils * 10; if( drillDiam == g_DesignSettings.m_ViaDrill ) // default drillDiam = -1; // import as default } } } } Loading Loading @@ -312,7 +320,6 @@ void SPECCTRA_DB::FromSESSION( BOARD* aBoard ) throw( IOError ) { { // convert from degrees to tenths of degrees used in Kicad. // convert from degrees to tenths of degrees used in Kicad. int orientation = (int) (place->rotation * 10.0); int orientation = (int) (place->rotation * 10.0); if( module->GetLayer() != CMP_N ) if( module->GetLayer() != CMP_N ) { { // module is on copper layer (back) // module is on copper layer (back) Loading @@ -332,8 +339,8 @@ void SPECCTRA_DB::FromSESSION( BOARD* aBoard ) throw( IOError ) } } else else { { // as I write this, the LEXER *is* catching this, so we should never see below: // as I write this, the PARSER *is* catching this, so we should never see below: wxFAIL_MSG( wxT("DSN::LEXER did not catch an illegal side := 'back|front'") ); wxFAIL_MSG( wxT("DSN::PARSER did not catch an illegal side := 'back|front'") ); } } } } } } Loading Loading
pcbnew/specctra_export.cpp +11 −2 Original line number Original line Diff line number Diff line Loading @@ -913,7 +913,12 @@ void SPECCTRA_DB::FromBOARD( BOARD* aBoard ) throw( IOError ) int curTrackWidth = aBoard->m_BoardSettings->m_CurrentTrackWidth; int curTrackWidth = aBoard->m_BoardSettings->m_CurrentTrackWidth; int curTrackClear = aBoard->m_BoardSettings->m_TrackClearence; int curTrackClear = aBoard->m_BoardSettings->m_TrackClearence; double clearance = scale(curTrackClear); // The +5 is to give freerouter a little extra room, this is 0.5 mils. // If we export without this, then on import freerouter violates our // DRC checks with track to via spacing. double clearance = scale(curTrackClear+5); STRINGS& rules = pcb->structure->rules->rules; STRINGS& rules = pcb->structure->rules->rules; sprintf( rule, "(width %.6g)", scale( curTrackWidth ) ); sprintf( rule, "(width %.6g)", scale( curTrackWidth ) ); Loading Loading @@ -943,7 +948,11 @@ void SPECCTRA_DB::FromBOARD( BOARD* aBoard ) throw( IOError ) sprintf( rule, "(clearance %.6g (type smd_pin))", clearance ); sprintf( rule, "(clearance %.6g (type smd_pin))", clearance ); rules.push_back( rule ); rules.push_back( rule ); sprintf( rule, "(clearance %.6g (type smd_smd))", clearance/4 ); // well, the user is going to text edit these in the DSN file anyway, // at least until we have an export dialog. clearance = scale(curTrackClear)/4; sprintf( rule, "(clearance %.6g (type smd_smd))", clearance ); rules.push_back( rule ); rules.push_back( rule ); } } Loading
pcbnew/specctra_import.cpp +13 −6 Original line number Original line Diff line number Diff line Loading @@ -146,7 +146,8 @@ static int scale( double distance, UNIT_RES* aResolution ) // used within Kicad. // used within Kicad. factor *= 10.0; factor *= 10.0; return (int) round(factor * distance / resValue); int ret = (int) round(factor * distance / resValue); return ret; } } static wxPoint mapPt( const POINT& aPoint, UNIT_RES* aResolution ) static wxPoint mapPt( const POINT& aPoint, UNIT_RES* aResolution ) Loading Loading @@ -202,8 +203,15 @@ SEGVIA* SPECCTRA_DB::makeVIA( PADSTACK* aPadstack, const POINT& aPoint, int aNet int drillEndNdx = aPadstack->padstack_id.rfind( '_' ); int drillEndNdx = aPadstack->padstack_id.rfind( '_' ); if( drillEndNdx != -1 ) if( drillEndNdx != -1 ) { { std::string drillDiam( aPadstack->padstack_id, drillStartNdx, drillEndNdx-drillStartNdx-1 ); std::string diamTxt( aPadstack->padstack_id, drillStartNdx+1, drillEndNdx-drillStartNdx-1 ); drillDiam = atoi( drillDiam.c_str() ); const char* sdiamTxt = diamTxt.c_str(); double drillMils = strtod( sdiamTxt, 0 ); // drillMils is not in the session units, but actual mils so we don't use scale() drillDiam = drillMils * 10; if( drillDiam == g_DesignSettings.m_ViaDrill ) // default drillDiam = -1; // import as default } } } } Loading Loading @@ -312,7 +320,6 @@ void SPECCTRA_DB::FromSESSION( BOARD* aBoard ) throw( IOError ) { { // convert from degrees to tenths of degrees used in Kicad. // convert from degrees to tenths of degrees used in Kicad. int orientation = (int) (place->rotation * 10.0); int orientation = (int) (place->rotation * 10.0); if( module->GetLayer() != CMP_N ) if( module->GetLayer() != CMP_N ) { { // module is on copper layer (back) // module is on copper layer (back) Loading @@ -332,8 +339,8 @@ void SPECCTRA_DB::FromSESSION( BOARD* aBoard ) throw( IOError ) } } else else { { // as I write this, the LEXER *is* catching this, so we should never see below: // as I write this, the PARSER *is* catching this, so we should never see below: wxFAIL_MSG( wxT("DSN::LEXER did not catch an illegal side := 'back|front'") ); wxFAIL_MSG( wxT("DSN::PARSER did not catch an illegal side := 'back|front'") ); } } } } } } Loading