diff --git a/eeschema/files-io.cpp b/eeschema/files-io.cpp index d0f513fa5f..267f3dd9c9 100644 --- a/eeschema/files-io.cpp +++ b/eeschema/files-io.cpp @@ -58,6 +58,7 @@ #include #include #include +#include #include #include @@ -1150,7 +1151,10 @@ bool SCH_EDIT_FRAME::importFile( const wxString& aFileName, int aFileType ) // Only fix junctions for CADSTAR importer for now as it may cause issues with // other importers if( fileType == SCH_IO_MGR::SCH_CADSTAR_ARCHIVE ) - FixupJunctions(); + { + FixupJunctions( true ); + RecalculateConnections( GLOBAL_CLEANUP ); + } // Only perform the dangling end test on root sheet. GetScreen()->TestDanglingEnds(); diff --git a/eeschema/sch_edit_frame.cpp b/eeschema/sch_edit_frame.cpp index 480ff78c3c..49a4eebe98 100644 --- a/eeschema/sch_edit_frame.cpp +++ b/eeschema/sch_edit_frame.cpp @@ -1498,7 +1498,7 @@ const BOX2I SCH_EDIT_FRAME::GetDocumentExtents( bool aIncludeAllVisible ) const } -void SCH_EDIT_FRAME::FixupJunctions() +void SCH_EDIT_FRAME::FixupJunctions( bool aAddNeededJunctions ) { // Save the current sheet, to retrieve it later SCH_SHEET_PATH oldsheetpath = GetCurrentSheet(); @@ -1534,6 +1534,16 @@ void SCH_EDIT_FRAME::FixupJunctions() for( const wxPoint& pos : junctions ) AddJunction( screen, pos, false, false ); + if( aAddNeededJunctions ) + { + EE_SELECTION allItems; + + for( auto item : screen->Items() ) + allItems.Add( item ); + + m_toolManager->RunAction( EE_ACTIONS::addNeededJunctions, true, &allItems ); + } + if( junctions.size() ) modified = true; } diff --git a/eeschema/sch_edit_frame.h b/eeschema/sch_edit_frame.h index 093d14b7dd..94982dcbbe 100644 --- a/eeschema/sch_edit_frame.h +++ b/eeschema/sch_edit_frame.h @@ -813,7 +813,7 @@ public: const BOX2I GetDocumentExtents( bool aIncludeAllVisible = true ) const override; - void FixupJunctions(); + void FixupJunctions( bool aAddNeededJunctions = false ); void FocusOnItem( SCH_ITEM* aItem );