KiCad PCB EDA Suite
pcbnew_scripting_helpers.h File Reference
#include <wxPcbStruct.h>
#include <io_mgr.h>

Go to the source code of this file.


void ScriptingSetPcbEditFrame (PCB_EDIT_FRAME *aPCBEdaFrame)
BOARDGetBoard ()
BOARDLoadBoard (wxString &aFileName, IO_MGR::PCB_FILE_T aFormat)
BOARDLoadBoard (wxString &aFileName)
bool SaveBoard (wxString &aFileName, BOARD *aBoard, IO_MGR::PCB_FILE_T aFormat)
bool SaveBoard (wxString &aFileName, BOARD *aBoard)
void Refresh ()
void WindowZoom (int xl, int yl, int width, int height)

Function Documentation

BOARD* GetBoard ( )

Definition at line 45 of file pcbnew_scripting_helpers.cpp.

References PCB_BASE_FRAME::GetBoard().

Referenced by EVT_GRID_CMD_CELL_CHANGED(), EVT_TOOL(), EVT_UPDATE_UI(), PCB_EDIT_FRAME::ExportSpecctraFile(), PCB_EDIT_FRAME::ExportToSpecctra(), PCB_EDIT_FRAME::forceColorsToLegacy(), PCB_EDIT_FRAME::GetGridColor(), PCB_EDIT_FRAME::GetLastNetListRead(), PCB_DRAW_PANEL_GAL::GetMsgPanelInfo(), PCB_EDIT_FRAME::ImportSpecctraSession(), PCB_EDIT_FRAME::IsElementVisible(), PCB_EDIT_FRAME::IsMicroViaAcceptable(), PCB_EDIT_FRAME::ListAndSelectModuleName(), FOOTPRINT_EDIT_FRAME::Load_Module_From_BOARD(), PCB_BASE_FRAME::LoadModuleFromLibrary(), FOOTPRINT_EDIT_FRAME::ModeditLocateAndDisplay(), FOOTPRINT_EDIT_FRAME::moveExact(), PCB_EDIT_FRAME::OnCloseWindow(), FOOTPRINT_EDIT_FRAME::OnVerticalToolbar(), FOOTPRINT_EDIT_FRAME::Process_Special_Functions(), PCB_BASE_EDIT_FRAME::PutDataInPreviousState(), PCB_EDIT_FRAME::ReadPcbNetlist(), PCB_EDIT_FRAME::RecreateBOMFileFromBoard(), PCB_BASE_EDIT_FRAME::SaveCopyInUndoList(), PCB_EDIT_FRAME::SetElementVisibility(), PCB_EDIT_FRAME::SetGridColor(), PCB_EDIT_FRAME::SetLastNetListRead(), PCB_EDIT_FRAME::SetVisibleAlls(), PCB_EDIT_FRAME::Show3D_Frame(), PCB_EDIT_FRAME::SVG_Print(), and PCB_EDIT_FRAME::UpdateTitle().

46 {
47  if( PcbEditFrame )
48  return PcbEditFrame->GetBoard();
49  else
50  return NULL;
51 }
BOARD * GetBoard() const
static PCB_EDIT_FRAME * PcbEditFrame
BOARD* LoadBoard ( wxString &  aFileName,
IO_MGR::PCB_FILE_T  aFormat 

Definition at line 73 of file pcbnew_scripting_helpers.cpp.

References IO_MGR::Load().

74 {
75  return IO_MGR::Load( aFormat, aFileName );
76 }
static BOARD * Load(PCB_FILE_T aFileType, const wxString &aFileName, BOARD *aAppendToMe=NULL, const PROPERTIES *aProperties=NULL)
Function Load finds the requested PLUGIN and if found, calls the PLUGIN->Load(..) funtion on it using...
Definition: io_mgr.cpp:229
BOARD* LoadBoard ( wxString &  aFileName)

Definition at line 60 of file pcbnew_scripting_helpers.cpp.

References IO_MGR::KICAD, IO_MGR::LEGACY, and LoadBoard().

Referenced by LoadBoard().

61 {
62  if( aFileName.EndsWith( wxT( ".kicad_pcb" ) ) )
63  return LoadBoard( aFileName, IO_MGR::KICAD );
65  else if( aFileName.EndsWith( wxT( ".brd" ) ) )
66  return LoadBoard( aFileName, IO_MGR::LEGACY );
68  // as fall back for any other kind use the legacy format
69  return LoadBoard( aFileName, IO_MGR::LEGACY );
70 }
BOARD * LoadBoard(wxString &aFileName)
S-expression Pcbnew file format.
Definition: io_mgr.h:54
Legacy Pcbnew file formats prior to s-expression.
Definition: io_mgr.h:53
void Refresh ( )

Definition at line 113 of file pcbnew_scripting_helpers.cpp.

References EDA_DRAW_FRAME::GetCanvas(), and EDA_DRAW_PANEL::Refresh().

Referenced by EDA_MSG_PANEL::AppendMessage(), C3D_MODEL_VIEWER::Clear3DModel(), DRCLISTBOX::DeleteAllItems(), DRCLISTBOX::DeleteItem(), EDA_MSG_PANEL::EraseMsgBox(), PCB_EDIT_FRAME::ImportSpecctraSession(), LIB_EDIT_FRAME::InstallFieldsEditorDialog(), PCB_EDIT_FRAME::OnFlipPcbView(), C3D_MODEL_VIEWER::OnMouseMove(), C3D_MODEL_VIEWER::OnMouseWheel(), FOOTPRINT_PREVIEW_WIDGET::OnStatusChange(), DIALOG_FP_LIB_TABLE::optionsEditor(), EDA_DRAW_PANEL::Refresh(), TEMPLATE_WIDGET::Select(), C3D_MODEL_VIEWER::Set3DModel(), WIDGET_EESCHEMA_COLOR_CONFIG::SetColor(), DIALOG_LIB_EDIT_PIN_TABLE::DataViewModel::SetGroupingColumn(), DRCLISTBOX::SetList(), EDA_MSG_PANEL::SetMessage(), FOOTPRINTS_LISTBOX::SetSelection(), LIBRARY_LISTBOX::SetSelection(), EDA_3D_VIEWER::takeScreenshot(), TEMPLATE_WIDGET::Unselect(), mpWindow::UpdateAll(), KIGFX::OPENGL_GAL::updatedGalDisplayOptions(), KIGFX::CAIRO_GAL::updatedGalDisplayOptions(), DIALOG_PAGES_SETTINGS::UpdatePageLayoutExample(), and PCB_EDIT_FRAME::UseGalCanvas().

114 {
115  // first argument is erase background, second is a wxRect
116  PcbEditFrame->GetCanvas()->Refresh( true, NULL );
117 }
virtual void Refresh(bool eraseBackground=true, const wxRect *rect=NULL) override
Definition: draw_panel.cpp:326
EDA_DRAW_PANEL * GetCanvas()
Definition: draw_frame.h:299
static PCB_EDIT_FRAME * PcbEditFrame
bool SaveBoard ( wxString &  aFileName,
BOARD aBoard,
IO_MGR::PCB_FILE_T  aFormat 

Definition at line 85 of file pcbnew_scripting_helpers.cpp.

References CONNEXION_OK, DateAndTime(), NETCLASS::Default, Format(), GetBuildVersion(), BOARD::GetDesignSettings(), IO_MGR::LEGACY, BOARD::m_Status_Pcb, IO_MGR::Save(), BOARD_DESIGN_SETTINGS::SetCurrentNetClass(), and BOARD::SynchronizeNetsAndNetClasses().

87 {
88  aBoard->m_Status_Pcb &= ~CONNEXION_OK;
92 #if 0
93  wxString header;
94  PROPERTIES props;
96  if( aFormat == IO_MGR::LEGACY )
97  {
98  header = wxString::Format(
99  wxT( "PCBNEW-BOARD Version %d date %s\n\n# Created by Pcbnew%s scripting\n\n" ),
100  LEGACY_BOARD_FILE_VERSION, DateAndTime().GetData(),
101  GetBuildVersion().GetData() );
102  props["header"] = header;
103  }
105  IO_MGR::Save( aFormat, aFileName, aBoard, &props );
106 #else
107  IO_MGR::Save( aFormat, aFileName, aBoard, NULL );
108 #endif
109  return true;
110 }
Class PROPERTIES is a name/value tuple with unique names and optional values.
Definition: properties.h:34
void SynchronizeNetsAndNetClasses()
Function SynchronizeNetsAndNetClasses copies NETCLASS info to each NET, based on NET membership in a ...
wxString GetBuildVersion()
Function GetBuildVersion Return the build version string.
static const char Default[]
the name of the default NETCLASS
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Function GetDesignSettings.
Definition: class_board.h:530
static void Save(PCB_FILE_T aFileType, const wxString &aFileName, BOARD *aBoard, const PROPERTIES *aProperties=NULL)
Function Save will write either a full aBoard to a storage file in a format that this implementation ...
Definition: io_mgr.cpp:244
bool SetCurrentNetClass(const wxString &aNetClassName)
Function SetCurrentNetClass Must be called after a netclass selection (or after a netclass parameter ...
Legacy Pcbnew file formats prior to s-expression.
Definition: io_mgr.h:53
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:205
wxString DateAndTime()
Function DateAndTime.
Definition: string.cpp:229
int m_Status_Pcb
Flags used in ratsnest calculation and update.
Definition: class_board.h:240
bool SaveBoard ( wxString &  aFileName,
BOARD aBoard 

Definition at line 79 of file pcbnew_scripting_helpers.cpp.

References IO_MGR::KICAD, and SaveBoard().

Referenced by SaveBoard().

80 {
81  return SaveBoard( aFilename, aBoard, IO_MGR::KICAD );
82 }
S-expression Pcbnew file format.
Definition: io_mgr.h:54
bool SaveBoard(wxString &aFilename, BOARD *aBoard)
void ScriptingSetPcbEditFrame ( PCB_EDIT_FRAME aPCBEdaFrame)

Definition at line 54 of file pcbnew_scripting_helpers.cpp.

Referenced by PCB::IFACE::CreateWindow().

55 {
56  PcbEditFrame = aPCBEdaFrame;
57 }
static PCB_EDIT_FRAME * PcbEditFrame
void WindowZoom ( int  xl,
int  yl,
int  width,
int  height 

Definition at line 120 of file pcbnew_scripting_helpers.cpp.

References EDA_DRAW_FRAME::Window_Zoom().

121 {
122  EDA_RECT Rect( wxPoint( xl, yl ), wxSize( width, height )) ;
123  PcbEditFrame->Window_Zoom( Rect );
124 }
static PCB_EDIT_FRAME * PcbEditFrame
Class EDA_RECT handles the component boundary box.
void Window_Zoom(EDA_RECT &Rect)
Compute the zoom factor and the new draw offset to draw the selected area (Rect) in full window scree...
Definition: zoom.cpp:103