55 bool aForceDefaultProject,
PROJECT* aProject,
bool aCalculateConnectivity )
58 return LoadSchematic( aFileName, SCH_IO_MGR::SCH_KICAD, aSetActive, aForceDefaultProject,
59 aProject, aCalculateConnectivity );
61 return LoadSchematic( aFileName, SCH_IO_MGR::SCH_LEGACY, aSetActive, aForceDefaultProject,
62 aProject, aCalculateConnectivity );
65 return LoadSchematic( aFileName, SCH_IO_MGR::SCH_LEGACY, aSetActive, aForceDefaultProject, aProject,
66 aCalculateConnectivity );
71 SCH_IO_MGR::SCH_FILE_T aFormat,
73 bool aForceDefaultProject,
75 bool aCalculateConnectivity )
77 wxFileName pro = aFileName;
80 wxString projectPath = pro.GetFullPath();
94 if( !aForceDefaultProject )
98 if( wxFileExists( projectPath ) )
112 if( !
project || aForceDefaultProject )
118 schematic->CreateDefaultScreens();
120 wxFileName schFile = aFileName;
121 schFile.MakeAbsolute();
125 SCH_SHEET* rootSheet = pi->LoadSchematicFile( schFile.GetFullPath(), schematic );
130 std::vector<SCH_SHEET*> topLevelSheets = schematic->GetTopLevelSheets();
131 bool rootIsTopLevel = std::find( topLevelSheets.begin(), topLevelSheets.end(), rootSheet )
132 != topLevelSheets.end();
133 bool rootIsVirtualRoot = rootSheet == &schematic->Root() || rootSheet->
IsVirtualRootSheet();
135 if( !rootIsTopLevel && !rootIsVirtualRoot )
136 schematic->SetTopLevelSheets( { rootSheet } );
141 if( rootSheet->
GetName().IsEmpty() )
143 wxString rootName =
_(
"Root" );
147 wxFileName candidate(
project->GetProjectPath(),
info.filename );
149 if( candidate.SameAs( schFile ) && !
info.name.IsEmpty() )
151 rootName =
info.name;
156 rootSheet->
SetName( rootName );
164 SCH_SHEET_LIST sheetList = schematic->BuildSheetListSortedByPageNumbers();
168 screen->UpdateLocalLibSymbolLinks();
170 if( schematic->RootScreen()->GetFileFormatVersionAtLoad() < 20221002 )
175 if( schematic->RootScreen()->GetFileFormatVersionAtLoad() < 20230221 )
179 screen->MigrateSimModels();
181 schematic->LoadVariants();
183 wxString projectName =
project->GetProjectName();
185 if( projectName.IsEmpty() )
186 projectName = schFile.GetName();
196 schematic->ConnectionGraph()->Reset();
201 if( aCalculateConnectivity )
204 schematic->RecalculateConnections( &dummyCommit,
GLOBAL_CLEANUP, toolManager );
207 schematic->ResolveERCExclusionsPostUpdate();
209 schematic->SetSheetNumberAndCount();
210 schematic->RecomputeIntersheetRefs();
214 sheet.UpdateAllScreenReferences();
215 sheet.LastScreen()->TestDanglingEnds(
nullptr,
nullptr );
218 if( aCalculateConnectivity )
219 schematic->ConnectionGraph()->Recalculate( sheetList,
true );
KIFACE_BASE & Kiface()
Global KIFACE_BASE "get" accessor.