KiCad PCB EDA Suite
Loading...
Searching...
No Matches
pcbnew_scripting_helpers.h
Go to the documentation of this file.
1/*
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright (C) 2013 NBEE Embedded Systems SL, Miguel Angel Ajo <[email protected]>
5 * Copyright (C) 2013-2023 KiCad Developers, see AUTHORS.txt for contributors.
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, you may find one here:
19 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
20 * or you may search the http://www.gnu.org website for the version 2 license,
21 * or you may write to the Free Software Foundation, Inc.,
22 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
23 */
24
25#ifndef __PCBNEW_SCRIPTING_HELPERS_H
26#define __PCBNEW_SCRIPTING_HELPERS_H
27
28#include <deque>
29#include <pcb_io/pcb_io_mgr.h>
30#include <layer_ids.h>
31
32class PCB_EDIT_FRAME;
33class BOARD;
35class BOARD_ITEM;
36enum class EDA_UNITS;
37enum PCB_LAYER_ID : int;
38
39/* we could be including all these methods as static in a class, but
40 * we want plain pcbnew.<method_name> access from python
41 */
42
43#ifndef SWIG
44void ScriptingSetPcbEditFrame( PCB_EDIT_FRAME* aPCBEdaFrame );
46
47#endif
48
49// For Python scripts: return the current board.
51
58BOARD* LoadBoard( const wxString& aFileName, PCB_IO_MGR::PCB_FILE_T aFormat );
59
60#ifndef SWIG
66BOARD* LoadBoard( const wxString& aFileName, PCB_IO_MGR::PCB_FILE_T aFormat, bool aSetActive );
67#endif
68
69// Default LoadBoard() to load .kicad_pcb files:.
70#ifndef SWIG
71
78BOARD* LoadBoard( const wxString& aFileName, bool aSetActive );
79#endif
80
88BOARD* LoadBoard( const wxString& aFileName );
89
96BOARD* NewBoard( wxString& aFileName );
97
99
106
116bool SaveBoard( wxString& aFileName, BOARD* aBoard, bool aSkipSettings = false );
117
124wxArrayString GetFootprintLibraries();
125
132wxArrayString GetFootprints( const wxString& aNickName );
133
141bool ExportSpecctraDSN( wxString& aFullFilename );
142
152bool ExportSpecctraDSN( BOARD* aBoard, wxString& aFullFilename );
153
160bool ExportVRML( const wxString& aFullFileName, double aMMtoWRMLunit, bool aIncludeUnspecified,
161 bool aIncludeDNP, bool aExport3DFiles,
162 bool aUseRelativePaths, const wxString& a3D_Subdir, double aXRef, double aYRef );
163
172bool ImportSpecctraSES( wxString& aFullFilename );
173
183bool ImportSpecctraSES( BOARD* aBoard, wxString& aFullFilename );
184
196bool ExportFootprintsToLibrary( bool aStoreInNewLib, const wxString& aLibName = wxEmptyString,
197 wxString* aLibPath = nullptr );
198
207void Refresh();
208
216
222int GetUserUnits();
223
227std::deque<BOARD_ITEM*> GetCurrentSelection();
228
235void FocusOnItem( BOARD_ITEM* aItem, PCB_LAYER_ID aLayer = UNDEFINED_LAYER );
236
240bool IsActionRunning();
241
254bool WriteDRCReport( BOARD* aBoard, const wxString& aFileName, EDA_UNITS aUnits,
255 bool aReportAllTrackErrors );
256
262wxString GetLanguage();
263
264#endif // __PCBNEW_SCRIPTING_HELPERS_H
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:79
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:290
The main frame for Pcbnew.
PCB_FILE_T
The set of file types that the PCB_IO_MGR knows about, and for which there has been a plugin written,...
Definition: pcb_io_mgr.h:56
EDA_UNITS
Definition: eda_units.h:46
PCB_LAYER_ID
A quick note on layer IDs:
Definition: layer_ids.h:60
@ UNDEFINED_LAYER
Definition: layer_ids.h:61
bool ImportSpecctraSES(wxString &aFullFilename)
Import a specctra *.ses file and use it to relocate MODULEs and to replace all vias and tracks in an ...
SETTINGS_MANAGER * GetSettingsManager()
bool WriteDRCReport(BOARD *aBoard, const wxString &aFileName, EDA_UNITS aUnits, bool aReportAllTrackErrors)
Run the DRC check on the given board and writes the results to a report file.
BOARD * CreateEmptyBoard()
Construct a default BOARD with a temporary (no filename) project.
void ScriptingOnDestructPcbEditFrame(PCB_EDIT_FRAME *aPCBEdaFrame)
bool SaveBoard(wxString &aFileName, BOARD *aBoard, bool aSkipSettings=false)
Saves a copy of the given board and its associated project to the given path.
bool ExportVRML(const wxString &aFullFileName, double aMMtoWRMLunit, bool aIncludeUnspecified, bool aIncludeDNP, bool aExport3DFiles, bool aUseRelativePaths, const wxString &a3D_Subdir, double aXRef, double aYRef)
Export the current BOARD to a VRML (wrl) file.
wxArrayString GetFootprintLibraries()
Get the nicknames of all of the footprint libraries configured in pcbnew in both the project and glob...
BOARD * LoadBoard(const wxString &aFileName, PCB_IO_MGR::PCB_FILE_T aFormat)
Loads a board from file using the specified file io handler.
int GetUserUnits()
Return the currently selected user unit value for the interface.
wxArrayString GetFootprints(const wxString &aNickName)
Get the names of all of the footprints available in a footprint library.
bool IsActionRunning()
Are we currently in an action plugin?
void UpdateUserInterface()
Update the layer manager and other widgets from the board setup (layer and items visibility,...
void ScriptingSetPcbEditFrame(PCB_EDIT_FRAME *aPCBEdaFrame)
bool ExportSpecctraDSN(wxString &aFullFilename)
Will export the current BOARD to a specctra dsn file.
void FocusOnItem(BOARD_ITEM *aItem, PCB_LAYER_ID aLayer=UNDEFINED_LAYER)
Focus the view on the target item.
void Refresh()
Update the board display after modifying it by a python script (note: it is automatically called by a...
std::deque< BOARD_ITEM * > GetCurrentSelection()
Get the list of selected objects.
wxString GetLanguage()
Get the language string from COMMON_SETTINGS.
BOARD * GetBoard()
BOARD * NewBoard(wxString &aFileName)
Creates a new board and project with the given filename (will overwrite existing files!...
bool ExportFootprintsToLibrary(bool aStoreInNewLib, const wxString &aLibName=wxEmptyString, wxString *aLibPath=nullptr)
Save footprints in a library: