Altium: Apply symbol orientation and mirroring on import
Apply the symbol orientation and mirroring from Altium schematic files
when importing. Previously, all imported symbols were placed at 0 degree
rotation regardless of their original orientation in Altium.
The orientation mapping follows the same pattern used for power ports:
- Altium 0 (RIGHTWARDS) -> KiCad SYM_ORIENT_90
- Altium 1 (UPWARDS) -> KiCad SYM_ORIENT_180
- Altium 2 (LEFTWARDS) -> KiCad SYM_ORIENT_270
- Altium 3 (DOWNWARDS) -> KiCad SYM_ORIENT_0
When the symbol is mirrored in Altium, SYM_MIRROR_Y is also applied.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/19630
(cherry picked from commit 090583a57e)
This commit is contained in:
@@ -1645,8 +1645,21 @@ void SCH_IO_ALTIUM::ParseComponent( int aIndex, const std::map<wxString, wxStrin
|
||||
for( SCH_FIELD& field : symbol->GetFields() )
|
||||
field.SetVisible( false );
|
||||
|
||||
// TODO: keep it simple for now, and only set position.
|
||||
// component->SetOrientation( elem.orientation );
|
||||
int orientation = SYMBOL_ORIENTATION_T::SYM_ORIENT_0;
|
||||
|
||||
switch( elem.orientation )
|
||||
{
|
||||
case 0: orientation = SYMBOL_ORIENTATION_T::SYM_ORIENT_90; break;
|
||||
case 1: orientation = SYMBOL_ORIENTATION_T::SYM_ORIENT_180; break;
|
||||
case 2: orientation = SYMBOL_ORIENTATION_T::SYM_ORIENT_270; break;
|
||||
case 3: orientation = SYMBOL_ORIENTATION_T::SYM_ORIENT_0; break;
|
||||
default: break;
|
||||
}
|
||||
|
||||
if( elem.isMirrored )
|
||||
orientation += SYMBOL_ORIENTATION_T::SYM_MIRROR_Y;
|
||||
|
||||
symbol->SetOrientation( orientation );
|
||||
|
||||
// If Altium has defined a library from which we have the part,
|
||||
// use this as the designated source library.
|
||||
|
||||
Reference in New Issue
Block a user