31 #undef HAVE_CLOCK_GETTIME // macro is defined in Python.h and causes redefine warning 121 wxFileName pro = aFileName;
124 wxString projectPath = pro.GetFullPath();
152 bds.
m_DRCEngine = std::make_shared<DRC_ENGINE>( brd, &bds );
156 wxFileName rules = pro;
194 wxFileName pro = aFileName;
197 wxString projectPath = pro.GetFullPath();
229 wxArrayString footprintLibraryNames;
234 return footprintLibraryNames;
237 footprintLibraryNames.Add(
name );
239 return footprintLibraryNames;
245 wxArrayString footprintNames;
250 return footprintNames;
254 return footprintNames;
271 bool ExportVRML(
const wxString& aFullFileName,
double aMMtoWRMLunit,
272 bool aExport3DFiles,
bool aUseRelativePaths,
273 bool aUsePlainPCB,
const wxString& a3D_Subdir,
274 double aXRef,
double aYRef )
279 aExport3DFiles, aUseRelativePaths,
280 aUsePlainPCB, a3D_Subdir, aXRef, aYRef );
353 bool aReportAllTrackErrors )
355 wxCHECK( aBoard,
false );
358 std::shared_ptr<DRC_ENGINE> engine = bds.
m_DRCEngine;
362 bds.
m_DRCEngine = std::make_shared<DRC_ENGINE>( aBoard, &bds );
366 wxCHECK( engine,
false );
374 engine->InitEngine( drcRulesPath );
381 std::vector<std::shared_ptr<DRC_ITEM>> footprints;
382 std::vector<std::shared_ptr<DRC_ITEM>> unconnected;
383 std::vector<std::shared_ptr<DRC_ITEM>> violations;
385 engine->SetProgressReporter(
nullptr );
387 engine->SetViolationHandler(
388 [&](
const std::shared_ptr<DRC_ITEM>& aItem, wxPoint aPos )
395 footprints.push_back( aItem );
399 unconnected.push_back( aItem );
403 violations.push_back( aItem );
407 engine->RunTests( aUnits, aReportAllTrackErrors,
false );
408 engine->ClearViolationHandler();
412 FILE* fp = wxFopen( aFileName, wxT(
"w" ) );
417 std::map<KIID, EDA_ITEM*> itemMap;
422 wxDateTime now = wxDateTime::Now();
424 fprintf( fp,
"** Created on %s **\n",
TO_UTF8( now.Format( wxT(
"%F %T" ) ) ) );
426 fprintf( fp,
"\n** Found %d DRC violations **\n", static_cast<int>( violations.size() ) );
428 for(
const std::shared_ptr<DRC_ITEM>& item : violations )
431 fprintf( fp,
"%s",
TO_UTF8( item->ShowReport( aUnits, severity, itemMap ) ) );
434 fprintf( fp,
"\n** Found %d unconnected pads **\n", static_cast<int>( unconnected.size() ) );
436 for(
const std::shared_ptr<DRC_ITEM>& item : unconnected )
439 fprintf( fp,
"%s",
TO_UTF8( item->ShowReport( aUnits, severity, itemMap ) ) );
442 fprintf( fp,
"\n** Found %d Footprint errors **\n", static_cast<int>( footprints.size() ) );
444 for(
const std::shared_ptr<DRC_ITEM>& item : footprints )
447 fprintf( fp,
"%s",
TO_UTF8( item->ShowReport( aUnits, severity, itemMap ) ) );
450 fprintf( fp,
"\n** End of Report **\n" );
void UpdateUserInterface()
Update the layer manager and other widgets from the board setup (layer and items visibility,...
LSET m_VisibleLayers
Board settings.
BOARD * LoadBoard(wxString &aFileName)
bool WriteDRCReport(BOARD *aBoard, const wxString &aFileName, EDA_UNITS aUnits, bool aReportAllTrackErrors)
Runs the DRC check on the given board and writes the results to a report file.
PROJECT & Prj() const
A helper while we are not MDI-capable – return the one and only project.
static bool IsActionRunning()
Function IsActionRunning.
Container for project specific data.
int GetUserUnits()
Returns the currently selected user unit value for the interface.
const std::string ProjectFileExtension
const std::string LegacyPcbFileExtension
void ActivateGalCanvas() override
Set the #m_Pcb member in such as way as to ensure deleting any previous BOARD.
PCB_DRAW_PANEL_GAL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
const std::string DesignRulesFileExtension
bool ExportFootprintsToLibrary(bool aStoreInNewLib, const wxString &aLibName, wxString *aLibPath)
Function ExportFootprintsToLibrary Save footprints in a library:
wxArrayString GetFootprints(const wxString &aNickName)
will get the names of all of the footprints available in a footprint library
PROJECT * GetProject() const
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
This is the end of the layers used for visibility bit masks in Pcbnew.
const std::string KiCadPcbFileExtension
void ScriptingSetPcbEditFrame(PCB_EDIT_FRAME *aPcbEditFrame)
const wxString & GetFileName() const
virtual const wxString AbsolutePath(const wxString &aFileName) const
Fix up aFileName if it is relative to the project's directory to be an absolute path and filename.
virtual PROJECT_LOCAL_SETTINGS & GetLocalSettings() const
void ExportFootprintsToLibrary(bool aStoreInNewLib, const wxString &aLibName=wxEmptyString, wxString *aLibPath=NULL)
Save footprints in a library:
bool IsActionRunning()
Are we currently in an action plugin?
wxArrayString GetFootprintLibraries()
will get the nicknames of all of the footprint libraries configured in pcbnew in both the project and...
#define TO_UTF8(wxstring)
Convert a wxString to a UTF8 encoded C string for all wxWidgets build modes.
void FootprintEnumerate(wxArrayString &aFootprintNames, const wxString &aNickname, bool aBestEfforts)
Return a list of footprint names contained within the library given by aNickname.
void SynchronizeNetsAndNetClasses()
Copy NETCLASS info to each NET, based on NET membership in a NETCLASS.
void Add(BOARD_ITEM *aItem, ADD_MODE aMode=ADD_MODE::INSERT) override
Adds an item to the container.
std::vector< PCB_MARKER * > ResolveDRCExclusions()
Rebuild DRC markers from the serialized data in BOARD_DESIGN_SETTINGS.
static wxApp * s_WxApp
A valid app is needed for preventing some asserts when opening the settings manager.
GAL_SET m_VisibleItems
The GAL layers (aka items) that are turned on for viewing (.
void Refresh()
Update the board display after modifying it by a python script (note: it is automatically called by a...
#define GAL_LAYER_INDEX(x)
Use this macro to convert a GAL layer to a 0-indexed offset from LAYER_VIAS.
static SETTINGS_MANAGER * s_SettingsManager
bool ImportSpecctraSES(wxString &aFullFilename)
will import a specctra *.ses file and use it to relocate MODULEs and to replace all vias and tracks i...
Definition of file extensions used in Kicad.
SEVERITY GetSeverity(int aDRCErrorCode)
void BuildConnectivity()
Builds or rebuilds the board connectivity database for the board, especially the list of connected it...
void UpdateUserInterface()
Update the layer manager and other widgets from the board setup (layer and items visibility,...
FP_LIB_TABLE * GetFootprintLibraryTable()
bool ExportSpecctraDSN(wxString &aFullFilename)
will export the current BOARD to a specctra dsn file.
SETTINGS_MANAGER * GetSettingsManager()
bool ExportVRML(const wxString &aFullFileName, double aMMtoWRMLunit, bool aExport3DFiles, bool aUseRelativePaths, bool aUsePlainPCB, const wxString &a3D_Subdir, double aXRef, double aYRef)
will export the current BOARD to a VRML (wrl) file.
PROJECT * GetDefaultProject()
virtual void Refresh(bool aEraseBackground=true, const wxRect *aRect=NULL) override
Update the board display after modifying it by a python script (note: it is automatically called by a...
static BOARD * Load(PCB_FILE_T aFileType, const wxString &aFileName, BOARD *aAppendToMe=nullptr, const PROPERTIES *aProperties=nullptr, PROJECT *aProject=nullptr)
Find the requested PLUGIN and if found, calls the PLUGIN::Load() function on it using the arguments p...
virtual FP_LIB_TABLE * PcbFootprintLibs(KIWAY &aKiway)
Return the table of footprint libraries.
bool LoadProject(const wxString &aFullPath, bool aSetActive=true)
Loads a project or sets up a new project with a specified path.
void SetProject(PROJECT *aProject)
Links a board to a given project.
bool ImportSpecctraSession(const wxString &aFullFilename)
Import a specctra *.ses file and use it to relocate MODULEs and to replace all vias and tracks in an ...
bool SaveBoard(wxString &aFileName, BOARD *aBoard, IO_MGR::PCB_FILE_T aFormat)
A filename or source description, a problem input line, a line number, a byte offset,...
Class PCBNEW_ACTION_PLUGINS.
Legacy Pcbnew file formats prior to s-expression.
bool ExportVRML_File(const wxString &aFullFileName, double aMMtoWRMLunit, bool aExport3DFiles, bool aUseRelativePaths, bool aUsePlainPCB, const wxString &a3D_Subdir, double aXRef, double aYRef)
Creates the file(s) exporting current BOARD to a VRML file.
static void Save(PCB_FILE_T aFileType, const wxString &aFileName, BOARD *aBoard, const PROPERTIES *aProperties=nullptr)
Write either a full aBoard to a storage file in a format that this implementation knows about,...
Information pertinent to a Pcbnew printed circuit board.
bool SaveProject(const wxString &aFullPath=wxEmptyString)
Saves a loaded project.
The main frame for Pcbnew.
BOARD * CreateEmptyBoard()
Constructs a default BOARD with a tempoary (no filename) project.
PCB_FILE_T
The set of file types that the IO_MGR knows about, and for which there has been a plugin written.
void FillItemMap(std::map< KIID, EDA_ITEM * > &aMap)
LSET m_LegacyVisibleLayers
Visibility settings stored in board prior to 6.0, only used for loading legacy files.
std::shared_ptr< DRC_ENGINE > m_DRCEngine
PROJECT * GetProject(const wxString &aFullPath) const
Retrieves a loaded project by name.
EDA_UNITS GetUserUnits() const
Return the user units currently in use.
static PCB_EDIT_FRAME * s_PcbEditFrame
std::vector< wxString > GetLogicalLibs()
Return the logical library names, all of them that are pertinent to a look up done on this LIB_TABLE.
bool ExportSpecctraFile(const wxString &aFullFilename)
Export the current BOARD to a specctra dsn file.
S-expression Pcbnew file format.
Container for design settings for a BOARD object.
GAL_SET m_LegacyVisibleItems