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
|
|
|
|
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() );
|
2009-11-20 14:55:20 +00:00
|
|
|
plotter->set_viewport( wxPoint( 0, 0 ), 1, 0 );
|
2009-06-30 19:27:39 +00:00
|
|
|
plotter->set_creator( wxT( "PCBNEW-DXF" ) );
|
2011-09-29 16:49:40 +00:00
|
|
|
plotter->set_filename( aFullFileName );
|
2009-06-30 19:27:39 +00:00
|
|
|
plotter->start_plot( output_file );
|
|
|
|
|
2010-12-11 18:40:39 +00:00
|
|
|
if( g_PcbPlotOptions.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 );
|
2009-06-30 19:27:39 +00:00
|
|
|
plotter->end_plot();
|
|
|
|
delete plotter;
|
2010-01-01 13:30:39 +00:00
|
|
|
return true;
|
2009-06-30 19:27:39 +00:00
|
|
|
}
|