37#include <unordered_set>
53 std::unique_ptr<BOARD> board;
66 pi->SetReporter( aOptions.
reporter );
71 board = pi->LoadBoard( aFileName, aOptions.
properties, aProject );
96 return Load( aFileName, aFormat, aProject,
OPTIONS{} );
103 if( !aBoard || !aProject )
112 { aBoard->GetEmbeddedFiles() } );
136 bds.
m_DRCEngine = std::make_shared<DRC_ENGINE>( aBoard, &bds );
140 wxFileName rules = aFileName;
150 aBoard->
Add( marker );
163 aOptions.
reporter->
Report(
_(
"Could not load component class assignment rules" ),
175 std::unique_ptr<BOARD> brd = std::make_unique<BOARD>();
176 brd->SetProject( aProject );
193 wxLogError(
_(
"Cannot save board '%s': %s" ), aFileName, ioe.
What() );
196 catch(
const std::exception& e )
199 wxLogError(
_(
"Unexpected error saving board '%s': %s" ), aFileName,
200 wxString::FromUTF8( e.what() ) );
BASE_SCREEN class implementation.
static wxString m_DrawingSheetFileName
the name of the drawing sheet file, or empty to use the default drawing sheet
Container for design settings for a BOARD object.
std::shared_ptr< DRC_ENGINE > m_DRCEngine
static bool SaveBoard(wxString &aFileName, BOARD &aBoard, PCB_IO_MGR::PCB_FILE_T aFormat)
static std::unique_ptr< BOARD > CreateEmptyBoard(PROJECT *aProject)
static std::unique_ptr< BOARD > Load(const wxString &aFileName, PCB_IO_MGR::PCB_FILE_T aFormat, PROJECT *aProject, const OPTIONS &aOptions)
static void initializeLoadedBoard(BOARD *aBoard, const wxString &aFileName, PROJECT *aProject, const OPTIONS &aOptions)
Information pertinent to a Pcbnew printed circuit board.
void Add(BOARD_ITEM *aItem, ADD_MODE aMode=ADD_MODE::INSERT, bool aSkipConnectivity=false) override
Removes an item from the container.
void UpdateUserUnits(BOARD_ITEM *aItem, KIGFX::VIEW *aView)
Update any references within aItem (or its descendants) to the user units.
bool BuildConnectivity(PROGRESS_REPORTER *aReporter=nullptr)
Build or rebuild the board connectivity database for the board, especially the list of connected item...
void SynchronizeNetsAndNetClasses(bool aResetTrackAndViaSizes)
Copy NETCLASS info to each NET, based on NET membership in a NETCLASS.
void SetProject(PROJECT *aProject, bool aReferenceOnly=false)
Link a board to a given project.
std::vector< PCB_MARKER * > ResolveDRCExclusions(bool aCreateMarkers)
Rebuild DRC markers from the serialized data in BOARD_DESIGN_SETTINGS.
const wxString GetLayerName(PCB_LAYER_ID aLayer) const
Return the name of a aLayer.
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
void SynchronizeProperties()
Copy the current project's text variables into the boards property cache.
bool SynchronizeComponentClasses(const std::unordered_set< wxString > &aNewSheetPaths) const
Copy component class / component class generator information from the project settings.
void SynchronizeTuningProfileProperties()
Ensure that all time domain properties providers are in sync with current settings.
void InitEngine(const wxFileName &aRulePath)
Initialize the DRC engine.
static DS_DATA_MODEL & GetTheInstance()
Return the instance of DS_DATA_MODEL used in the application.
ENUM_MAP & Map(T aValue, const wxString &aName)
static ENUM_MAP< T > & Instance()
ENUM_MAP & Undefined(T aValue)
Provide an extensible class to resolve 3D model paths.
wxString ResolvePath(const wxString &aFileName, const wxString &aWorkingPath, std::vector< const EMBEDDED_FILES * > aEmbeddedFilesStack)
Determine the full path of the given file name.
void SetProgramBase(PGM_BASE *aBase)
Set a pointer to the application's PGM_BASE instance used to extract the local env vars.
bool SetProject(const PROJECT *aProject, bool *flgChanged=nullptr)
Set the current KiCad project directory as the first entry in the model path list.
Hold an error message and may be used when throwing exceptions containing meaningful error messages.
virtual const wxString What() const
A composite of Problem() and Where()
static const LSET & AllLayersMask()
static wxString Name(PCB_LAYER_ID aLayerId)
Return the fixed name association with aLayerId.
PCB_FILE_T
The set of file types that the PCB_IO_MGR knows about, and for which there has been a plugin written,...
@ KICAD_SEXP
S-expression Pcbnew file format.
static void Save(PCB_FILE_T aFileType, const wxString &aFileName, BOARD &aBoard, const std::map< std::string, UTF8 > *aProperties=nullptr)
Write either a full aBoard to a storage file in a format that this implementation knows about,...
static PCB_IO * FindPlugin(PCB_FILE_T aFileType)
Return a PCB_IO which the caller can use to import, export, save, or load design documents.
static std::unique_ptr< BOARD > Load(PCB_FILE_T aFileType, const wxString &aFileName, const std::map< std::string, UTF8 > *aProperties=nullptr, PROJECT *aProject=nullptr, PROGRESS_REPORTER *aProgressReporter=nullptr)
Find the requested PCB_IO and if found, calls the PCB_IO::LoadBoard() function on it using the argume...
wxString m_BoardDrawingSheetFile
PcbNew params.
Container for project specific data.
virtual const wxString GetProjectPath() const
Return the full path of the project.
virtual PROJECT_FILE & GetProjectFile() const
virtual REPORTER & Report(const wxString &aText, SEVERITY aSeverity=RPT_SEVERITY_UNDEFINED)
Report a string with a given severity.
static const std::string DesignRulesFileExtension
std::unique_ptr< T > IO_RELEASER
Helper to hold and release an IO_BASE object when exceptions are thrown.
PCB_LAYER_ID
A quick note on layer IDs:
PGM_BASE * PgmOrNull()
Return a reference that can be nullptr when running a shared lib from a script, not from a kicad app.
std::function< void(const wxString &, const wxString &)> drawing_sheet_error_callback
bool initialize_after_load
std::function< void(PCB_IO &)> plugin_configurator
std::function< void(PCB_IO &)> post_load_hook
const std::map< std::string, UTF8 > * properties
PROGRESS_REPORTER * progress_reporter
Definition of file extensions used in Kicad.