diff --git a/eeschema/dialogs/dialog_lib_symbol_properties.cpp b/eeschema/dialogs/dialog_lib_symbol_properties.cpp index 5090ae381b..7e8c4fa4b5 100644 --- a/eeschema/dialogs/dialog_lib_symbol_properties.cpp +++ b/eeschema/dialogs/dialog_lib_symbol_properties.cpp @@ -591,7 +591,7 @@ void DIALOG_LIB_SYMBOL_PROPERTIES::OnEditSpiceModel( wxCommandEvent& event ) { #ifdef KICAD_SPICE int diff = m_fields->size(); - auto symbol = SCH_SYMBOL( *m_libEntry, m_libEntry->GetLibId(), nullptr ); + auto symbol = SCH_SYMBOL( *m_libEntry, m_libEntry->GetLibId(), nullptr, 0 ); DIALOG_SPICE_MODEL dialog( this, symbol, m_fields ); diff --git a/eeschema/sch_plugins/kicad/sch_sexpr_plugin.cpp b/eeschema/sch_plugins/kicad/sch_sexpr_plugin.cpp index 13d798c2a3..cebdb1007e 100644 --- a/eeschema/sch_plugins/kicad/sch_sexpr_plugin.cpp +++ b/eeschema/sch_plugins/kicad/sch_sexpr_plugin.cpp @@ -685,14 +685,12 @@ void SCH_SEXPR_PLUGIN::saveSymbol( SCH_SYMBOL* aSymbol, SCH_SHEET_PATH* aSheetPa m_out->Print( 0, ")" ); } - int unit = -1; + int unit = aSymbol->GetUnit(); - if( !( aSymbol->GetInstanceReferences().size() > 1 ) ) - unit = aSymbol->GetUnit(); - else if( aSheetPath != nullptr ) + if( ( aSymbol->GetInstanceReferences().size() > 1 ) && aSheetPath ) unit = aSymbol->GetUnitSelection( aSheetPath ); - if ( unit >= 0 ) - m_out->Print( 0, " (unit %d)", unit ); + + m_out->Print( 0, " (unit %d)", unit ); if( aSymbol->GetConvert() == LIB_ITEM::LIB_CONVERT::DEMORGAN ) m_out->Print( 0, " (convert %d)", aSymbol->GetConvert() ); diff --git a/eeschema/sch_symbol.h b/eeschema/sch_symbol.h index 248d2b5ed7..97c3f400ef 100644 --- a/eeschema/sch_symbol.h +++ b/eeschema/sch_symbol.h @@ -92,7 +92,7 @@ public: * @param setNewItemFlag is used to set the symbol #IS_NEW and #IS_MOVING flags. */ SCH_SYMBOL( const LIB_SYMBOL& aSymbol, const LIB_ID& aLibId, const SCH_SHEET_PATH* aSheet, - int unit = 0, int convert = 0, const VECTOR2I& pos = VECTOR2I( 0, 0 ) ); + int unit, int convert = 0, const VECTOR2I& pos = VECTOR2I( 0, 0 ) ); SCH_SYMBOL( const LIB_SYMBOL& aSymbol, const SCH_SHEET_PATH* aSheet, const PICKED_SYMBOL& aSel, const VECTOR2I& pos = VECTOR2I( 0, 0 ) );