diff --git a/pcbnew/python/scripting/pcbnew_scripting_helpers.cpp b/pcbnew/python/scripting/pcbnew_scripting_helpers.cpp index 279981ebfc..b57d10cbe5 100644 --- a/pcbnew/python/scripting/pcbnew_scripting_helpers.cpp +++ b/pcbnew/python/scripting/pcbnew_scripting_helpers.cpp @@ -37,6 +37,7 @@ #include #include #include +#include #include #include #include @@ -54,6 +55,7 @@ #include #include #include +#include static PCB_EDIT_FRAME* s_PcbEditFrame = nullptr; @@ -156,6 +158,16 @@ BOARD* LoadBoard( wxString& aFileName, IO_MGR::PCB_FILE_T aFormat ) if( !project ) project = GetDefaultProject(); + BASE_SCREEN::m_DrawingSheetFileName = project->GetProjectFile().m_BoardDrawingSheetFile; + + // Load the drawing sheet from the filename stored in BASE_SCREEN::m_DrawingSheetFileName. + // If empty, or not existing, the default drawing sheet is loaded. + wxString filename = DS_DATA_MODEL::ResolvePath( BASE_SCREEN::m_DrawingSheetFileName, + project->GetProjectPath() ); + + if( !DS_DATA_MODEL::GetTheInstance().LoadDrawingSheet( filename ) ) + wxFprintf( stderr, _( "Error loading drawing sheet." ) ); + BOARD* brd = IO_MGR::Load( aFormat, aFileName ); if( brd )