|
|
|
@ -42,18 +42,23 @@ using namespace DSN; |
|
|
|
|
|
|
|
void WinEDA_PcbFrame::ImportSpecctraDesign( wxCommandEvent& event ) |
|
|
|
{ |
|
|
|
/* @todo write this someday
|
|
|
|
|
|
|
|
if( !Clear_Pcb( true ) ) |
|
|
|
return; |
|
|
|
*/ |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void WinEDA_PcbFrame::ImportSpecctraSession( wxCommandEvent& event ) |
|
|
|
{ |
|
|
|
/*
|
|
|
|
if( GetScreen()->IsModify() ) |
|
|
|
{ |
|
|
|
if( !IsOK( this, _( "Board Modified: Continue ?" ) ) ) |
|
|
|
return; |
|
|
|
} |
|
|
|
*/ |
|
|
|
|
|
|
|
wxString sessionExt( wxT( ".ses" ) ); |
|
|
|
wxString fileName = GetScreen()->m_FileName; |
|
|
|
@ -84,12 +89,12 @@ void WinEDA_PcbFrame::ImportSpecctraSession( wxCommandEvent& event ) |
|
|
|
} |
|
|
|
catch( IOError ioe ) |
|
|
|
{ |
|
|
|
setlocale( LC_NUMERIC, "" ); // Switch the locale to standard C
|
|
|
|
setlocale( LC_NUMERIC, "" ); // revert to the current locale
|
|
|
|
DisplayError( this, ioe.errorText ); |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
setlocale( LC_NUMERIC, "" ); // Switch the locale to standard C
|
|
|
|
setlocale( LC_NUMERIC, "" ); // revert to the current locale
|
|
|
|
|
|
|
|
m_SelTrackWidthBox_Changed = TRUE; |
|
|
|
m_SelViaSizeBox_Changed = TRUE; |
|
|
|
@ -103,18 +108,43 @@ void WinEDA_PcbFrame::ImportSpecctraSession( wxCommandEvent& event ) |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
namespace DSN { |
|
|
|
|
|
|
|
|
|
|
|
static wxPoint mapPt( const POINT& aPoint, double aResolution ) |
|
|
|
static wxPoint mapPt( const POINT& aPoint, UNIT_RES* aResolution ) |
|
|
|
{ |
|
|
|
wxPoint ret; |
|
|
|
|
|
|
|
double resValue = aResolution->GetValue(); |
|
|
|
|
|
|
|
double factor; // multiply this times units to get mils for Kicad.
|
|
|
|
|
|
|
|
switch( aResolution->GetEngUnits() ) |
|
|
|
{ |
|
|
|
default: |
|
|
|
case T_inch: |
|
|
|
factor = 0.001; |
|
|
|
break; |
|
|
|
case T_mil: |
|
|
|
factor = 1.0; |
|
|
|
break; |
|
|
|
case T_cm: |
|
|
|
factor = 2.54/1000.0; |
|
|
|
break; |
|
|
|
case T_mm: |
|
|
|
factor = 25.4/1000.0; |
|
|
|
break; |
|
|
|
case T_um: |
|
|
|
factor = 25.4; |
|
|
|
break; |
|
|
|
} |
|
|
|
|
|
|
|
// the factor of 10.0 is used to convert mils to deci-mils, the units
|
|
|
|
// used within Kicad.
|
|
|
|
ret.x = (int) (10.0 * aPoint.x / aResolution); |
|
|
|
ret.y = (int) -(10.0 * aPoint.y / aResolution); |
|
|
|
factor *= 10.0; |
|
|
|
|
|
|
|
ret.x = (int) (factor * aPoint.x / resValue); |
|
|
|
ret.y = (int) -(factor * aPoint.y / resValue); // negate y coord
|
|
|
|
|
|
|
|
return ret; |
|
|
|
} |
|
|
|
@ -161,17 +191,16 @@ void SPECCTRA_DB::FromSESSION( BOARD* aBoard ) throw( IOError ) |
|
|
|
MODULE* module = aBoard->FindModuleByReference( reference ); |
|
|
|
if( !module ) |
|
|
|
{ |
|
|
|
wxString errorMsg; |
|
|
|
errorMsg.Printf( |
|
|
|
_("Session file has reference to non-existing component \"%s\""), |
|
|
|
ThrowIOError( |
|
|
|
_("Session file has 'reference' to non-existent component \"%s\""), |
|
|
|
reference.GetData() ); |
|
|
|
ThrowIOError( errorMsg ); |
|
|
|
} |
|
|
|
|
|
|
|
if( !place->hasVertex ) |
|
|
|
continue; |
|
|
|
|
|
|
|
double resolution = 100; //place->GetResolution();
|
|
|
|
UNIT_RES* resolution = place->GetUnits(); |
|
|
|
wxASSERT( resolution ); |
|
|
|
|
|
|
|
wxPoint newPos = mapPt( place->vertex, resolution ); |
|
|
|
module->SetPosition( newPos ); |
|
|
|
@ -180,19 +209,29 @@ void SPECCTRA_DB::FromSESSION( BOARD* aBoard ) throw( IOError ) |
|
|
|
{ |
|
|
|
// convert from degrees to tenths of degrees used in Kicad.
|
|
|
|
int orientation = (int) (place->rotation * 10.0); |
|
|
|
module->SetOrientation( orientation ); |
|
|
|
|
|
|
|
if( module->GetLayer() != CMP_N ) |
|
|
|
{ |
|
|
|
// module is on copper layer (back)
|
|
|
|
aBoard->Change_Side_Module( module, 0 ); |
|
|
|
} |
|
|
|
module->SetOrientation( orientation ); |
|
|
|
} |
|
|
|
else if( place->side == T_back ) |
|
|
|
{ |
|
|
|
int orientation = (int) (-place->rotation * 10.0 - 1800); |
|
|
|
module->SetOrientation( orientation ); |
|
|
|
|
|
|
|
int orientation = (place->rotation + 180.0) * 10.0; |
|
|
|
if( module->GetLayer() != COPPER_LAYER_N ) |
|
|
|
{ |
|
|
|
// module is on component layer (front)
|
|
|
|
aBoard->Change_Side_Module( module, 0 ); |
|
|
|
} |
|
|
|
module->SetOrientation( orientation ); |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
// as I write this, the LEXER *is* catching this, so we should never see below:
|
|
|
|
wxFAIL_MSG( wxT("DSN::LEXER did not catch an illegal side := 'back|front'") ); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@ -201,6 +240,8 @@ void SPECCTRA_DB::FromSESSION( BOARD* aBoard ) throw( IOError ) |
|
|
|
for( NET_OUTS::iterator i=net_outs.begin(); i!=net_outs.end(); ++i ) |
|
|
|
{ |
|
|
|
// create a track or via and position it.
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|