plotdxf.cpp 1.01 KB
Newer Older
1 2 3 4
/**
 * @file plotdxf.cpp
 * @brief Plot DXF.
 */
charras's avatar
charras committed
5

6 7 8 9 10 11 12 13 14 15
#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>
16

charras's avatar
charras committed
17

18
bool PCB_BASE_FRAME::ExportToDxfFile( const wxString& aFullFileName, int aLayer,
19
                                      EDA_DRAW_MODE_T aTraceMode )
charras's avatar
charras committed
20
{
21
    LOCALE_IO   toggle;
charras's avatar
charras committed
22

23 24
    FILE* output_file = wxFopen( aFullFileName, wxT( "wt" ) );

charras's avatar
charras committed
25 26
    if( output_file == NULL )
    {
27
        return false;
charras's avatar
charras committed
28 29
    }

30
    DXF_PLOTTER* plotter = new DXF_PLOTTER();
31
    plotter->SetPageSettings( GetPageSettings() );
32
    plotter->set_viewport( wxPoint( 0, 0 ), 1, 0 );
charras's avatar
charras committed
33
    plotter->set_creator( wxT( "PCBNEW-DXF" ) );
34
    plotter->set_filename( aFullFileName );
charras's avatar
charras committed
35 36
    plotter->start_plot( output_file );

37
    if( g_PcbPlotOptions.m_PlotFrameRef )
charras's avatar
charras committed
38 39
        PlotWorkSheet( plotter, GetScreen() );

40
    Plot_Layer( plotter, aLayer, aTraceMode );
charras's avatar
charras committed
41 42
    plotter->end_plot();
    delete plotter;
43
    return true;
charras's avatar
charras committed
44
}