Commit c41bb774 authored by jean-pierre charras's avatar jean-pierre charras

Pcbnew: drill files creation: better dialog to create driil files, map files...

Pcbnew: drill files creation: better dialog to create driil files, map files and report file. Code cleaning
parent 5951a7f9
......@@ -72,6 +72,7 @@ const wxString AllFilesWildcard( _( "All files (*)|*" ) );
// Wildcard for cvpcb component to footprint link file
const wxString ComponentFileWildcard( _( "KiCad cmp/footprint link files (*.cmp)|*.cmp" ) );
// Wildcard for reports and fabrication documents
const wxString DrillFileWildcard( _( "Drill files (*.drl)|*.drl;*.DRL" ) );
const wxString SVGFileWildcard( _( "SVG files (*.svg)|*.svg;*.SVG" ) );
const wxString ReportFileWildcard = _( "Report files (*.rpt)|*.rpt" );
......
......@@ -151,9 +151,8 @@ set(PCBNEW_CLASS_SRCS
export_vrml.cpp
files.cpp
gen_drill_report_files.cpp
gen_holes_and_tools_lists_for_drill.cpp
gen_modules_placefile.cpp
gendrill.cpp
gendrill_Excellon_writer.cpp
globaleditpad.cpp
gpcb_exchange.cpp
highlight.cpp
......
......@@ -40,11 +40,11 @@ DIALOG_SVG_PRINT_base::DIALOG_SVG_PRINT_base( wxWindow* parent, wxWindowID id, c
m_TextPenWidth = new wxStaticText( this, wxID_ANY, _("Default pen size"), wxDefaultPosition, wxDefaultSize, 0 );
m_TextPenWidth->Wrap( -1 );
m_TextPenWidth->SetToolTip( _("Selection of the pen size used to draw items which have no pen size specified.") );
sbOptionsSizer->Add( m_TextPenWidth, 0, wxRIGHT|wxLEFT, 5 );
m_DialogDefaultPenSize = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_DialogDefaultPenSize->SetToolTip( _("Selection of the pen size used to draw items which have no pen size speicfied.") );
sbOptionsSizer->Add( m_DialogDefaultPenSize, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 );
wxString m_ModeColorOptionChoices[] = { _("Color"), _("Black and white") };
......@@ -67,7 +67,7 @@ DIALOG_SVG_PRINT_base::DIALOG_SVG_PRINT_base( wxWindow* parent, wxWindowID id, c
sbOptionsSizer->Add( m_PrintBoardEdgesCtrl, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_printMirrorOpt = new wxCheckBox( this, wxID_ANY, _("Print mirror"), wxDefaultPosition, wxDefaultSize, 0 );
m_printMirrorOpt = new wxCheckBox( this, wxID_ANY, _("Print mirrored"), wxDefaultPosition, wxDefaultSize, 0 );
sbOptionsSizer->Add( m_printMirrorOpt, 0, wxRIGHT|wxLEFT, 5 );
......
......@@ -207,7 +207,7 @@
<property name="style"></property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="tooltip">Selection of the pen size used to draw items which have no pen size specified.</property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
......@@ -290,7 +290,7 @@
<property name="style"></property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip">Selection of the pen size used to draw items which have no pen size speicfied.</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
......@@ -629,7 +629,7 @@
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Print mirror</property>
<property name="label">Print mirrored</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
......
This diff is collapsed.
......@@ -51,8 +51,9 @@ public:
private:
PCB_EDIT_FRAME* m_parent;
wxConfig* m_config;
BOARD* m_board;
wxString m_plotDefaultpath; // Current default plot dircetory.
PCB_PLOT_PARAMS m_plotOpts;
int m_platedPadsHoleCount;
int m_notplatedPadsHoleCount;
......@@ -60,8 +61,7 @@ private:
int m_microViasCount;
int m_blindOrBuriedViasCount;
static bool m_createRpt; // true to create a drill file report
static int m_createMap; // > 0 to create a map file report
static int m_mapFileType; // HPGL, PS ...
void initDialog();
......@@ -70,24 +70,25 @@ private:
// event functions
void OnSelDrillUnitsSelected( wxCommandEvent& event );
void OnSelZerosFmtSelected( wxCommandEvent& event );
void OnOkClick( wxCommandEvent& event );
void OnGenDrillFile( wxCommandEvent& event );
void OnGenMapFile( wxCommandEvent& event );
void OnGenReportFile( wxCommandEvent& event );
void OnCancelClick( wxCommandEvent& event );
void OnOutputDirectoryBrowseClicked( wxCommandEvent& event );
// Specific functions:
void SetParams( void );
void GenDrillAndReportFiles();
void GenDrillMap( const wxString aFileName,
std::vector<HOLE_INFO>& aHoleListBuffer,
std::vector<DRILL_TOOL>& aToolListBuffer,
int format );
void GenDrillAndMapFiles(bool aGenDrill, bool aGenMap);
void GenDrillMap( const wxString aFileName,
EXCELLON_WRITER& aExcellonWriter,
PlotFormat format );
void UpdatePrecisionOptions();
void UpdateConfig();
void GenDrillReport( const wxString aFileName );
int Create_Drill_File_EXCELLON( FILE* aFile,
wxPoint aOffset,
std::vector<HOLE_INFO>& aHoleListBuffer,
std::vector<DRILL_TOOL>& aToolListBuffer );
int Gen_Liste_Tools( std::vector<DRILL_TOOL>& buffer, bool print_header );
int Create_Drill_File_EXCELLON( FILE* aFile,
wxPoint aOffset );
int Gen_Liste_Tools( std::vector<DRILL_TOOL>& buffer,
bool print_header );
/**
* Return the selected format for coordinates, if not decimal
......
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -13,20 +13,22 @@
#include <wx/intl.h>
#include "dialog_shim.h"
#include <wx/string.h>
#include <wx/radiobox.h>
#include <wx/textctrl.h>
#include <wx/gdicmn.h>
#include <wx/font.h>
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/button.h>
#include <wx/sizer.h>
#include <wx/checkbox.h>
#include <wx/statbox.h>
#include <wx/radiobox.h>
#include <wx/checkbox.h>
#include <wx/stattext.h>
#include <wx/button.h>
#include <wx/dialog.h>
///////////////////////////////////////////////////////////////////////////
#define ID_GEN_DRILL_FILE 1000
///////////////////////////////////////////////////////////////////////////////
/// Class DIALOG_GENDRILL_BASE
......@@ -36,14 +38,15 @@ class DIALOG_GENDRILL_BASE : public DIALOG_SHIM
private:
protected:
wxTextCtrl* m_outputDirectoryName;
wxButton* m_buttonBrowse;
wxRadioBox* m_Choice_Unit;
wxRadioBox* m_Choice_Zeros_Format;
wxRadioBox* m_Choice_Precision;
wxRadioBox* m_Choice_Drill_Offset;
wxRadioBox* m_Choice_Drill_Map;
wxRadioBox* m_Choice_Drill_Report;
wxCheckBox* m_Check_Mirror;
wxCheckBox* m_Check_Minimal;
wxRadioBox* m_Choice_Drill_Offset;
wxStaticBoxSizer* m_DefaultViasDrillSizer;
wxStaticText* m_ViaDrillValue;
wxStaticBoxSizer* m_MicroViasDrillSizer;
......@@ -53,19 +56,25 @@ class DIALOG_GENDRILL_BASE : public DIALOG_SHIM
wxStaticText* m_ThroughViasInfoMsg;
wxStaticText* m_MicroViasInfoMsg;
wxStaticText* m_BuriedViasInfoMsg;
wxButton* m_OkButton;
wxButton* m_buttonDrill;
wxButton* m_buttonMap;
wxButton* m_buttonReport;
wxButton* m_CancelButton;
wxTextCtrl* m_messagesBox;
// Virtual event handlers, overide them in your derived class
virtual void OnOutputDirectoryBrowseClicked( wxCommandEvent& event ) { event.Skip(); }
virtual void OnSelDrillUnitsSelected( wxCommandEvent& event ) { event.Skip(); }
virtual void OnSelZerosFmtSelected( wxCommandEvent& event ) { event.Skip(); }
virtual void OnOkClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnGenDrillFile( wxCommandEvent& event ) { event.Skip(); }
virtual void OnGenMapFile( wxCommandEvent& event ) { event.Skip(); }
virtual void OnGenReportFile( wxCommandEvent& event ) { event.Skip(); }
virtual void OnCancelClick( wxCommandEvent& event ) { event.Skip(); }
public:
DIALOG_GENDRILL_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Drill Files Generation"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 455,358 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
DIALOG_GENDRILL_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Drill Files Generation"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 506,471 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_GENDRILL_BASE();
};
......
This diff is collapsed.
/**
* @file gendrill.h
* @brief Classes and functions declaration used in drill file and report generation.
* @file gendrill_Excellon_writer.h
* @brief Classes used in drill files, map files and report files generation.
*/
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 1992-2010 Jean_Pierre Charras <jp.charras@ujf-grenoble.fr>
* Copyright (C) 1992-2010 KiCad Developers, see change_log.txt for contributors.
* Copyright (C) 1992-2012 Jean_Pierre Charras <jp.charras at wanadoo.fr>
* Copyright (C) 1992-2012 KiCad Developers, see change_log.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
......@@ -27,8 +27,8 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef _GENDRILL_H_
#define _GENDRILL_H_
#ifndef _GENDRILL_EXCELLON_WRITER_
#define _GENDRILL_EXCELLON_WRITER_
#include <vector>
......@@ -44,7 +44,9 @@ public:
int m_Diameter; // the diameter of the used tool (for oblong, the smaller size)
int m_TotalCount; // how many times it is used (round and oblong)
int m_OvalCount; // oblong count
public: DRILL_TOOL( int diametre )
public:
DRILL_TOOL( int diametre )
{
m_TotalCount = 0;
m_OvalCount = 0;
......@@ -104,7 +106,10 @@ public: DRILL_PRECISION( int l = 2, int r = 4 )
};
// A helper class to create Excellon drill files
/**
* EXCELLON_WRITER is a class mainly used to create Excellon drill files
* However, this class is also used to create drill maps and drill report
*/
class EXCELLON_WRITER
{
public:
......@@ -130,19 +135,14 @@ private:
// (i.e inches or mm)
bool m_mirror;
wxPoint m_offset; // Drill offset ooordinates
std::vector<HOLE_INFO>* m_holeListBuffer; // Buffer containing holes
std::vector<DRILL_TOOL>* m_toolListBuffer; // Buffer containing tools
std::vector<HOLE_INFO> m_holeListBuffer; // Buffer containing holes
std::vector<DRILL_TOOL> m_toolListBuffer; // Buffer containing tools
public: EXCELLON_WRITER( BOARD* aPcb, FILE* aFile,
wxPoint aOffset,
std::vector<HOLE_INFO>* aHoleListBuffer,
std::vector<DRILL_TOOL>* aToolListBuffer )
public: EXCELLON_WRITER( BOARD* aPcb, wxPoint aOffset )
{
m_file = aFile;
m_file = NULL;
m_pcb = aPcb;
m_zeroFormat = DECIMAL_FORMAT;
m_holeListBuffer = aHoleListBuffer;
m_toolListBuffer = aToolListBuffer;
m_conversionUnits = 0.0001;
m_unitsDecimal = false;
m_mirror = false;
......@@ -154,6 +154,11 @@ public: EXCELLON_WRITER( BOARD* aPcb, FILE* aFile,
{
}
/**
* Return the plot offset (usually the position
* of the auxiliaty axis
*/
const wxPoint GetOffset() { return m_offset; }
/**
* Function SetFormat
......@@ -179,62 +184,74 @@ public: EXCELLON_WRITER( BOARD* aPcb, FILE* aFile,
m_minimalHeader = aMinimalHeader;
}
/**
* Function BuildHolesList
* Create the list of holes and tools for a given board
* The list is sorted by increasing drill values
* Only holes from aFirstLayer to aLastLayer copper layers are listed (for vias, because
* pad holes are always through holes)
* @param aFirstLayer = first layer to consider. if < 0 aFirstLayer is ignored
* @param aLastLayer = last layer to consider. if < 0 aLastLayer is ignored
* @param aExcludeThroughHoles Exclude through holes if true.
* @param aGenerateNPTH_list :
* true to create NPTH only list (with no plated holes)
* false to created plated holes list (with no NPTH )
*/
void BuildHolesList( int aFirstLayer, int aLastLayer,
bool aExcludeThroughHoles,
bool aGenerateNPTH_list );
int GetHolesCount() const { return m_holeListBuffer.size(); }
/**
* Function CreateDrillFile
* Creates an Excellon drill file
* @param aFile = an opened file to write to
* will be closed by CreateDrillFile
* @return hole count
*/
int CreateDrillFile();
int CreateDrillFile( FILE * aFile );
/**
* Function GenDrillReportFile
* Create a plain text report file giving a list of drill values and drill count
* for through holes, oblong holes, and for buried vias,
* drill values and drill count per layer pair
* there is only one report for all drill files even when buried or blinds vias exist
* @param aFullFileName : the name of the file to create
* m_unitsDecimal = false tu use inches, true to use mm in report file
*
* @return success if the file is created
*/
bool GenDrillReportFile( const wxString& aFullFileName );
/**
* Function GenDrillMapFile
* Plot a map of drill marks for holes.
* @param aFullFileName : the name of this file (to plot it)
* @param aSheet : the paper sheet touse for plot
* @param aFormat : one of the supported plot formats (see enum PlotFormat )
*/
bool GenDrillMapFile( const wxString& aFullFileName,
const PAGE_INFO& aSheet,
PlotFormat aFormat );
private:
void WriteHeader();
void WriteEndOfFile();
void WriteEXCELLONHeader();
void WriteEXCELLONEndOfFile();
void WriteCoordinates( char* aLine, double aCoordX, double aCoordY );
};
/**
* Function BuildHolesList
* Create the list of holes and tools for a given board
* The list is sorted by increasing drill values
* Only holes from aFirstLayer to aLastLayer copper layers are listed (for vias, because
* pad holes are always through holes)
* @param aPcb : the given board
* @param aHoleListBuffer : the std::vector<HOLE_INFO> to fill with pcb holes info
* @param aToolListBuffer : the std::vector<DRILL_TOOL> to fill with tools to use
* @param aFirstLayer = first layer to consider. if < 0 aFirstLayer is ignored
* @param aLastLayer = last layer to consider. if < 0 aLastLayer is ignored
* @param aExcludeThroughHoles Exclude through holes if true.
* @param aGenerateNPTH_list :
* true to create NPTH only list (with no plated holes)
* false to created plated holes list (with no NPTH )
*/
void Build_Holes_List( BOARD* aPcb, std::vector<HOLE_INFO>& aHoleListBuffer,
std::vector<DRILL_TOOL>& aToolListBuffer,
int aFirstLayer, int aLastLayer, bool aExcludeThroughHoles,
bool aGenerateNPTH_list );
/** Helper function.
* Writes the drill marks in HPGL, POSTSCRIPT or other supported formats
* Each hole size has a symbol (circle, cross X, cross + ...) up to
* PLOTTER::MARKER_COUNT different values.
* If more than PLOTTER::MARKER_COUNT different values,
* these other values share the same mark shape
* @param aPlotter = a PLOTTER instance (HPGL, POSTSCRIPT ... plotter).
*/
bool PlotDrillMarks( PLOTTER* plotter );
};
void GenDrillMapFile( BOARD* aPcb,
FILE* aFile,
const wxString& aFullFileName,
const PAGE_INFO& aSheet,
std::vector<HOLE_INFO> aHoleListBuffer,
std::vector<DRILL_TOOL> aToolListBuffer,
bool aUnit_Drill_is_Inch,
int format, const wxPoint& auxoffset );
void Gen_Drill_PcbMap( BOARD* aPcb, PLOTTER* plotter,
std::vector<HOLE_INFO>& aHoleListBuffer,
std::vector<DRILL_TOOL>& aToolListBuffer );
/*
* Create a list of drill values and drill count
* there is only one report for all drill files even when buried or blinds vias exist
*/
void GenDrillReportFile( FILE* aFile, BOARD* aPcb, const wxString& aBoardFilename,
bool aUnit_Drill_is_Inch,
std::vector<HOLE_INFO>& aHoleListBuffer,
std::vector<DRILL_TOOL>& aToolListBuffer
);
#endif // #ifndef _GENDRILL_H_
#endif // #ifndef _GENDRILL_EXCELLON_WRITER_
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