Gen Drill map: Re-add Gerber option but only using X2 format.
Only the X2 format allows the TF.FileFunction option, mandatory to avoid mistakes about this file that is not a standard Gerber file.
This commit is contained in:
parent
61f71e0814
commit
c3f90d914b
|
@ -90,7 +90,7 @@ int DIALOG_GENDRILL::m_ZerosFormat = EXCELLON_WRITER::DECIMAL_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_Merge_PTH_NPTH = false; // Only for Excellon format
|
||||
int DIALOG_GENDRILL::m_mapFileType = 3;
|
||||
int DIALOG_GENDRILL::m_mapFileType = 4; // The last choice in m_Choice_Drill_Map
|
||||
int DIALOG_GENDRILL::m_drillFileType = 0;
|
||||
bool DIALOG_GENDRILL::m_UseRouteModeForOvalHoles = true; // Use G00 route mode to "drill" oval holes
|
||||
|
||||
|
@ -115,8 +115,8 @@ void DIALOG_GENDRILL::initDialog()
|
|||
m_drillOriginIsAuxAxis = m_plotOpts.GetUseAuxOrigin();
|
||||
|
||||
// Ensure validity of m_mapFileType
|
||||
if( m_mapFileType < 0 || m_mapFileType > 3 )
|
||||
m_mapFileType = 3; // default = PDF
|
||||
if( m_mapFileType < 0 || m_mapFileType >= (int)m_Choice_Drill_Map->GetCount() )
|
||||
m_mapFileType = m_Choice_Drill_Map->GetCount() - 1; // last item in list = default = PDF
|
||||
|
||||
InitDisplayParams();
|
||||
}
|
||||
|
@ -373,6 +373,7 @@ void DIALOG_GENDRILL::GenDrillAndMapFiles( bool aGenDrill, bool aGenMap )
|
|||
const PLOT_FORMAT filefmt[] = {
|
||||
// Keep these format ids in the same order than m_Choice_Drill_Map choices
|
||||
PLOT_FORMAT::POST,
|
||||
PLOT_FORMAT::GERBER, // Only X2 format because we need the .FileFunction attribute
|
||||
PLOT_FORMAT::DXF,
|
||||
PLOT_FORMAT::SVG,
|
||||
PLOT_FORMAT::PDF
|
||||
|
|
|
@ -79,11 +79,19 @@ DIALOG_GENDRILL_BASE::DIALOG_GENDRILL_BASE( wxWindow* parent, wxWindowID id, con
|
|||
|
||||
bMiddleSizer->Add( sbSizer6, 1, wxEXPAND|wxALL, 5 );
|
||||
|
||||
wxString m_Choice_Drill_MapChoices[] = { _("PostScript"), _("DXF"), _("SVG"), _("PDF") };
|
||||
m_staticTextInfo1 = new wxStaticText( this, wxID_ANY, _("Note:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticTextInfo1->Wrap( -1 );
|
||||
bMiddleSizer->Add( m_staticTextInfo1, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
m_staticTextInfo = new wxStaticText( this, wxID_ANY, _("A drill map is a doc. file, not a fab. file"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticTextInfo->Wrap( -1 );
|
||||
bMiddleSizer->Add( m_staticTextInfo, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
wxString m_Choice_Drill_MapChoices[] = { _("PostScript"), _("Gerber X2"), _("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( 5 );
|
||||
m_Choice_Drill_Map->SetToolTip( _("Creates a drill map in PS, HPGL or other formats") );
|
||||
m_Choice_Drill_Map->SetSelection( 4 );
|
||||
m_Choice_Drill_Map->SetToolTip( _("Creates a drill map in PDF or other formats") );
|
||||
|
||||
bMiddleSizer->Add( m_Choice_Drill_Map, 0, wxALL|wxEXPAND, 5 );
|
||||
|
||||
|
@ -133,7 +141,7 @@ DIALOG_GENDRILL_BASE::DIALOG_GENDRILL_BASE( wxWindow* parent, wxWindowID id, con
|
|||
bLeftSizer->Add( fgSizer1, 0, wxEXPAND, 5 );
|
||||
|
||||
|
||||
bmiddlerSizer->Add( bLeftSizer, 1, wxEXPAND, 5 );
|
||||
bmiddlerSizer->Add( bLeftSizer, 0, wxEXPAND, 5 );
|
||||
|
||||
wxBoxSizer* bRightBoxSizer;
|
||||
bRightBoxSizer = new wxBoxSizer( wxVERTICAL );
|
||||
|
@ -193,7 +201,7 @@ DIALOG_GENDRILL_BASE::DIALOG_GENDRILL_BASE( wxWindow* parent, wxWindowID id, con
|
|||
bRightBoxSizer->Add( sbSizerHoles, 1, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 5 );
|
||||
|
||||
|
||||
bmiddlerSizer->Add( bRightBoxSizer, 1, wxEXPAND|wxTOP, 5 );
|
||||
bmiddlerSizer->Add( bRightBoxSizer, 0, wxEXPAND|wxTOP, 5 );
|
||||
|
||||
|
||||
bMainSizer->Add( bmiddlerSizer, 0, wxEXPAND|wxTOP, 2 );
|
||||
|
@ -231,7 +239,6 @@ DIALOG_GENDRILL_BASE::DIALOG_GENDRILL_BASE( wxWindow* parent, wxWindowID id, con
|
|||
|
||||
this->SetSizer( bMainSizer );
|
||||
this->Layout();
|
||||
bMainSizer->Fit( this );
|
||||
|
||||
this->Centre( wxBOTH );
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@
|
|||
<property name="minimum_size"></property>
|
||||
<property name="name">DIALOG_GENDRILL_BASE</property>
|
||||
<property name="pos"></property>
|
||||
<property name="size">-1,-1</property>
|
||||
<property name="size">643,558</property>
|
||||
<property name="style">wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER</property>
|
||||
<property name="subclass">DIALOG_SHIM; dialog_shim.h</property>
|
||||
<property name="title">Generate Drill Files</property>
|
||||
|
@ -703,6 +703,128 @@
|
|||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxTOP|wxRIGHT|wxLEFT</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxStaticText" expanded="1">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer"></property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="caption"></property>
|
||||
<property name="caption_visible">1</property>
|
||||
<property name="center_pane">0</property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="default_pane">0</property>
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
<property name="font"></property>
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">Note:</property>
|
||||
<property name="markup">0</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="min_size"></property>
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_staticTextInfo1</property>
|
||||
<property name="pane_border">1</property>
|
||||
<property name="pane_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="pin_button">1</property>
|
||||
<property name="pos"></property>
|
||||
<property name="resize">Resizable</property>
|
||||
<property name="show">1</property>
|
||||
<property name="size"></property>
|
||||
<property name="style"></property>
|
||||
<property name="subclass">; ; forward_declare</property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<property name="wrap">-1</property>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxBOTTOM|wxRIGHT|wxLEFT</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxStaticText" expanded="1">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer"></property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="caption"></property>
|
||||
<property name="caption_visible">1</property>
|
||||
<property name="center_pane">0</property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="default_pane">0</property>
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
<property name="font"></property>
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">A drill map is a doc. file, not a fab. file</property>
|
||||
<property name="markup">0</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="min_size"></property>
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_staticTextInfo</property>
|
||||
<property name="pane_border">1</property>
|
||||
<property name="pane_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="pin_button">1</property>
|
||||
<property name="pos"></property>
|
||||
<property name="resize">Resizable</property>
|
||||
<property name="show">1</property>
|
||||
<property name="size"></property>
|
||||
<property name="style"></property>
|
||||
<property name="subclass">; ; forward_declare</property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<property name="wrap">-1</property>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALL|wxEXPAND</property>
|
||||
|
@ -721,7 +843,7 @@
|
|||
<property name="caption"></property>
|
||||
<property name="caption_visible">1</property>
|
||||
<property name="center_pane">0</property>
|
||||
<property name="choices">"PostScript" "DXF" "SVG" "PDF"</property>
|
||||
<property name="choices">"PostScript" "Gerber X2" "DXF" "SVG" "PDF"</property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
|
@ -753,13 +875,13 @@
|
|||
<property name="pin_button">1</property>
|
||||
<property name="pos"></property>
|
||||
<property name="resize">Resizable</property>
|
||||
<property name="selection">5</property>
|
||||
<property name="selection">4</property>
|
||||
<property name="show">1</property>
|
||||
<property name="size"></property>
|
||||
<property name="style">wxRA_SPECIFY_COLS</property>
|
||||
<property name="subclass"></property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip">Creates a drill map in PS, HPGL or other formats</property>
|
||||
<property name="tooltip">Creates a drill map in PDF or other formats</property>
|
||||
<property name="validator_data_type"></property>
|
||||
<property name="validator_style">wxFILTER_NONE</property>
|
||||
<property name="validator_type">wxDefaultValidator</property>
|
||||
|
@ -774,7 +896,7 @@
|
|||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxEXPAND</property>
|
||||
<property name="proportion">1</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxBoxSizer" expanded="1">
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">bLeftSizer</property>
|
||||
|
@ -1125,7 +1247,7 @@
|
|||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxEXPAND|wxTOP</property>
|
||||
<property name="proportion">1</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxBoxSizer" expanded="0">
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">bRightBoxSizer</property>
|
||||
|
|
|
@ -50,6 +50,8 @@ class DIALOG_GENDRILL_BASE : public DIALOG_SHIM
|
|||
wxCheckBox* m_Check_Merge_PTH_NPTH;
|
||||
wxRadioBox* m_radioBoxOvalHoleMode;
|
||||
wxRadioButton* m_rbGerberX2;
|
||||
wxStaticText* m_staticTextInfo1;
|
||||
wxStaticText* m_staticTextInfo;
|
||||
wxRadioBox* m_Choice_Drill_Map;
|
||||
wxRadioBox* m_Choice_Drill_Offset;
|
||||
wxRadioBox* m_Choice_Unit;
|
||||
|
@ -88,7 +90,7 @@ class DIALOG_GENDRILL_BASE : public DIALOG_SHIM
|
|||
|
||||
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( 643,558 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
|
||||
|
||||
~DIALOG_GENDRILL_BASE();
|
||||
|
||||
|
|
|
@ -90,11 +90,9 @@ bool GENDRILL_WRITER_BASE::genDrillMapFile( const wxString& aFullFileName, PLOT_
|
|||
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)
|
||||
// Currently HPGL (old format not very used)
|
||||
|
||||
if( aFormat == PLOT_FORMAT::HPGL || aFormat == PLOT_FORMAT::GERBER )
|
||||
if( aFormat == PLOT_FORMAT::HPGL )
|
||||
aFormat = PLOT_FORMAT::PDF;
|
||||
|
||||
// Calculate the scale for the format type, scale 1 in HPGL, drawing on
|
||||
|
@ -102,7 +100,11 @@ bool GENDRILL_WRITER_BASE::genDrillMapFile( const wxString& aFullFileName, PLOT_
|
|||
switch( aFormat )
|
||||
{
|
||||
case PLOT_FORMAT::GERBER:
|
||||
case PLOT_FORMAT::HPGL: // Scale for HPGL format.
|
||||
plotter = new GERBER_PLOTTER();
|
||||
plotter->SetViewport( offset, IU_PER_MILS / 10, scale, false );
|
||||
plotter->SetGerberCoordinatesFormat( 5 ); // format x.5 unit = mm
|
||||
break;
|
||||
|
||||
default:
|
||||
wxASSERT( false );
|
||||
KI_FALLTHROUGH;
|
||||
|
@ -182,42 +184,55 @@ bool GENDRILL_WRITER_BASE::genDrillMapFile( const wxString& aFullFileName, PLOT_
|
|||
return false;
|
||||
}
|
||||
|
||||
plotter->ClearHeaderLinesList();
|
||||
|
||||
// For the Gerber X2 format we need to set the "FileFunction" to Drillmap
|
||||
// and set a few other options.
|
||||
if( plotter->GetPlotterType() == PLOT_FORMAT::GERBER )
|
||||
{
|
||||
GERBER_PLOTTER* gbrplotter = static_cast <GERBER_PLOTTER*> ( plotter );
|
||||
gbrplotter->DisableApertMacros( false );
|
||||
gbrplotter->UseX2format( true ); // Mandatory
|
||||
gbrplotter->UseX2NetAttributes( false ); // net attributes hace no meaning here
|
||||
|
||||
// Attributes are added using X2 format
|
||||
AddGerberX2Header( gbrplotter, m_pcb, false );
|
||||
|
||||
wxString text;
|
||||
|
||||
// Add the TF.FileFunction
|
||||
text = "%TF.FileFunction,Drillmap*%";
|
||||
gbrplotter->AddLineToHeader( text );
|
||||
|
||||
// Add the TF.FilePolarity
|
||||
text = wxT( "%TF.FilePolarity,Positive*%" );
|
||||
gbrplotter->AddLineToHeader( text );
|
||||
}
|
||||
|
||||
plotter->StartPlot();
|
||||
|
||||
// Draw items on edge layer (not all, only items useful for drill map
|
||||
// Draw items on edge layer.
|
||||
// Not all, only items useful for drill map, i.e. board outlines.
|
||||
BRDITEMS_PLOTTER itemplotter( plotter, m_pcb, plot_opts );
|
||||
itemplotter.SetLayerSet( Edge_Cuts );
|
||||
|
||||
// Use attributes of a drawing layer (we are not really draw the Edge.Cuts layer)
|
||||
itemplotter.SetLayerSet( Dwgs_User );
|
||||
|
||||
for( BOARD_ITEM* item : m_pcb->Drawings() )
|
||||
{
|
||||
if( item->GetLayer() != Edge_Cuts )
|
||||
continue;
|
||||
|
||||
switch( item->Type() )
|
||||
{
|
||||
case PCB_SHAPE_T:
|
||||
itemplotter.PlotPcbShape( static_cast<PCB_SHAPE*>( item ) );
|
||||
{
|
||||
PCB_SHAPE dummy_shape( *static_cast<PCB_SHAPE*>( item ) );
|
||||
dummy_shape.SetLayer( Dwgs_User );
|
||||
itemplotter.PlotPcbShape( &dummy_shape );
|
||||
}
|
||||
break;
|
||||
|
||||
case PCB_TEXT_T:
|
||||
{
|
||||
PCB_TEXT* text = static_cast<PCB_TEXT*>( item );
|
||||
itemplotter.PlotPcbText( text, text->GetLayer(), text->IsKnockout() );
|
||||
break;
|
||||
}
|
||||
|
||||
case PCB_TEXTBOX_T:
|
||||
{
|
||||
PCB_TEXTBOX* textbox = static_cast<PCB_TEXTBOX*>( item );
|
||||
itemplotter.PlotPcbText( textbox, textbox->GetLayer(), textbox->IsKnockout() );
|
||||
itemplotter.PlotPcbShape( textbox );
|
||||
break;
|
||||
}
|
||||
|
||||
case PCB_DIM_ALIGNED_T:
|
||||
case PCB_DIM_CENTER_T:
|
||||
case PCB_DIM_RADIAL_T:
|
||||
case PCB_DIM_ORTHOGONAL_T:
|
||||
case PCB_DIM_LEADER_T:
|
||||
case PCB_TARGET_T:
|
||||
case PCB_MARKER_T: // do not draw
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue