Pcbnew, Excellon drill file creation: for oval holes allows selection of an alternate command, when the normal command is not accepted.

Using the normal command, oval holes are "drilled" by a route command.
Some board houses do not accept this normal command.
In this case, the drill dialog allows using an other Excellon drill command (a slotted hole).
Note also some board houses do not understand this alternate command!
This commit is contained in:
jean-pierre charras 2019-02-09 14:56:02 +01:00
parent 756b20ace8
commit c0a86d734d
7 changed files with 264 additions and 795 deletions

View File

@ -5,8 +5,8 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 1992-2017 Jean_Pierre Charras <jp.charras at wanadoo.fr>
* Copyright (C) 1992-2017 KiCad Developers, see change_log.txt for contributors.
* Copyright (C) 1992-2019 Jean_Pierre Charras <jp.charras at wanadoo.fr>
* Copyright (C) 1992-2019 KiCad Developers, see AUTHORS.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
@ -47,7 +47,7 @@
#include <wx/stdpaths.h>
// Keywords for read and write config
// Keywords for read and write parameters in project config
#define ZerosFormatKey wxT( "DrillZerosFormat" )
#define MirrorKey wxT( "DrillMirrorYOpt" )
#define MinimalHeaderKey wxT( "DrillMinHeader" )
@ -55,10 +55,12 @@
#define UnitDrillInchKey wxT( "DrillUnit" )
#define DrillMapFileTypeKey wxT( "DrillMapFileType" )
#define DrillFileFormatKey wxT( "DrillFileType" )
#define OvalHolesRouteModeKey wxT( "OvalHolesRouteMode" )
// list of allowed precision for EXCELLON files, for integer format:
// Due to difference between inches and mm,
// there are 2 precision values, one for inches and one for metric
// Note: for decimla format, the precision is not used
static DRILL_PRECISION precisionListForInches( 2, 4 );
static DRILL_PRECISION precisionListForMetric( 3, 3 );
@ -103,7 +105,7 @@ bool DIALOG_GENDRILL::m_Mirror = false; // Only for Excellon format
bool DIALOG_GENDRILL::m_Merge_PTH_NPTH = false; // Only for Excellon format
int DIALOG_GENDRILL::m_mapFileType = 1;
int DIALOG_GENDRILL::m_drillFileType = 0;
bool DIALOG_GENDRILL::m_UseRouteModeForOvalHoles = true; // Use G00 route mode to "drill" oval holes
DIALOG_GENDRILL::~DIALOG_GENDRILL()
{
@ -121,6 +123,7 @@ void DIALOG_GENDRILL::initDialog()
m_drillOriginIsAuxAxis = m_plotOpts.GetUseAuxOrigin();
m_config->Read( DrillMapFileTypeKey, &m_mapFileType );
m_config->Read( DrillFileFormatKey, &m_drillFileType );
m_config->Read( OvalHolesRouteModeKey, &m_UseRouteModeForOvalHoles );
InitDisplayParams();
}
@ -143,6 +146,7 @@ void DIALOG_GENDRILL::InitDisplayParams()
m_Check_Mirror->SetValue( m_Mirror );
m_Check_Merge_PTH_NPTH->SetValue( m_Merge_PTH_NPTH );
m_Choice_Drill_Map->SetSelection( m_mapFileType );
m_radioBoxOvalHoleMode->SetSelection( m_UseRouteModeForOvalHoles ? 0 : 1 );
m_platedPadsHoleCount = 0;
m_notplatedPadsHoleCount = 0;
@ -228,6 +232,7 @@ void DIALOG_GENDRILL::onFileFormatSelection( wxCommandEvent& event )
m_Check_Mirror->Enable( enbl_Excellon );
m_Check_Minimal->Enable( enbl_Excellon );
m_Check_Merge_PTH_NPTH->Enable( enbl_Excellon );
m_radioBoxOvalHoleMode->Enable( enbl_Excellon );
if( enbl_Excellon )
UpdatePrecisionOptions();
@ -250,6 +255,7 @@ void DIALOG_GENDRILL::UpdateConfig()
m_config->Write( UnitDrillInchKey, m_UnitDrillIsInch );
m_config->Write( DrillMapFileTypeKey, m_mapFileType );
m_config->Write( DrillFileFormatKey, m_drillFileType );
m_config->Write( OvalHolesRouteModeKey, m_UseRouteModeForOvalHoles );
}
@ -346,6 +352,7 @@ void DIALOG_GENDRILL::SetParams()
m_Mirror = m_Check_Mirror->IsChecked();
m_Merge_PTH_NPTH = m_Check_Merge_PTH_NPTH->IsChecked();
m_ZerosFormat = m_Choice_Zeros_Format->GetSelection();
m_UseRouteModeForOvalHoles = m_radioBoxOvalHoleMode->GetSelection() == 0;
if( m_Choice_Drill_Offset->GetSelection() == 0 )
m_FileDrillOffset = wxPoint( 0, 0 );
@ -399,6 +406,7 @@ void DIALOG_GENDRILL::GenDrillAndMapFiles( bool aGenDrill, bool aGenMap )
excellonWriter.SetFormat( !m_UnitDrillIsInch, (EXCELLON_WRITER::ZEROS_FMT) m_ZerosFormat,
m_Precision.m_lhs, m_Precision.m_rhs );
excellonWriter.SetOptions( m_Mirror, m_MinimalHeader, m_FileDrillOffset, m_Merge_PTH_NPTH );
excellonWriter.SetRouteModeForOvalHoles( m_UseRouteModeForOvalHoles );
excellonWriter.SetMapFileFormat( filefmt[choice] );
excellonWriter.CreateDrillandMapFilesSet( outputDir.GetFullPath(),

View File

@ -5,8 +5,8 @@
/*
* 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-2019 Jean_Pierre Charras <jp.charras@ujf-grenoble.fr>
* Copyright (C) 1992-2019 KiCad Developers, see AUTHORS.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
@ -42,9 +42,11 @@ public:
static bool m_MinimalHeader;
static bool m_Mirror;
static bool m_Merge_PTH_NPTH;
DRILL_PRECISION m_Precision; // Selected precision for drill files
wxPoint m_FileDrillOffset; // Drill offset: 0,0 for absolute coordinates,
// or origin of the auxiliary axis
DRILL_PRECISION m_Precision; /// Selected precision for drill files, in non decimal format
wxPoint m_FileDrillOffset; /// Drill offset: 0,0 for absolute coordinates,
/// or origin of the auxiliary axis
static bool m_UseRouteModeForOvalHoles; /// True to use a G00 route command for oval holes
/// False to use a G85 canned mode for oval holes
private:
@ -52,16 +54,16 @@ private:
wxConfigBase* m_config;
BOARD* m_board;
PCB_PLOT_PARAMS m_plotOpts;
bool m_drillOriginIsAuxAxis; // Axis selection (main / auxiliary)
// for drill origin coordinates
bool m_drillOriginIsAuxAxis; // Axis selection (main / auxiliary)
// for drill origin coordinates
int m_platedPadsHoleCount;
int m_notplatedPadsHoleCount;
int m_throughViasCount;
int m_microViasCount;
int m_blindOrBuriedViasCount;
static int m_mapFileType; // HPGL, PS ...
static int m_drillFileType; // Excellon, Gerber
static int m_mapFileType; // format of map file: HPGL, PS ...
static int m_drillFileType; // for Excellon, Gerber
void initDialog();

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Dec 30 2017)
// C++ code generated with wxFormBuilder (version Dec 1 2018)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@ -12,204 +12,212 @@
DIALOG_GENDRILL_BASE::DIALOG_GENDRILL_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : DIALOG_SHIM( parent, id, title, pos, size, style )
{
this->SetSizeHints( wxDefaultSize, wxDefaultSize );
wxBoxSizer* bMainSizer;
bMainSizer = new wxBoxSizer( wxVERTICAL );
wxBoxSizer* bupperSizer;
bupperSizer = new wxBoxSizer( wxHORIZONTAL );
staticTextOutputDir = new wxStaticText( this, wxID_ANY, _("Output folder:"), wxDefaultPosition, wxDefaultSize, 0 );
staticTextOutputDir->Wrap( -1 );
bupperSizer->Add( staticTextOutputDir, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT, 10 );
m_outputDirectoryName = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_outputDirectoryName->SetMinSize( wxSize( -1,22 ) );
bupperSizer->Add( m_outputDirectoryName, 1, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxLEFT|wxTOP, 0 );
m_browseButton = new wxBitmapButton( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW );
m_browseButton = new wxBitmapButton( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW|0 );
m_browseButton->SetMinSize( wxSize( 30,28 ) );
bupperSizer->Add( m_browseButton, 0, wxRIGHT, 7 );
bMainSizer->Add( bupperSizer, 0, wxEXPAND|wxTOP, 10 );
wxBoxSizer* bmiddlerSizer;
bmiddlerSizer = new wxBoxSizer( wxHORIZONTAL );
wxBoxSizer* bMiddleSizer;
bMiddleSizer = new wxBoxSizer( wxVERTICAL );
wxStaticBoxSizer* sbSizer6;
sbSizer6 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Drill File Format") ), wxVERTICAL );
m_rbExcellon = new wxRadioButton( sbSizer6->GetStaticBox(), wxID_ANY, _("Excellon"), wxDefaultPosition, wxDefaultSize, 0 );
sbSizer6->Add( m_rbExcellon, 0, wxBOTTOM|wxRIGHT, 5 );
wxBoxSizer* bSizerExcellonOptions;
bSizerExcellonOptions = new wxBoxSizer( wxVERTICAL );
m_Check_Mirror = new wxCheckBox( sbSizer6->GetStaticBox(), wxID_ANY, _("Mirror Y axis"), wxDefaultPosition, wxDefaultSize, 0 );
m_Check_Mirror->SetToolTip( _("Not recommended.\nUsed mostly by users who make the boards themselves.") );
bSizerExcellonOptions->Add( m_Check_Mirror, 0, wxLEFT, 5 );
m_Check_Minimal = new wxCheckBox( sbSizer6->GetStaticBox(), wxID_ANY, _("Minimal header"), wxDefaultPosition, wxDefaultSize, 0 );
m_Check_Minimal->SetToolTip( _("Not recommended.\nOnly use it for board houses which do not accept fully featured headers.") );
bSizerExcellonOptions->Add( m_Check_Minimal, 0, wxRIGHT|wxLEFT, 5 );
m_Check_Merge_PTH_NPTH = new wxCheckBox( sbSizer6->GetStaticBox(), wxID_ANY, _("PTH and NPTH in single file"), wxDefaultPosition, wxDefaultSize, 0 );
m_Check_Merge_PTH_NPTH->SetToolTip( _("Not recommended.\nOnly use for board houses which ask for merged PTH and NPTH into a single file.") );
bSizerExcellonOptions->Add( m_Check_Merge_PTH_NPTH, 0, wxBOTTOM|wxLEFT, 5 );
bSizerExcellonOptions->Add( m_Check_Merge_PTH_NPTH, 0, wxLEFT, 5 );
wxString m_radioBoxOvalHoleModeChoices[] = { _("Use route command (recommended)"), _("Use alternate drill mode") };
int m_radioBoxOvalHoleModeNChoices = sizeof( m_radioBoxOvalHoleModeChoices ) / sizeof( wxString );
m_radioBoxOvalHoleMode = new wxRadioBox( sbSizer6->GetStaticBox(), wxID_ANY, _("Oval Holes Drill Mode"), wxDefaultPosition, wxDefaultSize, m_radioBoxOvalHoleModeNChoices, m_radioBoxOvalHoleModeChoices, 1, wxRA_SPECIFY_COLS );
m_radioBoxOvalHoleMode->SetSelection( 0 );
m_radioBoxOvalHoleMode->SetToolTip( _("Oval holes frequently create problems for board houses.\n\"Use route command\" uses the usual G00 route command (recommended)\n \"Use alternate mode\" uses another drill/ route command (G85)\n(Use it only if the recommended command does not work)") );
bSizerExcellonOptions->Add( m_radioBoxOvalHoleMode, 0, wxALL|wxEXPAND, 5 );
sbSizer6->Add( bSizerExcellonOptions, 1, wxEXPAND|wxLEFT, 12 );
m_rbGerberX2 = new wxRadioButton( sbSizer6->GetStaticBox(), wxID_ANY, _("Gerber X2 (experimental)"), wxDefaultPosition, wxDefaultSize, 0 );
sbSizer6->Add( m_rbGerberX2, 0, wxTOP|wxBOTTOM|wxRIGHT, 5 );
bMiddleSizer->Add( sbSizer6, 1, wxEXPAND|wxALL, 5 );
wxString m_Choice_Drill_MapChoices[] = { _("HPGL"), _("PostScript"), _("Gerber"), _("DXF"), _("SVG"), _("PDF") };
int m_Choice_Drill_MapNChoices = sizeof( m_Choice_Drill_MapChoices ) / sizeof( wxString );
m_Choice_Drill_Map = new wxRadioBox( this, wxID_ANY, _("Map File Format"), wxDefaultPosition, wxDefaultSize, m_Choice_Drill_MapNChoices, m_Choice_Drill_MapChoices, 1, wxRA_SPECIFY_COLS );
m_Choice_Drill_Map->SetSelection( 1 );
m_Choice_Drill_Map->SetToolTip( _("Creates a drill map in PS, HPGL or other formats") );
bMiddleSizer->Add( m_Choice_Drill_Map, 0, wxALL|wxEXPAND, 5 );
bmiddlerSizer->Add( bMiddleSizer, 1, wxEXPAND, 5 );
wxBoxSizer* bLeftSizer;
bLeftSizer = new wxBoxSizer( wxVERTICAL );
wxString m_Choice_Drill_OffsetChoices[] = { _("Absolute"), _("Auxiliary axis") };
int m_Choice_Drill_OffsetNChoices = sizeof( m_Choice_Drill_OffsetChoices ) / sizeof( wxString );
m_Choice_Drill_Offset = new wxRadioBox( this, wxID_ANY, _("Drill Origin"), wxDefaultPosition, wxDefaultSize, m_Choice_Drill_OffsetNChoices, m_Choice_Drill_OffsetChoices, 1, wxRA_SPECIFY_COLS );
m_Choice_Drill_Offset->SetSelection( 0 );
m_Choice_Drill_Offset->SetToolTip( _("Choose the coordinate origin: absolute or relative to the auxiliray axis") );
bLeftSizer->Add( m_Choice_Drill_Offset, 0, wxALL|wxEXPAND, 5 );
wxString m_Choice_UnitChoices[] = { _("Millimeters"), _("Inches") };
int m_Choice_UnitNChoices = sizeof( m_Choice_UnitChoices ) / sizeof( wxString );
m_Choice_Unit = new wxRadioBox( this, wxID_ANY, _("Drill Units"), wxDefaultPosition, wxDefaultSize, m_Choice_UnitNChoices, m_Choice_UnitChoices, 1, wxRA_SPECIFY_COLS );
m_Choice_Unit->SetSelection( 1 );
bLeftSizer->Add( m_Choice_Unit, 0, wxALL|wxEXPAND, 5 );
wxString m_Choice_Zeros_FormatChoices[] = { _("Decimal format"), _("Suppress leading zeros"), _("Suppress trailing zeros"), _("Keep zeros") };
int m_Choice_Zeros_FormatNChoices = sizeof( m_Choice_Zeros_FormatChoices ) / sizeof( wxString );
m_Choice_Zeros_Format = new wxRadioBox( this, wxID_ANY, _("Zeros Format"), wxDefaultPosition, wxDefaultSize, m_Choice_Zeros_FormatNChoices, m_Choice_Zeros_FormatChoices, 1, wxRA_SPECIFY_COLS );
m_Choice_Zeros_Format->SetSelection( 0 );
m_Choice_Zeros_Format->SetToolTip( _("Choose EXCELLON numbers notation") );
bLeftSizer->Add( m_Choice_Zeros_Format, 0, wxALL|wxEXPAND, 5 );
wxFlexGridSizer* fgSizer1;
fgSizer1 = new wxFlexGridSizer( 0, 2, 0, 0 );
fgSizer1->AddGrowableCol( 1 );
fgSizer1->SetFlexibleDirection( wxBOTH );
fgSizer1->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
m_staticTextTitle = new wxStaticText( this, wxID_ANY, _("Precision:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextTitle->Wrap( -1 );
fgSizer1->Add( m_staticTextTitle, 0, wxALL, 10 );
m_staticTextPrecision = new wxStaticText( this, wxID_ANY, _("Precision"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextPrecision->Wrap( -1 );
fgSizer1->Add( m_staticTextPrecision, 0, wxALL, 10 );
bLeftSizer->Add( fgSizer1, 0, wxEXPAND, 5 );
bmiddlerSizer->Add( bLeftSizer, 1, wxEXPAND, 5 );
wxBoxSizer* bRightBoxSizer;
bRightBoxSizer = new wxBoxSizer( wxVERTICAL );
wxStaticBoxSizer* sbSizerHoles;
sbSizerHoles = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Hole Counts") ), wxVERTICAL );
wxFlexGridSizer* fgSizer2;
fgSizer2 = new wxFlexGridSizer( 0, 2, 0, 0 );
fgSizer2->SetFlexibleDirection( wxBOTH );
fgSizer2->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
staticTextPlatedPads = new wxStaticText( sbSizerHoles->GetStaticBox(), wxID_ANY, _("Plated pads:"), wxDefaultPosition, wxDefaultSize, 0 );
staticTextPlatedPads->Wrap( -1 );
fgSizer2->Add( staticTextPlatedPads, 0, wxLEFT|wxRIGHT, 5 );
m_PlatedPadsCountInfoMsg = new wxStaticText( sbSizerHoles->GetStaticBox(), wxID_ANY, _("0"), wxDefaultPosition, wxDefaultSize, 0 );
m_PlatedPadsCountInfoMsg->Wrap( -1 );
fgSizer2->Add( m_PlatedPadsCountInfoMsg, 0, wxALIGN_RIGHT|wxLEFT|wxRIGHT, 5 );
staticTextNonPlatedPads = new wxStaticText( sbSizerHoles->GetStaticBox(), wxID_ANY, _("Non-plated pads:"), wxDefaultPosition, wxDefaultSize, 0 );
staticTextNonPlatedPads->Wrap( -1 );
fgSizer2->Add( staticTextNonPlatedPads, 0, wxLEFT|wxRIGHT|wxTOP, 5 );
m_NotPlatedPadsCountInfoMsg = new wxStaticText( sbSizerHoles->GetStaticBox(), wxID_ANY, _("0"), wxDefaultPosition, wxDefaultSize, 0 );
m_NotPlatedPadsCountInfoMsg->Wrap( -1 );
fgSizer2->Add( m_NotPlatedPadsCountInfoMsg, 0, wxALIGN_RIGHT|wxLEFT|wxRIGHT|wxTOP, 5 );
staticTextThroughVias = new wxStaticText( sbSizerHoles->GetStaticBox(), wxID_ANY, _("Through vias:"), wxDefaultPosition, wxDefaultSize, 0 );
staticTextThroughVias->Wrap( -1 );
fgSizer2->Add( staticTextThroughVias, 0, wxLEFT|wxRIGHT|wxTOP, 5 );
m_ThroughViasInfoMsg = new wxStaticText( sbSizerHoles->GetStaticBox(), wxID_ANY, _("0"), wxDefaultPosition, wxDefaultSize, 0 );
m_ThroughViasInfoMsg->Wrap( -1 );
fgSizer2->Add( m_ThroughViasInfoMsg, 0, wxALIGN_RIGHT|wxLEFT|wxRIGHT|wxTOP, 5 );
staticTextMicroVias = new wxStaticText( sbSizerHoles->GetStaticBox(), wxID_ANY, _("Micro vias:"), wxDefaultPosition, wxDefaultSize, 0 );
staticTextMicroVias->Wrap( -1 );
fgSizer2->Add( staticTextMicroVias, 0, wxLEFT|wxRIGHT|wxTOP, 5 );
m_MicroViasInfoMsg = new wxStaticText( sbSizerHoles->GetStaticBox(), wxID_ANY, _("0"), wxDefaultPosition, wxDefaultSize, 0 );
m_MicroViasInfoMsg->Wrap( -1 );
fgSizer2->Add( m_MicroViasInfoMsg, 0, wxALIGN_RIGHT|wxLEFT|wxRIGHT|wxTOP, 5 );
staticTextBuriedVias = new wxStaticText( sbSizerHoles->GetStaticBox(), wxID_ANY, _("Buried vias:"), wxDefaultPosition, wxDefaultSize, 0 );
staticTextBuriedVias->Wrap( -1 );
fgSizer2->Add( staticTextBuriedVias, 0, wxALL, 5 );
m_BuriedViasInfoMsg = new wxStaticText( sbSizerHoles->GetStaticBox(), wxID_ANY, _("0"), wxDefaultPosition, wxDefaultSize, 0 );
m_BuriedViasInfoMsg->Wrap( -1 );
fgSizer2->Add( m_BuriedViasInfoMsg, 0, wxALIGN_RIGHT|wxALL, 5 );
sbSizerHoles->Add( fgSizer2, 1, wxEXPAND, 5 );
bRightBoxSizer->Add( sbSizerHoles, 1, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 5 );
bmiddlerSizer->Add( bRightBoxSizer, 1, wxEXPAND|wxTOP, 5 );
bMainSizer->Add( bmiddlerSizer, 0, wxEXPAND|wxTOP, 2 );
wxStaticBoxSizer* bMsgSizer;
bMsgSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Messages") ), wxVERTICAL );
m_messagesBox = new wxTextCtrl( bMsgSizer->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxTE_READONLY );
m_messagesBox->SetMinSize( wxSize( -1,90 ) );
bMsgSizer->Add( m_messagesBox, 1, wxALL|wxEXPAND, 5 );
bMainSizer->Add( bMsgSizer, 1, wxALL|wxEXPAND, 5 );
m_buttonsSizer = new wxBoxSizer( wxHORIZONTAL );
m_buttonReport = new wxButton( this, wxID_ANY, _("Generate Report File"), wxDefaultPosition, wxDefaultSize, 0 );
m_buttonsSizer->Add( m_buttonReport, 0, wxEXPAND|wxRIGHT|wxLEFT, 10 );
m_sdbSizer1 = new wxStdDialogButtonSizer();
m_sdbSizer1OK = new wxButton( this, wxID_OK );
m_sdbSizer1->AddButton( m_sdbSizer1OK );
@ -218,19 +226,18 @@ DIALOG_GENDRILL_BASE::DIALOG_GENDRILL_BASE( wxWindow* parent, wxWindowID id, con
m_sdbSizer1Cancel = new wxButton( this, wxID_CANCEL );
m_sdbSizer1->AddButton( m_sdbSizer1Cancel );
m_sdbSizer1->Realize();
m_buttonsSizer->Add( m_sdbSizer1, 1, wxEXPAND, 5 );
bMainSizer->Add( m_buttonsSizer, 0, wxALL|wxEXPAND, 5 );
this->SetSizer( bMainSizer );
this->Layout();
bMainSizer->Fit( this );
this->Centre( wxBOTH );
// Connect Events
m_browseButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GENDRILL_BASE::OnOutputDirectoryBrowseClicked ), NULL, this );
m_rbExcellon->Connect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( DIALOG_GENDRILL_BASE::onFileFormatSelection ), NULL, this );
@ -253,5 +260,5 @@ DIALOG_GENDRILL_BASE::~DIALOG_GENDRILL_BASE()
m_buttonReport->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GENDRILL_BASE::OnGenReportFile ), NULL, this );
m_sdbSizer1Apply->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GENDRILL_BASE::OnGenMapFile ), NULL, this );
m_sdbSizer1OK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GENDRILL_BASE::OnGenDrillFile ), NULL, this );
}

File diff suppressed because it is too large Load Diff

View File

@ -1,12 +1,11 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Dec 30 2017)
// C++ code generated with wxFormBuilder (version Dec 1 2018)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#ifndef __DIALOG_GENDRILL_BASE_H__
#define __DIALOG_GENDRILL_BASE_H__
#pragma once
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
@ -19,16 +18,16 @@
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/textctrl.h>
#include <wx/bmpbuttn.h>
#include <wx/bitmap.h>
#include <wx/image.h>
#include <wx/icon.h>
#include <wx/bmpbuttn.h>
#include <wx/button.h>
#include <wx/sizer.h>
#include <wx/radiobut.h>
#include <wx/checkbox.h>
#include <wx/statbox.h>
#include <wx/radiobox.h>
#include <wx/statbox.h>
#include <wx/dialog.h>
///////////////////////////////////////////////////////////////////////////
@ -40,7 +39,7 @@
class DIALOG_GENDRILL_BASE : public DIALOG_SHIM
{
private:
protected:
wxStaticText* staticTextOutputDir;
wxTextCtrl* m_outputDirectoryName;
@ -49,6 +48,7 @@ class DIALOG_GENDRILL_BASE : public DIALOG_SHIM
wxCheckBox* m_Check_Mirror;
wxCheckBox* m_Check_Minimal;
wxCheckBox* m_Check_Merge_PTH_NPTH;
wxRadioBox* m_radioBoxOvalHoleMode;
wxRadioButton* m_rbGerberX2;
wxRadioBox* m_Choice_Drill_Map;
wxRadioBox* m_Choice_Drill_Offset;
@ -73,7 +73,7 @@ class DIALOG_GENDRILL_BASE : public DIALOG_SHIM
wxButton* m_sdbSizer1OK;
wxButton* m_sdbSizer1Apply;
wxButton* m_sdbSizer1Cancel;
// Virtual event handlers, overide them in your derived class
virtual void OnOutputDirectoryBrowseClicked( wxCommandEvent& event ) { event.Skip(); }
virtual void onFileFormatSelection( wxCommandEvent& event ) { event.Skip(); }
@ -82,13 +82,12 @@ class DIALOG_GENDRILL_BASE : public DIALOG_SHIM
virtual void OnGenReportFile( wxCommandEvent& event ) { event.Skip(); }
virtual void OnGenMapFile( wxCommandEvent& event ) { event.Skip(); }
virtual void OnGenDrillFile( wxCommandEvent& event ) { event.Skip(); }
public:
DIALOG_GENDRILL_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Generate Drill Files"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
DIALOG_GENDRILL_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Generate Drill Files"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 568,514 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_GENDRILL_BASE();
};
#endif //__DIALOG_GENDRILL_BASE_H__

View File

@ -58,9 +58,9 @@
// Oblong holes can be drilled by a "canned slot" command (G85) or a routing command
// a linear routing command (G01) is perhaps more usual for drill files
// Comment this next line to use a canned slot hole (old way)
// Uncomment this next line to use a linear routed hole (new way)
#define USE_ROUTING_MODE_FOR_OBLONG_HOLE
//
// set m_useRouteModeForOval to false to use a canned slot hole (old way)
// set m_useRouteModeForOval to true (prefered mode) to use a linear routed hole (new way)
EXCELLON_WRITER::EXCELLON_WRITER( BOARD* aPcb )
: GENDRILL_WRITER_BASE( aPcb )
@ -72,6 +72,7 @@ EXCELLON_WRITER::EXCELLON_WRITER( BOARD* aPcb )
m_merge_PTH_NPTH = false;
m_minimalHeader = false;
m_drillFileExtension = DrillFileExtension;
m_useRouteModeForOval = true;
}
@ -272,35 +273,41 @@ int EXCELLON_WRITER::createDrillFile( FILE* aFile, DRILL_LAYER_PAIR aLayerPair,
xt = x0 * m_conversionUnits;
yt = y0 * m_conversionUnits;
#ifdef USE_ROUTING_MODE_FOR_OBLONG_HOLE
fputs( "G00", m_file ); // Select the routing mode
#endif
if( m_useRouteModeForOval )
fputs( "G00", m_file ); // Select the routing mode
writeCoordinates( line, xt, yt );
#ifndef USE_ROUTING_MODE_FOR_OBLONG_HOLE
/* remove the '\n' from end of line, because we must add the "G85"
* command to the line: */
for( int kk = 0; line[kk] != 0; kk++ )
if( !m_useRouteModeForOval )
{
if( line[kk] < ' ' )
line[kk] = 0;
/* remove the '\n' from end of line, because we must add the "G85"
* command to the line: */
for( int kk = 0; line[kk] != 0; kk++ )
{
if( line[kk] < ' ' )
line[kk] = 0;
}
fputs( line, m_file );
fputs( "G85", m_file ); // add the "G85" command
}
else
{
fputs( line, m_file );
fputs( "M15\nG01", m_file ); // tool down and linear routing from last coordinates
}
fputs( line, m_file );
fputs( "G85", m_file ); // add the "G85" command
#else
fputs( line, m_file );
fputs( "M15\nG01", m_file ); // tool down and linear routing from last coordinates
#endif
xt = xf * m_conversionUnits;
yt = yf * m_conversionUnits;
writeCoordinates( line, xt, yt );
fputs( line, m_file );
#ifdef USE_ROUTING_MODE_FOR_OBLONG_HOLE
fputs( "M16\n", m_file ); // Tool up (end routing)
#endif
fputs( "G05\n", m_file ); // Select drill mode
if( m_useRouteModeForOval )
fputs( "M16\n", m_file ); // Tool up (end routing)
fputs( "G05\n", m_file ); // Select drill mode
holes_count++;
}

View File

@ -44,9 +44,12 @@ class OUTPUTFORMATTER;
class EXCELLON_WRITER: public GENDRILL_WRITER_BASE
{
private:
FILE* m_file; // The output file
bool m_minimalHeader; // True to use minimal header
FILE* m_file; // The output file
bool m_minimalHeader; // True to use minimal header
bool m_mirror;
bool m_useRouteModeForOval; // True to use a route command for oval holes
// False to use a G85 canned mode for oval holes
public:
EXCELLON_WRITER( BOARD* aPcb );
@ -61,6 +64,14 @@ public:
*/
const wxPoint GetOffset() { return m_offset; }
/**
*
*/
void SetRouteModeForOvalHoles( bool aUseRouteModeForOvalHoles )
{
m_useRouteModeForOval = aUseRouteModeForOvalHoles;
}
/**
* Function SetFormat
* Initialize internal parameters to match the given format