altium: add non working fix for rounding error
This commit is contained in:
parent
0b190f02dc
commit
19cfd7bd3a
|
@ -119,6 +119,37 @@ ASCH_PIN::ASCH_PIN( const std::map<wxString, wxString>& aProperties )
|
|||
int p = ALTIUM_PARSER::PropertiesReadInt( aProperties, "PINLENGTH", 0 );
|
||||
int pfrac = ALTIUM_PARSER::PropertiesReadInt( aProperties, "PINLENGTH_FRAC", 0 );
|
||||
pinlength = Altium2KiCadUnit( p, pfrac );
|
||||
|
||||
// this code calculates the location as required by KiCad without rounding error attached
|
||||
int kicadX = x;
|
||||
int kicadXfrac = xfrac;
|
||||
int kicadY = y;
|
||||
int kicadYfrac = yfrac;
|
||||
|
||||
switch( orientation )
|
||||
{
|
||||
case ASCH_PIN_ORIENTATION::RIGHTWARDS:
|
||||
kicadX += p;
|
||||
kicadXfrac += pfrac;
|
||||
break;
|
||||
case ASCH_PIN_ORIENTATION::UPWARDS:
|
||||
kicadY += p;
|
||||
kicadYfrac += pfrac;
|
||||
break;
|
||||
case ASCH_PIN_ORIENTATION::LEFTWARDS:
|
||||
kicadX -= p;
|
||||
kicadXfrac -= pfrac;
|
||||
break;
|
||||
case ASCH_PIN_ORIENTATION::DOWNWARDS:
|
||||
kicadY -= p;
|
||||
kicadYfrac -= pfrac;
|
||||
break;
|
||||
default:
|
||||
wxLogWarning( "Pin has unexpected orientation" );
|
||||
break;
|
||||
}
|
||||
kicadLocation = wxPoint(
|
||||
Altium2KiCadUnit( kicadX, kicadXfrac ), -Altium2KiCadUnit( kicadY, kicadYfrac ) );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -187,6 +187,8 @@ struct ASCH_PIN
|
|||
wxPoint location;
|
||||
int pinlength;
|
||||
|
||||
wxPoint kicadLocation; // location of pin in KiCad without rounding error
|
||||
|
||||
bool showPinName;
|
||||
bool showDesignator;
|
||||
|
||||
|
|
|
@ -504,7 +504,10 @@ void SCH_ALTIUM_PLUGIN::ParsePin( const std::map<wxString, wxString>& aPropertie
|
|||
break;
|
||||
}
|
||||
|
||||
// TODO: position can be sometimes off a little bit!
|
||||
pin->SetPosition( GetRelativePosition( pinLocation, component ) );
|
||||
// TODO: the following fix is even worse for now?
|
||||
// pin->SetPosition( GetRelativePosition( elem.kicadLocation, component ) );
|
||||
|
||||
switch( elem.electrical )
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue