Commit 2153f4d1 authored by jean-pierre charras's avatar jean-pierre charras

Pcbnew: footprint placement file creation:

 * Added a dialog to select options: one or 2 files, units (mm or inch), and force INSERT option.
 * code cleaning
 * Modify corresponding  icon in menu to show a footprint, not a schematic component.
parent 74aecb3e
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -713,8 +713,46 @@ public: ...@@ -713,8 +713,46 @@ public:
void InstallDialogLayerSetup(); void InstallDialogLayerSetup();
void GenModulesPosition( wxCommandEvent& event ); /**
void GenModuleReport( wxCommandEvent& event ); * Function GenFootprintsPositionFile
* Calls DoGenFootprintsPositionFile to create a footprint position file
* See DoGenFootprintsPositionFile for options and file format
*/
void GenFootprintsPositionFile( wxCommandEvent& event );
/**
* Function DoGenFootprintsPositionFile
* Creates an ascii footprint position file
* @param aFullFilename = the full file name of the file to create
* @param aUnitsMM = false to use inches, true to use mm in coordinates
* @param aForceSmdItems = true to force all footprints with smd pads in list
* = false to put only footprints with option "INSERT" in list
* @param aSide = 0 to list footprints on BACK side,
* 1 to list footprints on FRONT side
* 2 to list footprints on both sides
* @return the number of footprints found on aSide side,
* or -1 if the file could not be created
*/
int DoGenFootprintsPositionFile( const wxString& aFullFileName, bool aUnitsMM,
bool aForceSmdItems, int aSide );
/**
* Function GenFootprintsReport
* Calls DoGenFootprintsReport to create a footprint reprot file
* See DoGenFootprintsReport for file format
*/
void GenFootprintsReport( wxCommandEvent& event );
/**
* Function DoGenFootprintsReport
* Creates an ascii footprint report file giving some infos on footprints
* and board outlines
* @param aFullFilename = the full file name of the file to create
* @param aUnitsMM = false to use inches, true to use mm in coordinates
* @return true if OK, false if error
*/
bool DoGenFootprintsReport( const wxString& aFullFilename, bool aUnitsMM );
void InstallDrillFrame( wxCommandEvent& event ); void InstallDrillFrame( wxCommandEvent& event );
void ToPostProcess( wxCommandEvent& event ); void ToPostProcess( wxCommandEvent& event );
......
...@@ -43,6 +43,7 @@ set(PCBNEW_DIALOGS ...@@ -43,6 +43,7 @@ set(PCBNEW_DIALOGS
dialogs/dialog_freeroute_exchange_base.cpp dialogs/dialog_freeroute_exchange_base.cpp
dialogs/dialog_gendrill.cpp dialogs/dialog_gendrill.cpp
dialogs/dialog_gendrill_base.cpp dialogs/dialog_gendrill_base.cpp
dialogs/dialog_gen_module_position_file_base.cpp
dialogs/dialog_general_options.cpp dialogs/dialog_general_options.cpp
dialogs/dialog_general_options_BoardEditor_base.cpp dialogs/dialog_general_options_BoardEditor_base.cpp
dialogs/dialog_global_edit_tracks_and_vias.cpp dialogs/dialog_global_edit_tracks_and_vias.cpp
......
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Jun 30 2011)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#include "dialog_gen_module_position_file_base.h"
///////////////////////////////////////////////////////////////////////////
DIALOG_GEN_MODULE_POSITION_BASE::DIALOG_GEN_MODULE_POSITION_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style )
{
this->SetSizeHints( wxSize( -1,-1 ), wxDefaultSize );
m_MainSizer = new wxBoxSizer( wxVERTICAL );
wxBoxSizer* bUpperSizer;
bUpperSizer = new wxBoxSizer( wxHORIZONTAL );
wxBoxSizer* bDirSizer;
bDirSizer = new wxBoxSizer( wxVERTICAL );
m_staticTextDir = new wxStaticText( this, wxID_ANY, _("Output directory:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextDir->Wrap( -1 );
bDirSizer->Add( m_staticTextDir, 0, wxEXPAND|wxTOP|wxLEFT, 5 );
wxBoxSizer* bSizerdirBrowse;
bSizerdirBrowse = new wxBoxSizer( wxHORIZONTAL );
m_outputDirectoryName = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_outputDirectoryName->SetToolTip( _("Target directory for plot files. Can be absolute or relative to the board file location.") );
m_outputDirectoryName->SetMinSize( wxSize( 350,-1 ) );
bSizerdirBrowse->Add( m_outputDirectoryName, 1, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxRIGHT|wxLEFT, 5 );
m_browseButton = new wxButton( this, wxID_ANY, _("Browse..."), wxDefaultPosition, wxDefaultSize, 0 );
bSizerdirBrowse->Add( m_browseButton, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT, 5 );
bDirSizer->Add( bSizerdirBrowse, 1, wxEXPAND, 5 );
bUpperSizer->Add( bDirSizer, 1, 0, 5 );
m_MainSizer->Add( bUpperSizer, 0, wxEXPAND, 5 );
wxBoxSizer* bSizerOptions;
bSizerOptions = new wxBoxSizer( wxHORIZONTAL );
wxString m_radioBoxUnitsChoices[] = { _("Inches"), _("mm") };
int m_radioBoxUnitsNChoices = sizeof( m_radioBoxUnitsChoices ) / sizeof( wxString );
m_radioBoxUnits = new wxRadioBox( this, wxID_ANY, _("Units:"), wxDefaultPosition, wxDefaultSize, m_radioBoxUnitsNChoices, m_radioBoxUnitsChoices, 1, wxRA_SPECIFY_COLS );
m_radioBoxUnits->SetSelection( 0 );
bSizerOptions->Add( m_radioBoxUnits, 1, wxALL, 5 );
wxString m_radioBoxFilesCountChoices[] = { _("One file per side"), _("One file for board") };
int m_radioBoxFilesCountNChoices = sizeof( m_radioBoxFilesCountChoices ) / sizeof( wxString );
m_radioBoxFilesCount = new wxRadioBox( this, wxID_ANY, _("Files:"), wxDefaultPosition, wxDefaultSize, m_radioBoxFilesCountNChoices, m_radioBoxFilesCountChoices, 1, wxRA_SPECIFY_COLS );
m_radioBoxFilesCount->SetSelection( 0 );
m_radioBoxFilesCount->SetToolTip( _("Creates 2 files: one for each board side or\nCreates only one file containing all footprints to place\n") );
bSizerOptions->Add( m_radioBoxFilesCount, 1, wxALL, 5 );
wxString m_radioBoxForceSmdChoices[] = { _("With INSERT attribute set"), _("Force INSERT attribute for all SMD footprints") };
int m_radioBoxForceSmdNChoices = sizeof( m_radioBoxForceSmdChoices ) / sizeof( wxString );
m_radioBoxForceSmd = new wxRadioBox( this, wxID_ANY, _("Footprints:"), wxDefaultPosition, wxDefaultSize, m_radioBoxForceSmdNChoices, m_radioBoxForceSmdChoices, 1, wxRA_SPECIFY_COLS );
m_radioBoxForceSmd->SetSelection( 0 );
m_radioBoxForceSmd->SetToolTip( _("Only footprints with option INSERT are listed in placement file.\nThis option can force this option for all footprints having only SMD pads.\nWarning: this options will modify the board.") );
bSizerOptions->Add( m_radioBoxForceSmd, 0, wxALL, 5 );
m_MainSizer->Add( bSizerOptions, 0, wxEXPAND|wxTOP|wxBOTTOM, 5 );
wxStaticBoxSizer* sbSizerMsg;
sbSizerMsg = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Messages:") ), wxVERTICAL );
m_messagesBox = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxTE_READONLY );
m_messagesBox->SetMinSize( wxSize( -1,70 ) );
sbSizerMsg->Add( m_messagesBox, 1, wxEXPAND, 5 );
m_MainSizer->Add( sbSizerMsg, 1, wxEXPAND, 5 );
m_sdbSizerButtons = new wxStdDialogButtonSizer();
m_sdbSizerButtonsOK = new wxButton( this, wxID_OK );
m_sdbSizerButtons->AddButton( m_sdbSizerButtonsOK );
m_sdbSizerButtonsCancel = new wxButton( this, wxID_CANCEL );
m_sdbSizerButtons->AddButton( m_sdbSizerButtonsCancel );
m_sdbSizerButtons->Realize();
m_MainSizer->Add( m_sdbSizerButtons, 0, wxEXPAND|wxALIGN_RIGHT|wxTOP|wxBOTTOM|wxRIGHT, 5 );
this->SetSizer( m_MainSizer );
this->Layout();
// Connect Events
this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_GEN_MODULE_POSITION_BASE::OnClose ) );
this->Connect( wxEVT_INIT_DIALOG, wxInitDialogEventHandler( DIALOG_GEN_MODULE_POSITION_BASE::OnInitDialog ) );
m_browseButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GEN_MODULE_POSITION_BASE::OnOutputDirectoryBrowseClicked ), NULL, this );
m_sdbSizerButtonsCancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GEN_MODULE_POSITION_BASE::OnCancelButton ), NULL, this );
m_sdbSizerButtonsOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GEN_MODULE_POSITION_BASE::OnOKButton ), NULL, this );
}
DIALOG_GEN_MODULE_POSITION_BASE::~DIALOG_GEN_MODULE_POSITION_BASE()
{
// Disconnect Events
this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_GEN_MODULE_POSITION_BASE::OnClose ) );
this->Disconnect( wxEVT_INIT_DIALOG, wxInitDialogEventHandler( DIALOG_GEN_MODULE_POSITION_BASE::OnInitDialog ) );
m_browseButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GEN_MODULE_POSITION_BASE::OnOutputDirectoryBrowseClicked ), NULL, this );
m_sdbSizerButtonsCancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GEN_MODULE_POSITION_BASE::OnCancelButton ), NULL, this );
m_sdbSizerButtonsOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GEN_MODULE_POSITION_BASE::OnOKButton ), NULL, this );
}
This diff is collapsed.
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Jun 30 2011)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#ifndef __DIALOG_GEN_MODULE_POSITION_FILE_BASE_H__
#define __DIALOG_GEN_MODULE_POSITION_FILE_BASE_H__
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
#include <wx/intl.h>
#include <wx/string.h>
#include <wx/stattext.h>
#include <wx/gdicmn.h>
#include <wx/font.h>
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/textctrl.h>
#include <wx/button.h>
#include <wx/sizer.h>
#include <wx/radiobox.h>
#include <wx/statbox.h>
#include <wx/dialog.h>
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
/// Class DIALOG_GEN_MODULE_POSITION_BASE
///////////////////////////////////////////////////////////////////////////////
class DIALOG_GEN_MODULE_POSITION_BASE : public wxDialog
{
private:
protected:
wxBoxSizer* m_MainSizer;
wxStaticText* m_staticTextDir;
wxTextCtrl* m_outputDirectoryName;
wxButton* m_browseButton;
wxRadioBox* m_radioBoxUnits;
wxRadioBox* m_radioBoxFilesCount;
wxRadioBox* m_radioBoxForceSmd;
wxTextCtrl* m_messagesBox;
wxStdDialogButtonSizer* m_sdbSizerButtons;
wxButton* m_sdbSizerButtonsOK;
wxButton* m_sdbSizerButtonsCancel;
// Virtual event handlers, overide them in your derived class
virtual void OnClose( wxCloseEvent& event ) { event.Skip(); }
virtual void OnInitDialog( wxInitDialogEvent& event ) { event.Skip(); }
virtual void OnOutputDirectoryBrowseClicked( wxCommandEvent& event ) { event.Skip(); }
virtual void OnCancelButton( wxCommandEvent& event ) { event.Skip(); }
virtual void OnOKButton( wxCommandEvent& event ) { event.Skip(); }
public:
DIALOG_GEN_MODULE_POSITION_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Position Files:"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 501,340 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_GEN_MODULE_POSITION_BASE();
};
#endif //__DIALOG_GEN_MODULE_POSITION_FILE_BASE_H__
This diff is collapsed.
...@@ -127,18 +127,24 @@ void PCB_EDIT_FRAME::ReCreateMenuBar() ...@@ -127,18 +127,24 @@ void PCB_EDIT_FRAME::ReCreateMenuBar()
/* Fabrication Outputs submenu */ /* Fabrication Outputs submenu */
wxMenu* fabricationOutputsMenu = new wxMenu; wxMenu* fabricationOutputsMenu = new wxMenu;
AddMenuItem( fabricationOutputsMenu, ID_PCB_GEN_POS_MODULES_FILE, AddMenuItem( fabricationOutputsMenu, ID_PCB_GEN_POS_MODULES_FILE,
_( "&Modules Position File" ), _( "&Modules Position (.pos) File" ),
_( "Generate modules position file for pick and place" ), _( "Generate modules position file for pick and place" ),
KiBitmap( post_compo_xpm ) ); KiBitmap( post_compo_xpm ) );
AddMenuItem( fabricationOutputsMenu, ID_PCB_GEN_DRILL_FILE, AddMenuItem( fabricationOutputsMenu, ID_PCB_GEN_DRILL_FILE,
_( "&Drill File" ), _( "&Drill (.drl) File" ),
_( "Generate excellon2 drill file" ), _( "Generate excellon2 drill file" ),
KiBitmap( post_drill_xpm ) ); KiBitmap( post_drill_xpm ) );
// Module Report
AddMenuItem( fabricationOutputsMenu, ID_GEN_EXPORT_FILE_MODULE_REPORT,
_( "&Module (.rpt) Report" ),
_( "Create a report of all modules on the current board" ),
KiBitmap( tools_xpm ) );
// Component File // Component File
AddMenuItem( fabricationOutputsMenu, ID_PCB_GEN_CMP_FILE, AddMenuItem( fabricationOutputsMenu, ID_PCB_GEN_CMP_FILE,
_( "&Component File" ), _( "&Component (.cmp) File" ),
_( "(Re)create components file (*.cmp) for CvPcb" ), _( "(Re)create components file (*.cmp) for CvPcb" ),
KiBitmap( create_cmp_file_xpm ) ); KiBitmap( create_cmp_file_xpm ) );
...@@ -146,7 +152,7 @@ void PCB_EDIT_FRAME::ReCreateMenuBar() ...@@ -146,7 +152,7 @@ void PCB_EDIT_FRAME::ReCreateMenuBar()
AddMenuItem( fabricationOutputsMenu, ID_PCB_GEN_BOM_FILE_FROM_BOARD, AddMenuItem( fabricationOutputsMenu, ID_PCB_GEN_BOM_FILE_FROM_BOARD,
_( "&BOM File" ), _( "&BOM File" ),
_( "Create a bill of materials from schematic" ), _( "Create a bill of materials from schematic" ),
KiBitmap( tools_xpm ) ); KiBitmap( bom_xpm ) );
// Fabrications Outputs submenu append // Fabrications Outputs submenu append
AddMenuItem( filesMenu, fabricationOutputsMenu, AddMenuItem( filesMenu, fabricationOutputsMenu,
...@@ -183,12 +189,6 @@ void PCB_EDIT_FRAME::ReCreateMenuBar() ...@@ -183,12 +189,6 @@ void PCB_EDIT_FRAME::ReCreateMenuBar()
_( "&GenCAD" ), _( "Export GenCAD format" ), _( "&GenCAD" ), _( "Export GenCAD format" ),
KiBitmap( export_xpm ) ); KiBitmap( export_xpm ) );
// Module Report
AddMenuItem( submenuexport, ID_GEN_EXPORT_FILE_MODULE_REPORT,
_( "&Module Report" ),
_( "Create a report of all modules on the current board" ),
KiBitmap( tools_xpm ) );
// VRML // VRML
AddMenuItem( submenuexport, ID_GEN_EXPORT_FILE_VRML, AddMenuItem( submenuexport, ID_GEN_EXPORT_FILE_VRML,
_( "&VRML" ), _( "&VRML" ),
......
...@@ -94,7 +94,7 @@ BEGIN_EVENT_TABLE( PCB_EDIT_FRAME, PCB_BASE_FRAME ) ...@@ -94,7 +94,7 @@ BEGIN_EVENT_TABLE( PCB_EDIT_FRAME, PCB_BASE_FRAME )
EVT_MENU( ID_GEN_EXPORT_SPECCTRA, PCB_EDIT_FRAME::ExportToSpecctra ) EVT_MENU( ID_GEN_EXPORT_SPECCTRA, PCB_EDIT_FRAME::ExportToSpecctra )
EVT_MENU( ID_GEN_EXPORT_FILE_GENCADFORMAT, PCB_EDIT_FRAME::ExportToGenCAD ) EVT_MENU( ID_GEN_EXPORT_FILE_GENCADFORMAT, PCB_EDIT_FRAME::ExportToGenCAD )
EVT_MENU( ID_GEN_EXPORT_FILE_MODULE_REPORT, PCB_EDIT_FRAME::GenModuleReport ) EVT_MENU( ID_GEN_EXPORT_FILE_MODULE_REPORT, PCB_EDIT_FRAME::GenFootprintsReport )
EVT_MENU( ID_GEN_EXPORT_FILE_VRML, PCB_EDIT_FRAME::OnExportVRML ) EVT_MENU( ID_GEN_EXPORT_FILE_VRML, PCB_EDIT_FRAME::OnExportVRML )
EVT_MENU( ID_GEN_IMPORT_SPECCTRA_SESSION,PCB_EDIT_FRAME::ImportSpecctraSession ) EVT_MENU( ID_GEN_IMPORT_SPECCTRA_SESSION,PCB_EDIT_FRAME::ImportSpecctraSession )
...@@ -127,7 +127,7 @@ BEGIN_EVENT_TABLE( PCB_EDIT_FRAME, PCB_BASE_FRAME ) ...@@ -127,7 +127,7 @@ BEGIN_EVENT_TABLE( PCB_EDIT_FRAME, PCB_BASE_FRAME )
EVT_MENU_RANGE( ID_LANGUAGE_CHOICE, ID_LANGUAGE_CHOICE_END, PCB_EDIT_FRAME::SetLanguage ) EVT_MENU_RANGE( ID_LANGUAGE_CHOICE, ID_LANGUAGE_CHOICE_END, PCB_EDIT_FRAME::SetLanguage )
// menu Postprocess // menu Postprocess
EVT_MENU( ID_PCB_GEN_POS_MODULES_FILE, PCB_EDIT_FRAME::GenModulesPosition ) EVT_MENU( ID_PCB_GEN_POS_MODULES_FILE, PCB_EDIT_FRAME::GenFootprintsPositionFile )
EVT_MENU( ID_PCB_GEN_DRILL_FILE, PCB_EDIT_FRAME::InstallDrillFrame ) EVT_MENU( ID_PCB_GEN_DRILL_FILE, PCB_EDIT_FRAME::InstallDrillFrame )
EVT_MENU( ID_PCB_GEN_CMP_FILE, PCB_EDIT_FRAME::RecreateCmpFileFromBoard ) EVT_MENU( ID_PCB_GEN_CMP_FILE, PCB_EDIT_FRAME::RecreateCmpFileFromBoard )
EVT_MENU( ID_PCB_GEN_BOM_FILE_FROM_BOARD, PCB_EDIT_FRAME::RecreateBOMFileFromBoard ) EVT_MENU( ID_PCB_GEN_BOM_FILE_FROM_BOARD, PCB_EDIT_FRAME::RecreateBOMFileFromBoard )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment