From ecce28a4723e25987898950e490dbcd84f8e7157 Mon Sep 17 00:00:00 2001 From: Alex Date: Wed, 31 Jan 2024 08:22:20 +0300 Subject: [PATCH] Altium schematic import: fix power ports. Use different symbol names for different port port styles. Also fixes curved shapes construction. Fixes https://gitlab.com/kicad/code/kicad/-/issues/16823 (cherry picked from commit 6225ef69b6a89694c8531b11f1e59128c34aae39) --- .../sch_plugins/altium/sch_altium_plugin.cpp | 23 ++++++++++++------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/eeschema/sch_plugins/altium/sch_altium_plugin.cpp b/eeschema/sch_plugins/altium/sch_altium_plugin.cpp index 61c35b6ebf..f86cf0e210 100644 --- a/eeschema/sch_plugins/altium/sch_altium_plugin.cpp +++ b/eeschema/sch_plugins/altium/sch_altium_plugin.cpp @@ -2177,10 +2177,10 @@ VECTOR2I HelperGeneratePowerPortGraphics( LIB_SYMBOL* aKsymbol, ASCH_POWER_PORT_ LIB_SHAPE* bezier = new LIB_SHAPE( aKsymbol, SHAPE_T::BEZIER ); aKsymbol->AddDrawItem( bezier ); bezier->SetStroke( STROKE_PARAMS( schIUScale.MilsToIU( 5 ), PLOT_DASH_TYPE::SOLID ) ); - bezier->AddPoint( { schIUScale.MilsToIU( 30 ), schIUScale.MilsToIU( -50 ) } ); - bezier->AddPoint( { schIUScale.MilsToIU( 30 ), schIUScale.MilsToIU( -87 ) } ); - bezier->AddPoint( { schIUScale.MilsToIU( -30 ), schIUScale.MilsToIU( -63 ) } ); - bezier->AddPoint( { schIUScale.MilsToIU( -30 ), schIUScale.MilsToIU( -100 ) } ); + bezier->SetStart( { schIUScale.MilsToIU( 30 ), schIUScale.MilsToIU( -50 ) } ); + bezier->SetBezierC1( { schIUScale.MilsToIU( 30 ), schIUScale.MilsToIU( -87 ) } ); + bezier->SetBezierC2( { schIUScale.MilsToIU( -30 ), schIUScale.MilsToIU( -63 ) } ); + bezier->SetEnd( { schIUScale.MilsToIU( -30 ), schIUScale.MilsToIU( -100 ) } ); return { 0, schIUScale.MilsToIU( 150 ) }; } @@ -2343,10 +2343,17 @@ VECTOR2I HelperGeneratePowerPortGraphics( LIB_SYMBOL* aKsymbol, ASCH_POWER_PORT_ void SCH_ALTIUM_PLUGIN::ParsePowerPort( const std::map& aProperties ) { ASCH_POWER_PORT elem( aProperties ); - LIB_ID libId = AltiumToKiCadLibID( getLibName(), elem.text ); - LIB_SYMBOL* libSymbol = nullptr; - const auto& powerSymbolIt = m_powerSymbols.find( elem.text ); + wxString symName( elem.text ); + wxString styleName = wxString( "Style" ) << static_cast( elem.style ); + + if( !styleName.empty() ) + symName << '_' << styleName; + + LIB_ID libId = AltiumToKiCadLibID( getLibName(), symName ); + LIB_SYMBOL* libSymbol = nullptr; + + const auto& powerSymbolIt = m_powerSymbols.find( symName ); if( powerSymbolIt != m_powerSymbols.end() ) { @@ -2384,7 +2391,7 @@ void SCH_ALTIUM_PLUGIN::ParsePowerPort( const std::map& aPro // this has to be done after parsing the LIB_SYMBOL! m_pi->SaveSymbol( getLibFileName().GetFullPath(), libSymbol, m_properties.get() ); - m_powerSymbols.insert( { elem.text, libSymbol } ); + m_powerSymbols.insert( { symName, libSymbol } ); } SCH_SCREEN* screen = getCurrentScreen();