2011-09-23 13:57:12 +00:00
|
|
|
/**
|
|
|
|
* @file plotdxf.cpp
|
|
|
|
* @brief Plot DXF.
|
|
|
|
*/
|
2009-06-30 19:27:39 +00:00
|
|
|
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <fctsys.h>
|
|
|
|
#include <common.h>
|
|
|
|
#include <plot_common.h>
|
|
|
|
#include <confirm.h>
|
|
|
|
#include <trigo.h>
|
|
|
|
#include <wxBasePcbFrame.h>
|
|
|
|
|
|
|
|
#include <pcbnew.h>
|
|
|
|
#include <protos.h>
|
|
|
|
#include <pcbplot.h>
|
2011-09-23 13:57:12 +00:00
|
|
|
|
2009-06-30 19:27:39 +00:00
|
|
|
|
2011-09-29 16:49:40 +00:00
|
|
|
bool PCB_BASE_FRAME::ExportToDxfFile( const wxString& aFullFileName, int aLayer,
|
2012-01-03 17:14:17 +00:00
|
|
|
EDA_DRAW_MODE_T aTraceMode )
|
2009-06-30 19:27:39 +00:00
|
|
|
{
|
2011-12-22 21:57:50 +00:00
|
|
|
LOCALE_IO toggle;
|
2009-06-30 19:27:39 +00:00
|
|
|
|
2012-04-05 18:27:56 +00:00
|
|
|
const PCB_PLOT_PARAMS& plot_opts = GetPlotSettings();
|
|
|
|
|
2011-09-29 16:49:40 +00:00
|
|
|
FILE* output_file = wxFopen( aFullFileName, wxT( "wt" ) );
|
|
|
|
|
2009-06-30 19:27:39 +00:00
|
|
|
if( output_file == NULL )
|
|
|
|
{
|
2010-01-01 13:30:39 +00:00
|
|
|
return false;
|
2009-06-30 19:27:39 +00:00
|
|
|
}
|
|
|
|
|
2009-08-29 10:20:48 +00:00
|
|
|
DXF_PLOTTER* plotter = new DXF_PLOTTER();
|
2011-12-22 21:57:50 +00:00
|
|
|
plotter->SetPageSettings( GetPageSettings() );
|
2012-05-03 18:37:56 +00:00
|
|
|
plotter->SetViewport( wxPoint( 0, 0 ), IU_PER_DECIMILS, 1, 0 );
|
|
|
|
plotter->SetCreator( wxT( "PCBNEW-DXF" ) );
|
|
|
|
plotter->SetFilename( aFullFileName );
|
|
|
|
plotter->StartPlot( output_file );
|
2009-06-30 19:27:39 +00:00
|
|
|
|
2012-04-05 18:27:56 +00:00
|
|
|
if( plot_opts.m_PlotFrameRef )
|
2009-06-30 19:27:39 +00:00
|
|
|
PlotWorkSheet( plotter, GetScreen() );
|
|
|
|
|
2011-09-29 16:49:40 +00:00
|
|
|
Plot_Layer( plotter, aLayer, aTraceMode );
|
2012-05-03 18:37:56 +00:00
|
|
|
plotter->EndPlot();
|
2009-06-30 19:27:39 +00:00
|
|
|
delete plotter;
|
2010-01-01 13:30:39 +00:00
|
|
|
return true;
|
2009-06-30 19:27:39 +00:00
|
|
|
}
|