From 2973d292d98d3a0bec9b04d5085bb30cce4f453f Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Fri, 3 Mar 2023 10:56:58 +0000 Subject: [PATCH] Handle alternate pin definitions when printing. Fixes https://gitlab.com/kicad/code/kicad/issues/14122 --- eeschema/sch_symbol.cpp | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/eeschema/sch_symbol.cpp b/eeschema/sch_symbol.cpp index 7da9ac1e9c..571338c81c 100644 --- a/eeschema/sch_symbol.cpp +++ b/eeschema/sch_symbol.cpp @@ -467,7 +467,25 @@ void SCH_SYMBOL::Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffse if( m_part ) { - m_part->Print( aSettings, m_pos + aOffset, m_unit, m_convert, opts, GetDNP() ); + LIB_PINS libPins; + m_part->GetPins( libPins, m_unit, m_convert ); + + LIB_SYMBOL tempSymbol( *m_part ); + LIB_PINS tempPins; + tempSymbol.GetPins( tempPins, m_unit, m_convert ); + + // Copy the pin info from the symbol to the temp pins + for( unsigned i = 0; i < tempPins.size(); ++ i ) + { + SCH_PIN* symbolPin = GetPin( libPins[ i ] ); + LIB_PIN* tempPin = tempPins[ i ]; + + tempPin->SetName( symbolPin->GetShownName() ); + tempPin->SetType( symbolPin->GetType() ); + tempPin->SetShape( symbolPin->GetShape() ); + } + + tempSymbol.Print( aSettings, m_pos + aOffset, m_unit, m_convert, opts, GetDNP() ); } else // Use dummy() part if the actual cannot be found. { @@ -2165,7 +2183,7 @@ void SCH_SYMBOL::Plot( PLOTTER* aPlotter, bool aBackground ) const tempSymbol.Plot( aPlotter, GetUnit(), GetConvert(), local_background, m_pos, temp, GetDNP() ); - for( SCH_FIELD field : m_fields ) + for( const SCH_FIELD& field : m_fields ) field.Plot( aPlotter, local_background ); }