gen drill maps: remove unusable format (HPGL and GERBER) for map files.

Especially, on a regular basis, map files in gerber format create problems
for board house.
From Master branch.
This commit is contained in:
jean-pierre charras 2022-06-22 11:13:06 +02:00
parent 5cf346c233
commit 1f4b288664
5 changed files with 30 additions and 29 deletions

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 1992-2019 Jean_Pierre Charras <jp.charras at wanadoo.fr> * Copyright (C) 1992-2019 Jean_Pierre Charras <jp.charras at wanadoo.fr>
* Copyright (C) 1992-2021 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2022 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -92,7 +92,7 @@ int DIALOG_GENDRILL::m_ZerosFormat = EXCELLON_WRITER::DECIMAL_FORMAT;
bool DIALOG_GENDRILL::m_MinimalHeader = false; // Only for Excellon format bool DIALOG_GENDRILL::m_MinimalHeader = false; // Only for Excellon format
bool DIALOG_GENDRILL::m_Mirror = false; // Only for Excellon format bool DIALOG_GENDRILL::m_Mirror = false; // Only for Excellon format
bool DIALOG_GENDRILL::m_Merge_PTH_NPTH = 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_mapFileType = 3;
int DIALOG_GENDRILL::m_drillFileType = 0; int DIALOG_GENDRILL::m_drillFileType = 0;
bool DIALOG_GENDRILL::m_UseRouteModeForOvalHoles = true; // Use G00 route mode to "drill" oval holes bool DIALOG_GENDRILL::m_UseRouteModeForOvalHoles = true; // Use G00 route mode to "drill" oval holes
@ -116,6 +116,10 @@ void DIALOG_GENDRILL::initDialog()
m_drillOriginIsAuxAxis = m_plotOpts.GetUseAuxOrigin(); m_drillOriginIsAuxAxis = m_plotOpts.GetUseAuxOrigin();
// Ensure validity of m_mapFileType
if( m_mapFileType < 0 || m_mapFileType > 3 )
m_mapFileType = 3; // default = PDF
InitDisplayParams(); InitDisplayParams();
} }
@ -368,11 +372,9 @@ void DIALOG_GENDRILL::GenDrillAndMapFiles( bool aGenDrill, bool aGenMap )
m_pcbEditFrame->ClearMsgPanel(); m_pcbEditFrame->ClearMsgPanel();
WX_TEXT_CTRL_REPORTER reporter( m_messagesBox ); WX_TEXT_CTRL_REPORTER reporter( m_messagesBox );
const PLOT_FORMAT filefmt[6] = { const PLOT_FORMAT filefmt[] = {
// Keep these format ids in the same order than m_Choice_Drill_Map choices // Keep these format ids in the same order than m_Choice_Drill_Map choices
PLOT_FORMAT::HPGL,
PLOT_FORMAT::POST, PLOT_FORMAT::POST,
PLOT_FORMAT::GERBER,
PLOT_FORMAT::DXF, PLOT_FORMAT::DXF,
PLOT_FORMAT::SVG, PLOT_FORMAT::SVG,
PLOT_FORMAT::PDF PLOT_FORMAT::PDF
@ -381,7 +383,7 @@ void DIALOG_GENDRILL::GenDrillAndMapFiles( bool aGenDrill, bool aGenMap )
unsigned choice = (unsigned) m_Choice_Drill_Map->GetSelection(); unsigned choice = (unsigned) m_Choice_Drill_Map->GetSelection();
if( choice >= arrayDim( filefmt ) ) if( choice >= arrayDim( filefmt ) )
choice = 1; choice = arrayDim( filefmt )-1; // Last choice = PDF
// Create output directory if it does not exist (also transform it in absolute form). // Create output directory if it does not exist (also transform it in absolute form).
// Bail if it fails. // Bail if it fails.

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Oct 26 2018) // C++ code generated with wxFormBuilder (version 3.10.0-39-g3487c3cb)
// http://www.wxformbuilder.org/ // http://www.wxformbuilder.org/
// //
// PLEASE DO *NOT* EDIT THIS FILE! // PLEASE DO *NOT* EDIT THIS FILE!
@ -79,10 +79,10 @@ DIALOG_GENDRILL_BASE::DIALOG_GENDRILL_BASE( wxWindow* parent, wxWindowID id, con
bMiddleSizer->Add( sbSizer6, 1, wxEXPAND|wxALL, 5 ); bMiddleSizer->Add( sbSizer6, 1, wxEXPAND|wxALL, 5 );
wxString m_Choice_Drill_MapChoices[] = { _("HPGL"), _("PostScript"), _("Gerber"), _("DXF"), _("SVG"), _("PDF") }; wxString m_Choice_Drill_MapChoices[] = { _("PostScript"), _("DXF"), _("SVG"), _("PDF") };
int m_Choice_Drill_MapNChoices = sizeof( m_Choice_Drill_MapChoices ) / sizeof( wxString ); 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 = 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->SetSelection( 5 );
m_Choice_Drill_Map->SetToolTip( _("Creates a drill map in PS, HPGL or other formats") ); 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 ); bMiddleSizer->Add( m_Choice_Drill_Map, 0, wxALL|wxEXPAND, 5 );

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?> <?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<wxFormBuilder_Project> <wxFormBuilder_Project>
<FileVersion major="1" minor="15" /> <FileVersion major="1" minor="16" />
<object class="Project" expanded="1"> <object class="Project" expanded="1">
<property name="class_decoration"></property> <property name="class_decoration"></property>
<property name="code_generation">C++</property> <property name="code_generation">C++</property>
@ -14,6 +14,7 @@
<property name="file">dialog_gendrill_base</property> <property name="file">dialog_gendrill_base</property>
<property name="first_id">1000</property> <property name="first_id">1000</property>
<property name="help_provider">none</property> <property name="help_provider">none</property>
<property name="image_path_wrapper_function_name"></property>
<property name="indent_with_spaces"></property> <property name="indent_with_spaces"></property>
<property name="internationalize">1</property> <property name="internationalize">1</property>
<property name="name">dialog_gendrill_base</property> <property name="name">dialog_gendrill_base</property>
@ -25,6 +26,7 @@
<property name="skip_php_events">1</property> <property name="skip_php_events">1</property>
<property name="skip_python_events">1</property> <property name="skip_python_events">1</property>
<property name="ui_table">UI</property> <property name="ui_table">UI</property>
<property name="use_array_enum">0</property>
<property name="use_enum">0</property> <property name="use_enum">0</property>
<property name="use_microsoft_bom">0</property> <property name="use_microsoft_bom">0</property>
<object class="Dialog" expanded="1"> <object class="Dialog" expanded="1">
@ -50,6 +52,7 @@
<property name="subclass">DIALOG_SHIM; dialog_shim.h</property> <property name="subclass">DIALOG_SHIM; dialog_shim.h</property>
<property name="title">Generate Drill Files</property> <property name="title">Generate Drill Files</property>
<property name="tooltip"></property> <property name="tooltip"></property>
<property name="two_step_creation">0</property>
<property name="window_extra_style"></property> <property name="window_extra_style"></property>
<property name="window_name"></property> <property name="window_name"></property>
<property name="window_style"></property> <property name="window_style"></property>
@ -206,6 +209,7 @@
<property name="aui_name"></property> <property name="aui_name"></property>
<property name="aui_position"></property> <property name="aui_position"></property>
<property name="aui_row"></property> <property name="aui_row"></property>
<property name="auth_needed">0</property>
<property name="best_size"></property> <property name="best_size"></property>
<property name="bg"></property> <property name="bg"></property>
<property name="bitmap"></property> <property name="bitmap"></property>
@ -717,7 +721,7 @@
<property name="caption"></property> <property name="caption"></property>
<property name="caption_visible">1</property> <property name="caption_visible">1</property>
<property name="center_pane">0</property> <property name="center_pane">0</property>
<property name="choices">&quot;HPGL&quot; &quot;PostScript&quot; &quot;Gerber&quot; &quot;DXF&quot; &quot;SVG&quot; &quot;PDF&quot;</property> <property name="choices">&quot;PostScript&quot; &quot;DXF&quot; &quot;SVG&quot; &quot;PDF&quot;</property>
<property name="close_button">1</property> <property name="close_button">1</property>
<property name="context_help"></property> <property name="context_help"></property>
<property name="context_menu">1</property> <property name="context_menu">1</property>
@ -749,7 +753,7 @@
<property name="pin_button">1</property> <property name="pin_button">1</property>
<property name="pos"></property> <property name="pos"></property>
<property name="resize">Resizable</property> <property name="resize">Resizable</property>
<property name="selection">1</property> <property name="selection">5</property>
<property name="show">1</property> <property name="show">1</property>
<property name="size"></property> <property name="size"></property>
<property name="style">wxRA_SPECIFY_COLS</property> <property name="style">wxRA_SPECIFY_COLS</property>
@ -1873,6 +1877,7 @@
<property name="aui_name"></property> <property name="aui_name"></property>
<property name="aui_position"></property> <property name="aui_position"></property>
<property name="aui_row"></property> <property name="aui_row"></property>
<property name="auth_needed">0</property>
<property name="best_size"></property> <property name="best_size"></property>
<property name="bg"></property> <property name="bg"></property>
<property name="bitmap"></property> <property name="bitmap"></property>

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Oct 26 2018) // C++ code generated with wxFormBuilder (version 3.10.0-39-g3487c3cb)
// http://www.wxformbuilder.org/ // http://www.wxformbuilder.org/
// //
// PLEASE DO *NOT* EDIT THIS FILE! // PLEASE DO *NOT* EDIT THIS FILE!
@ -74,7 +74,7 @@ class DIALOG_GENDRILL_BASE : public DIALOG_SHIM
wxButton* m_sdbSizerApply; wxButton* m_sdbSizerApply;
wxButton* m_sdbSizerCancel; wxButton* m_sdbSizerCancel;
// Virtual event handlers, overide them in your derived class // Virtual event handlers, override them in your derived class
virtual void onCloseDlg( wxCloseEvent& event ) { event.Skip(); } virtual void onCloseDlg( wxCloseEvent& event ) { event.Skip(); }
virtual void OnOutputDirectoryBrowseClicked( wxCommandEvent& event ) { event.Skip(); } virtual void OnOutputDirectoryBrowseClicked( wxCommandEvent& event ) { event.Skip(); }
virtual void onFileFormatSelection( wxCommandEvent& event ) { event.Skip(); } virtual void onFileFormatSelection( wxCommandEvent& event ) { event.Skip(); }
@ -89,6 +89,7 @@ class DIALOG_GENDRILL_BASE : public DIALOG_SHIM
public: 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( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_GENDRILL_BASE(); ~DIALOG_GENDRILL_BASE();
}; };

View File

@ -91,27 +91,20 @@ bool GENDRILL_WRITER_BASE::genDrillMapFile( const wxString& aFullFileName, PLOT_
EDA_RECT bbbox = m_pcb->GetBoardEdgesBoundingBox(); EDA_RECT bbbox = m_pcb->GetBoardEdgesBoundingBox();
m_pcb->SetVisibleLayers( visibleLayers ); m_pcb->SetVisibleLayers( visibleLayers );
// Some formats cannot be used to generate a document like the map files
// - HPGL (old format not very used)
// - GERBER because a map file is not a fabrication file usable by board house
// (in fact such a file usually create problems when sent to a board house)
if( aFormat == PLOT_FORMAT::HPGL || aFormat == PLOT_FORMAT::GERBER )
aFormat = PLOT_FORMAT::PDF;
// Calculate the scale for the format type, scale 1 in HPGL, drawing on // Calculate the scale for the format type, scale 1 in HPGL, drawing on
// an A4 sheet in PS, + text description of symbols // an A4 sheet in PS, + text description of symbols
switch( aFormat ) switch( aFormat )
{ {
case PLOT_FORMAT::GERBER: case PLOT_FORMAT::GERBER:
plotter = new GERBER_PLOTTER();
plotter->SetViewport( offset, IU_PER_MILS / 10, scale, false );
plotter->SetGerberCoordinatesFormat( 5 ); // format x.5 unit = mm
break;
case PLOT_FORMAT::HPGL: // Scale for HPGL format. case PLOT_FORMAT::HPGL: // Scale for HPGL format.
{
HPGL_PLOTTER* hpgl_plotter = new HPGL_PLOTTER;
plotter = hpgl_plotter;
hpgl_plotter->SetPenNumber( plot_opts.GetHPGLPenNum() );
hpgl_plotter->SetPenSpeed( plot_opts.GetHPGLPenSpeed() );
plotter->SetPageSettings( page_info );
plotter->SetViewport( offset, IU_PER_MILS / 10, scale, false );
}
break;
default: default:
wxASSERT( false ); wxASSERT( false );
KI_FALLTHROUGH; KI_FALLTHROUGH;