2009-04-05 20:49:15 +00:00
|
|
|
|
2009-01-10 08:03:07 +00:00
|
|
|
/*********************************************************/
|
|
|
|
/****Function to plot a board in GERBER RS274X format ****/
|
|
|
|
/*********************************************************/
|
|
|
|
|
|
|
|
/* Creates the output files, one per board layer:
|
|
|
|
* filenames are like xxxc.PHO and use the RS274X format
|
|
|
|
* Units = inches
|
|
|
|
* format 3.4, Leading zero omitted, Abs format
|
|
|
|
* format 3.4 uses the native pcbnew units (1/10000 inch).
|
|
|
|
*/
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
#include "fctsys.h"
|
|
|
|
#include "common.h"
|
|
|
|
#include "plot_common.h"
|
2009-02-04 15:25:03 +00:00
|
|
|
#include "confirm.h"
|
2007-06-05 12:10:51 +00:00
|
|
|
#include "pcbnew.h"
|
|
|
|
#include "pcbplot.h"
|
|
|
|
#include "trigo.h"
|
|
|
|
|
2009-06-28 16:50:42 +00:00
|
|
|
#include "protos.h"
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
/********************************************************************************/
|
2008-03-22 05:55:06 +00:00
|
|
|
void WinEDA_BasePcbFrame::Genere_GERBER( const wxString& FullFileName, int Layer,
|
2009-06-29 05:30:08 +00:00
|
|
|
bool PlotOriginIsAuxAxis,
|
|
|
|
GRTraceMode trace_mode )
|
2007-06-05 12:10:51 +00:00
|
|
|
/********************************************************************************/
|
2007-11-01 05:27:31 +00:00
|
|
|
|
2008-10-25 10:21:46 +00:00
|
|
|
/* Creates the output files, one per board layer:
|
|
|
|
* filenames are like xxxc.PHO and use the RS274X format
|
|
|
|
* Units = inches
|
|
|
|
* format 3.4, Leading zero omitted, Abs format
|
|
|
|
* format 3.4 uses the native pcbnew units (1/10000 inch).
|
2007-11-01 05:27:31 +00:00
|
|
|
*/
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2009-06-28 16:50:42 +00:00
|
|
|
wxPoint offset;
|
2008-03-22 05:55:06 +00:00
|
|
|
|
|
|
|
EraseMsgBox();
|
|
|
|
|
|
|
|
|
2009-01-10 08:03:07 +00:00
|
|
|
/* Calculate scaling from pcbnew units (in 0.1 mil or 0.0001 inch) to gerber units */
|
2009-06-28 16:50:42 +00:00
|
|
|
double scale = g_pcb_plot_options.Scale;
|
2009-02-26 00:37:04 +00:00
|
|
|
|
2008-03-22 05:55:06 +00:00
|
|
|
if( PlotOriginIsAuxAxis )
|
2009-06-28 16:50:42 +00:00
|
|
|
offset = m_Auxiliary_Axis_Position;
|
2009-06-29 05:30:08 +00:00
|
|
|
else
|
2009-06-28 16:50:42 +00:00
|
|
|
{
|
2009-06-29 05:30:08 +00:00
|
|
|
offset.x = 0;
|
|
|
|
offset.y = 0;
|
2009-06-28 16:50:42 +00:00
|
|
|
}
|
2008-03-22 05:55:06 +00:00
|
|
|
|
2009-06-29 05:30:08 +00:00
|
|
|
FILE* output_file = wxFopen( FullFileName, wxT( "wt" ) );
|
2009-06-28 16:50:42 +00:00
|
|
|
if( output_file == NULL )
|
2008-03-22 05:55:06 +00:00
|
|
|
{
|
|
|
|
wxString msg = _( "unable to create file " ) + FullFileName;
|
|
|
|
DisplayError( this, msg );
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2008-12-22 21:06:44 +00:00
|
|
|
SetLocaleTo_C_standard();
|
2009-08-29 10:20:48 +00:00
|
|
|
PLOTTER* plotter = new GERBER_PLOTTER();
|
2009-06-28 16:50:42 +00:00
|
|
|
/* No mirror and scaling for gerbers! */
|
2009-06-29 05:30:08 +00:00
|
|
|
plotter->set_viewport( offset, scale, 0 );
|
2009-06-28 16:50:42 +00:00
|
|
|
plotter->set_default_line_width( g_pcb_plot_options.PlotLine_Width );
|
2009-06-29 05:30:08 +00:00
|
|
|
plotter->set_creator( wxT( "PCBNEW-RS274X" ) );
|
|
|
|
plotter->set_filename( FullFileName );
|
2008-03-22 05:55:06 +00:00
|
|
|
|
|
|
|
Affiche_1_Parametre( this, 0, _( "File" ), FullFileName, CYAN );
|
|
|
|
|
2009-06-29 05:30:08 +00:00
|
|
|
plotter->start_plot( output_file );
|
|
|
|
|
2009-06-28 16:50:42 +00:00
|
|
|
// Sheet refs on gerber CAN be useful... and they're always 1:1
|
|
|
|
if( g_pcb_plot_options.Plot_Frame_Ref )
|
2009-06-29 05:30:08 +00:00
|
|
|
PlotWorkSheet( plotter, GetScreen() );
|
|
|
|
Plot_Layer( plotter, Layer, trace_mode );
|
2008-03-22 05:55:06 +00:00
|
|
|
|
2009-06-28 16:50:42 +00:00
|
|
|
plotter->end_plot();
|
|
|
|
delete plotter;
|
2008-12-22 21:06:44 +00:00
|
|
|
SetLocaleTo_Default();
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|