Option now provided for Gerber files to exclude contents of Edges Pcb layer

This commit is contained in:
g_harland
2007-08-24 10:10:42 +00:00
parent c92e9e938a
commit 908f6d936b
7 changed files with 241 additions and 183 deletions
+174 -149
View File
@@ -16,12 +16,12 @@
#define PLOT_DEFAULT_MARGE 300 // mils
/* variables locale : */
// variables locale :
static long s_SelectedLayers = CUIVRE_LAYER | CMP_LAYER |
SILKSCREEN_LAYER_CMP | SILKSCREEN_LAYER_CU;
static bool s_PlotOriginIsAuxAxis = FALSE;
/* Routines Locales */
// Routines Locales
enum id_plotps
{
@@ -37,6 +37,7 @@ enum id_plotps
ID_SEL_PLOT_FORMAT,
ID_SEL_GERBER_FORMAT,
ID_SAVE_OPT_PLOT,
ID_EXCLUDE_EDGES_PCB,
ID_PRINT_REF,
ID_PRINT_VALUE,
ID_PRINT_MODULE_TEXTS,
@@ -66,6 +67,7 @@ public:
wxCheckBox * m_PlotMirorOpt;
wxCheckBox * m_PlotNoViaOnMaskOpt;
wxCheckBox * m_HPGL_PlotCenter_Opt;
wxCheckBox * m_Exclude_Edges_Pcb;
wxCheckBox * m_Plot_Sheet_Ref;
wxCheckBox * m_Plot_Invisible_Text;
wxCheckBox * m_Plot_Text_Value;
@@ -105,10 +107,11 @@ BEGIN_EVENT_TABLE(WinEDA_PlotFrame, wxDialog)
END_EVENT_TABLE()
const int UNITS_MILS = 1000;
const int H_SIZE = 640;
const int V_SIZE = 430;
#define UNITS_MILS 1000
#define H_SIZE 640
#define V_SIZE 430
/********************************************************************/
WinEDA_PlotFrame::WinEDA_PlotFrame(WinEDA_BasePcbFrame * parent):
wxDialog(parent, -1, _("Plot"),
@@ -146,35 +149,35 @@ wxString fmtmsg[4] = { wxT("HPGL"), wxT("Gerber"), wxT("Postscript"), wxT("Posts
MidRightBoxSizer->Add(m_PlotFormatOpt, 0, wxGROW|wxALL, 5);
switch ( m_PlotFormat )
{
case PLOT_FORMAT_HPGL:
m_PlotFormatOpt->SetSelection(0);
break;
case PLOT_FORMAT_HPGL:
m_PlotFormatOpt->SetSelection(0);
break;
case PLOT_FORMAT_GERBER:
m_PlotFormatOpt->SetSelection(1);
break;
case PLOT_FORMAT_GERBER:
m_PlotFormatOpt->SetSelection(1);
break;
default: // ( PLOT_FORMAT_POST or PLOT_FORMAT_POST_A4 )
// As m_PlotFormat is never set to a value of PLOT_FORMAT_POST_A4,
// use the value of g_ForcePlotPS_On_A4 to determine whether the
// "Postscript" or "Postscipt A4" radiobutton had been selected
// previously (and thus which button should be reselected now).
if ( g_ForcePlotPS_On_A4 )
m_PlotFormatOpt->SetSelection(3);
else
m_PlotFormatOpt->SetSelection(2);
break;
default: // ( PLOT_FORMAT_POST or PLOT_FORMAT_POST_A4 )
// As m_PlotFormat is never set to a value of PLOT_FORMAT_POST_A4,
// use the value of g_ForcePlotPS_On_A4 to determine whether the
// "Postscript" or "Postscipt A4" radiobutton had been selected
// previously (and thus which button should be reselected now).
if( g_ForcePlotPS_On_A4 )
m_PlotFormatOpt->SetSelection(3);
else
m_PlotFormatOpt->SetSelection(2);
break;
}
/* Creation des menus d'option du format GERBER */
// Creation des menus d'option du format GERBER
m_GerbSpotSizeMinOpt = new WinEDA_ValueCtrl(this, _("Spot min"),
spot_mini, g_UnitMetric, MidRightBoxSizer, UNITS_MILS);
/* Creation des menus d'option du format HPGL */
// Creation des menus d'option du format HPGL
m_HPGLPenSizeOpt = new WinEDA_ValueCtrl(this, _("Pen Size"),
g_HPGL_Pen_Diam, g_UnitMetric, MidRightBoxSizer, UNITS_MILS);
/* unites standards = cm pour vitesse plume en HPLG */
// unites standards = cm pour vitesse plume en HPGL
m_HPGLPenSpeedOpt = new WinEDA_ValueCtrl(this, _("Pen Speed (cm/s)"),
g_HPGL_Pen_Speed, CENTIMETRE, MidRightBoxSizer, 1);
m_HPGLPenSpeedOpt->SetToolTip(_("Set pen speed in cm/s"));
@@ -187,14 +190,15 @@ wxString fmtmsg[4] = { wxT("HPGL"), wxT("Gerber"), wxT("Postscript"), wxT("Posts
g_PlotLine_Width, g_UnitMetric, MidRightBoxSizer, PCB_INTERNAL_UNIT);
m_LinesWidth->SetToolTip(_("Set width for lines in Line plot mode"));
/* Create the right column commands */
// Create the right column commands
wxString choice_plot_offset_msg[] =
{_("Absolute"), _("Auxiliary axis")};
m_Choice_Plot_Offset = new wxRadioBox(this, ID_SEL_PLOT_OFFSET_OPTION,
_("Plot Origin"),
wxDefaultPosition,wxSize(-1,-1),
2,choice_plot_offset_msg,1,wxRA_SPECIFY_COLS);
if ( s_PlotOriginIsAuxAxis ) m_Choice_Plot_Offset->SetSelection(1);
if( s_PlotOriginIsAuxAxis )
m_Choice_Plot_Offset->SetSelection(1);
RightBoxSizer->Add(m_Choice_Plot_Offset, 0, wxGROW|wxALL, 5);
/* Add a spacer for a better look */
RightBoxSizer->Add(5, 5, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 20);
@@ -216,10 +220,9 @@ wxString choice_plot_offset_msg[] =
Button->SetForegroundColour(wxColour(0,80,80) );
RightBoxSizer->Add(Button, 0, wxGROW|wxALL, 5);
// Create scale adjust option
m_XScaleAdjust = m_YScaleAdjust = 1.0;
if ( m_Parent->m_Parent->m_EDA_Config )
if( m_Parent->m_Parent->m_EDA_Config )
{
m_Parent->m_Parent->m_EDA_Config->Read(wxT("PlotXFineScaleAdj"), &m_XScaleAdjust);
m_Parent->m_Parent->m_EDA_Config->Read(wxT("PlotYFineScaleAdj"), &m_YScaleAdjust);
@@ -233,32 +236,41 @@ wxString choice_plot_offset_msg[] =
m_Plot_PS_Negative->SetValue(g_Plot_PS_Negative);
RightBoxSizer->Add(m_Plot_PS_Negative, 0, wxGROW|wxALL, 5);
/* Creation de la liste des layers */
// Creation de la liste des layers
int mask = 1;
wxBoxSizer * OneColonLayerBoxSizer = new wxBoxSizer(wxVERTICAL);
LayersBoxSizer->Add(OneColonLayerBoxSizer, 0, wxGROW|wxALL, 5);
for ( ii = 0; ii < NB_LAYERS; ii++, mask <<= 1 )
{
if ( ii == 16 )
if( ii == 16 )
{
OneColonLayerBoxSizer = new wxBoxSizer(wxVERTICAL);
LayersBoxSizer->Add(OneColonLayerBoxSizer, 0, wxGROW|wxALL, 5);
}
m_BoxSelecLayer[ii] = new wxCheckBox(this, -1,
ReturnPcbLayerName(ii));
if ( mask & s_SelectedLayers) m_BoxSelecLayer[ii]->SetValue(true);
m_BoxSelecLayer[ii] = new wxCheckBox(this, -1, ReturnPcbLayerName(ii));
if( mask & s_SelectedLayers )
m_BoxSelecLayer[ii]->SetValue(true);
OneColonLayerBoxSizer->Add(m_BoxSelecLayer[ii], 0, wxGROW|wxALL, 1);
}
// Option for excluding contents of "Edges Pcb" layer
m_Exclude_Edges_Pcb = new wxCheckBox(this,
ID_EXCLUDE_EDGES_PCB, _("Exclude Edges Pcb layer") );
m_Exclude_Edges_Pcb->SetValue(Exclude_Edges_Pcb);
m_Exclude_Edges_Pcb->SetToolTip(
_("Exclude contents of Edges Pcb layer from all other layers") );
LeftBoxSizer->Add(m_Exclude_Edges_Pcb, 0, wxGROW|wxALL, 1);
// Option d'impression du cartouche:
if ( m_Parent->m_Print_Sheet_Ref )
if( m_Parent->m_Print_Sheet_Ref )
{
m_Plot_Sheet_Ref = new wxCheckBox(this, ID_PRINT_REF, _("Print Sheet Ref") );
m_Plot_Sheet_Ref->SetValue(Plot_Sheet_Ref);
LeftBoxSizer->Add(m_Plot_Sheet_Ref, 0, wxGROW|wxALL, 1);
}
else Plot_Sheet_Ref = false;
else
Plot_Sheet_Ref = false;
// Option d'impression des pads sur toutes les couches
m_Plot_Pads_on_Silkscreen = new wxCheckBox(this,
@@ -349,20 +361,24 @@ wxCommandEvent event;
GetSizer()->SetSizeHints(this);
}
/***************************************************************/
void WinEDA_PlotFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
/***************************************************************/
/* Called by the close button
*/
*/
{
Close(true); // true is to force the frame to close
}
/****************************************************/
void WinEDA_PlotFrame::OnClose(wxCloseEvent & event)
/****************************************************/
/* called when WinEDA_PlotFrame is closed
*/
/* Called when WinEDA_PlotFrame is closed
*/
{
EndModal(0);
}
@@ -371,17 +387,20 @@ void WinEDA_PlotFrame::OnClose(wxCloseEvent & event)
/*********************************************************/
void WinEDA_PlotFrame::CreateDrillFile(wxCommandEvent & event)
/*********************************************************/
/* Create the board drill file used with gerber documents
*/
*/
{
((WinEDA_PcbFrame * )m_Parent)->InstallDrillFrame(event);
}
/*********************************************************/
void WinEDA_PlotFrame::SetCommands(wxCommandEvent & event)
/*********************************************************/
/* active ou désactive les différents menus d'option selon le standard choisi
*/
*/
{
int format;
int format_list[] =
@@ -390,76 +409,82 @@ int format_list[] =
format = format_list[m_PlotFormatOpt->GetSelection()];
switch ( format )
{
case PLOT_FORMAT_POST_A4:
case PLOT_FORMAT_POST:
m_Drill_Shape_Opt->Enable(true);
m_PlotModeOpt->Enable(true);
m_PlotMirorOpt->Enable(true);
m_GerbSpotSizeMinOpt->Enable(false);
m_Choice_Plot_Offset->Enable(false);
m_LinesWidth->Enable(true);
m_HPGLPenSizeOpt->Enable(false);
m_HPGLPenSpeedOpt->Enable(false);
m_HPGLPenOverlayOpt->Enable(false);
m_HPGL_PlotCenter_Opt->Enable(false);
m_Plot_Sheet_Ref->Enable(true);
m_Scale_Opt->Enable(true);
m_FineAdjustXscaleOpt->Enable(true);
m_FineAdjustYscaleOpt->Enable(true);
m_PlotFormat = PLOT_FORMAT_POST;
if ( format == PLOT_FORMAT_POST_A4 ) g_ForcePlotPS_On_A4 = true;
else g_ForcePlotPS_On_A4 = false;
m_Plot_PS_Negative->Enable(true);
break;
switch( format )
{
case PLOT_FORMAT_POST_A4:
case PLOT_FORMAT_POST:
default:
m_Drill_Shape_Opt->Enable(true);
m_PlotModeOpt->Enable(true);
m_PlotMirorOpt->Enable(true);
m_GerbSpotSizeMinOpt->Enable(false);
m_Choice_Plot_Offset->Enable(false);
m_LinesWidth->Enable(true);
m_HPGLPenSizeOpt->Enable(false);
m_HPGLPenSpeedOpt->Enable(false);
m_HPGLPenOverlayOpt->Enable(false);
m_HPGL_PlotCenter_Opt->Enable(false);
m_Exclude_Edges_Pcb->Enable(false);
m_Plot_Sheet_Ref->Enable(true);
m_Scale_Opt->Enable(true);
m_FineAdjustXscaleOpt->Enable(true);
m_FineAdjustYscaleOpt->Enable(true);
m_PlotFormat = PLOT_FORMAT_POST;
g_ForcePlotPS_On_A4 = (format == PLOT_FORMAT_POST_A4);
m_Plot_PS_Negative->Enable(true);
break;
case PLOT_FORMAT_GERBER:
m_Drill_Shape_Opt->Enable(false);
m_PlotModeOpt->Enable(false);
m_PlotMirorOpt->Enable(false);
m_GerbSpotSizeMinOpt->Enable(true);
m_Choice_Plot_Offset->Enable(true);
m_LinesWidth->Enable(true);
m_HPGLPenSizeOpt->Enable(false);
m_HPGLPenSpeedOpt->Enable(false);
m_HPGLPenOverlayOpt->Enable(false);
m_HPGL_PlotCenter_Opt->Enable(false);
m_Plot_Sheet_Ref->Enable(false);
m_Scale_Opt->Enable(false);
m_FineAdjustXscaleOpt->Enable(false);
m_FineAdjustYscaleOpt->Enable(false);
m_PlotFormat = PLOT_FORMAT_GERBER;
m_Plot_PS_Negative->Enable(false);
break;
case PLOT_FORMAT_GERBER:
m_Drill_Shape_Opt->Enable(false);
m_PlotModeOpt->Enable(false);
m_PlotMirorOpt->Enable(false);
m_GerbSpotSizeMinOpt->Enable(true);
m_Choice_Plot_Offset->Enable(true);
m_LinesWidth->Enable(true);
m_HPGLPenSizeOpt->Enable(false);
m_HPGLPenSpeedOpt->Enable(false);
m_HPGLPenOverlayOpt->Enable(false);
m_HPGL_PlotCenter_Opt->Enable(false);
m_Exclude_Edges_Pcb->Enable(true);
m_Plot_Sheet_Ref->Enable(false);
m_Scale_Opt->Enable(false);
m_FineAdjustXscaleOpt->Enable(false);
m_FineAdjustYscaleOpt->Enable(false);
m_PlotFormat = PLOT_FORMAT_GERBER;
m_Plot_PS_Negative->Enable(false);
break;
case PLOT_FORMAT_HPGL:
m_PlotMirorOpt->Enable(true);
m_Drill_Shape_Opt->Enable(false);
m_PlotModeOpt->Enable(true);
m_GerbSpotSizeMinOpt->Enable(false);
m_Choice_Plot_Offset->Enable(false);
m_LinesWidth->Enable(false);
m_HPGLPenSizeOpt->Enable(true);
m_HPGLPenSpeedOpt->Enable(true);
m_HPGLPenOverlayOpt->Enable(true);
m_HPGL_PlotCenter_Opt->Enable(true);
m_Plot_Sheet_Ref->Enable(true);
m_Scale_Opt->Enable(true);
m_FineAdjustXscaleOpt->Enable(false);
m_FineAdjustYscaleOpt->Enable(false);
m_PlotFormat = PLOT_FORMAT_HPGL;
m_Plot_PS_Negative->Enable(false);
break;
}
case PLOT_FORMAT_HPGL:
m_PlotMirorOpt->Enable(true);
m_Drill_Shape_Opt->Enable(false);
m_PlotModeOpt->Enable(true);
m_GerbSpotSizeMinOpt->Enable(false);
m_Choice_Plot_Offset->Enable(false);
m_LinesWidth->Enable(false);
m_HPGLPenSizeOpt->Enable(true);
m_HPGLPenSpeedOpt->Enable(true);
m_HPGLPenOverlayOpt->Enable(true);
m_HPGL_PlotCenter_Opt->Enable(true);
m_Exclude_Edges_Pcb->Enable(false);
m_Plot_Sheet_Ref->Enable(true);
m_Scale_Opt->Enable(true);
m_FineAdjustXscaleOpt->Enable(false);
m_FineAdjustYscaleOpt->Enable(false);
m_PlotFormat = PLOT_FORMAT_HPGL;
m_Plot_PS_Negative->Enable(false);
break;
}
format_plot = m_PlotFormat;
}
/*********************************************************/
void WinEDA_PlotFrame::SaveOptPlot(wxCommandEvent & event)
/*********************************************************/
{
if ( m_Plot_Sheet_Ref )
Exclude_Edges_Pcb = m_Exclude_Edges_Pcb->GetValue();
if( m_Plot_Sheet_Ref )
Plot_Sheet_Ref = m_Plot_Sheet_Ref->GetValue();
PlotPadsOnSilkLayer = m_Plot_Pads_on_Silkscreen->GetValue();
@@ -475,8 +500,10 @@ void WinEDA_PlotFrame::SaveOptPlot(wxCommandEvent & event)
g_PlotScaleOpt = m_Scale_Opt->GetSelection();
g_DrillShapeOpt = m_Drill_Shape_Opt->GetSelection();
Plot_Set_MIROIR = m_PlotMirorOpt->GetValue();
if ( Plot_Set_MIROIR ) g_PlotOrient = PLOT_MIROIR;
else g_PlotOrient = 0;
if( Plot_Set_MIROIR )
g_PlotOrient = PLOT_MIROIR;
else
g_PlotOrient = 0;
Plot_Mode = m_PlotModeOpt->GetSelection();
g_DrawViaOnMaskLayer = m_PlotNoViaOnMaskOpt->GetValue();
spot_mini = m_GerbSpotSizeMinOpt->GetValue();
@@ -488,7 +515,8 @@ void WinEDA_PlotFrame::SaveOptPlot(wxCommandEvent & event)
m_XScaleAdjust = m_FineAdjustXscaleOpt->GetValue();
m_YScaleAdjust = m_FineAdjustYscaleOpt->GetValue();
if ( m_Parent->m_Parent->m_EDA_Config )
if( m_Parent->m_Parent->m_EDA_Config )
{
m_Parent->m_Parent->m_EDA_Config->Write(wxT("PlotXFineScaleAdj"), m_XScaleAdjust);
m_Parent->m_Parent->m_EDA_Config->Write(wxT("PlotYFineScaleAdj"), m_YScaleAdjust);
@@ -497,6 +525,7 @@ void WinEDA_PlotFrame::SaveOptPlot(wxCommandEvent & event)
g_Plot_PS_Negative = m_Plot_PS_Negative->GetValue();
}
/***************************************************/
void WinEDA_PlotFrame::Plot(wxCommandEvent & event)
/***************************************************/
@@ -507,75 +536,72 @@ wxString ext;
SaveOptPlot(event);
switch ( g_PlotScaleOpt )
{
default:
Scale_X = Scale_Y = 1;
break;
switch( g_PlotScaleOpt )
{
default:
Scale_X = Scale_Y = 1;
break;
case 2:
Scale_X = Scale_Y = 1.5;
break;
case 2:
Scale_X = Scale_Y = 1.5;
break;
case 3:
Scale_X = Scale_Y = 2;
break;
case 3:
Scale_X = Scale_Y = 2;
break;
case 4:
Scale_X = Scale_Y = 3;
break;
case 4:
Scale_X = Scale_Y = 3;
break;
}
}
Scale_X *= m_XScaleAdjust;
Scale_Y *= m_YScaleAdjust;
Scale_X *= m_XScaleAdjust;
Scale_Y *= m_YScaleAdjust;
BaseFileName = m_Parent->GetScreen()->m_FileName;
ChangeFileNameExt( BaseFileName, wxT("-") );
switch ( m_PlotFormat)
{
case PLOT_FORMAT_POST:
ext = wxT(".ps");
break;
switch( m_PlotFormat)
{
case PLOT_FORMAT_POST:
ext = wxT(".ps");
break;
case PLOT_FORMAT_GERBER:
ext = wxT(".pho");
break;
case PLOT_FORMAT_GERBER:
ext = wxT(".pho");
break;
case PLOT_FORMAT_HPGL:
ext = wxT(".plt");
break;
}
case PLOT_FORMAT_HPGL:
ext = wxT(".plt");
break;
}
int mask = 1;
s_SelectedLayers = 0;
for ( layer_to_plot = 0; layer_to_plot < 29; layer_to_plot++, mask <<= 1 )
for( layer_to_plot = 0; layer_to_plot < 29; layer_to_plot++, mask <<= 1 )
{
if ( m_BoxSelecLayer[layer_to_plot]->GetValue() )
if( m_BoxSelecLayer[layer_to_plot]->GetValue() )
{
s_SelectedLayers |= mask;
/* Calcul du nom du fichier */
// Calcul du nom du fichier
FullFileName = BaseFileName + ReturnPcbLayerName(layer_to_plot, true) + ext;
switch ( m_PlotFormat)
{
case PLOT_FORMAT_POST:
m_Parent->Genere_PS(FullFileName, layer_to_plot);
break;
case PLOT_FORMAT_POST:
m_Parent->Genere_PS(FullFileName, layer_to_plot);
break;
case PLOT_FORMAT_GERBER:
m_Parent->Genere_GERBER(FullFileName, layer_to_plot, s_PlotOriginIsAuxAxis);
break;
case PLOT_FORMAT_HPGL:
m_Parent->Genere_HPGL(FullFileName, layer_to_plot);
break;
case PLOT_FORMAT_GERBER:
m_Parent->Genere_GERBER(FullFileName, layer_to_plot, s_PlotOriginIsAuxAxis);
break;
case PLOT_FORMAT_HPGL:
m_Parent->Genere_HPGL(FullFileName, layer_to_plot);
break;
}
}
}
// Close(true);
}
@@ -588,4 +614,3 @@ void WinEDA_BasePcbFrame::ToPlotter(wxCommandEvent& event)
frame->ShowModal(); frame->Destroy();
}