KiCad PCB EDA Suite
Loading...
Searching...
No Matches
pcbplot.cpp File Reference
#include <plotters/plotter.h>
#include <pcbplot.h>
#include <base_units.h>
#include <locale_io.h>
#include <reporter.h>
#include <board.h>
#include <board_design_settings.h>
#include <plotcontroller.h>
#include <pcb_plot_params.h>
#include <wx/ffile.h>
#include <dialog_plot.h>
#include <build_version.h>
#include <gbr_metadata.h>
#include <render_settings.h>

Go to the source code of this file.

Functions

const wxString GetGerberProtelExtension (int aLayer)
 
const wxString GetGerberFileFunctionAttribute (const BOARD *aBoard, int aLayer)
 Return the "file function" attribute for aLayer, as defined in the Gerber file format specification J1 (chapter 5).
 
static const wxString GetGerberFilePolarityAttribute (int aLayer)
 
static wxString & makeStringCompatX1 (wxString &aText, bool aUseX1CompatibilityMode)
 
void AddGerberX2Header (PLOTTER *aPlotter, const BOARD *aBoard, bool aUseX1CompatibilityMode)
 Calculate some X2 attributes as defined in the Gerber file format specification J4 (chapter 5) and add them the to the gerber file header.
 
void AddGerberX2Attribute (PLOTTER *aPlotter, const BOARD *aBoard, int aLayer, bool aUseX1CompatibilityMode)
 Calculate some X2 attributes as defined in the Gerber file format specification and add them to the gerber file header.
 
void BuildPlotFileName (wxFileName *aFilename, const wxString &aOutputDir, const wxString &aSuffix, const wxString &aExtension)
 Complete a plot filename.
 

Function Documentation

◆ AddGerberX2Attribute()

void AddGerberX2Attribute ( PLOTTER aPlotter,
const BOARD aBoard,
int  aLayer,
bool  aUseX1CompatibilityMode 
)

Calculate some X2 attributes as defined in the Gerber file format specification and add them to the gerber file header.

TF.GenerationSoftware TF.CreationDate TF.ProjectId TF.FileFunction TF.FilePolarity

Parameters
aPlotteris the current plotter.
aBoardis the board, needed to extract some info.
aLayeris the layer number to create the attribute for.
aUseX1CompatibilityModeset to false to generate X2 attributes, true to use X1 compatibility (X2 attributes added as structured comments, starting by "G04 #@! " followed by the X2 attribute.

Definition at line 342 of file pcbplot.cpp.

References AddGerberX2Header(), PLOTTER::AddLineToHeader(), GetGerberFileFunctionAttribute(), GetGerberFilePolarityAttribute(), makeStringCompatX1(), and text.

Referenced by StartPlotBoard().

◆ AddGerberX2Header()

void AddGerberX2Header ( PLOTTER aPlotter,
const BOARD aBoard,
bool  aUseX1CompatibilityMode = false 
)

Calculate some X2 attributes as defined in the Gerber file format specification J4 (chapter 5) and add them the to the gerber file header.

TF.GenerationSoftware TF.CreationDate TF.ProjectId file format attribute is not added

Parameters
aPlotteris the current plotter.
aBoardis the board, needed to extract some info.
aUseX1CompatibilityModeset to false to generate X2 attributes, true to use X1 compatibility (X2 attributes added as structured comments, starting by "G04 #@! " followed by the X2 attribute

Definition at line 276 of file pcbplot.cpp.

References PLOTTER::AddLineToHeader(), ExpandTextVars(), GBR_NC_STRING_FORMAT_X1, GBR_NC_STRING_FORMAT_X2, GbrMakeCreationDateAttributeString(), GbrMakeProjectGUIDfromString(), BOARD_DESIGN_SETTINGS::GetAuxOrigin(), GetBuildVersion(), BOARD::GetDesignSettings(), BOARD::GetFileName(), BOARD::GetPlotOptions(), BOARD::GetProject(), TITLE_BLOCK::GetRevision(), BOARD::GetTitleBlock(), PCB_PLOT_PARAMS::GetUseAuxOrigin(), makeStringCompatX1(), text, VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by AddGerberX2Attribute(), GERBER_WRITER::createDrillFile(), PLACEFILE_GERBER_WRITER::CreatePlaceFile(), and GENDRILL_WRITER_BASE::genDrillMapFile().

◆ BuildPlotFileName()

void BuildPlotFileName ( wxFileName *  aFilename,
const wxString &  aOutputDir,
const wxString &  aSuffix,
const wxString &  aExtension 
)

Complete a plot filename.

It forces the output directory, adds a suffix to the name, and sets the specified extension. The suffix is usually the layer name and replaces illegal file name character in the suffix with an underscore character.

Parameters
aFilenameis the file name to initialize that contains the base filename.
aOutputDiris the path.
aSuffixis the suffix to add to the base filename.
aExtensionis the file extension.

Definition at line 361 of file pcbplot.cpp.

Referenced by DIALOG_EXPORT_SVG::ExportSVGFile(), PCBNEW_JOBS_HANDLER::JobExportGerbers(), PLOT_CONTROLLER::OpenPlotfile(), and DIALOG_PLOT::Plot().

◆ GetGerberFileFunctionAttribute()

const wxString GetGerberFileFunctionAttribute ( const BOARD aBoard,
int  aLayer 
)

Return the "file function" attribute for aLayer, as defined in the Gerber file format specification J1 (chapter 5).

The returned string includes the "%TF.FileFunction" attribute prefix and the "*%" suffix.

Parameters
aBoardis the board, needed to get the total count of copper layers.
aLayeris the layer number to create the attribute for.
Returns
The attribute, as a text string

Definition at line 81 of file pcbplot.cpp.

References B_Adhes, B_Cu, B_Fab, B_Mask, B_Paste, B_SilkS, Cmts_User, Dwgs_User, Eco1_User, Eco2_User, Edge_Cuts, F_Adhes, F_Cu, F_Fab, F_Mask, F_Paste, F_SilkS, BOARD::GetCopperLayerCount(), BOARD::GetLayerType(), IsCopperLayer(), LT_MIXED, LT_POWER, LT_SIGNAL, and ToLAYER_ID().

Referenced by AddGerberX2Attribute().

◆ GetGerberFilePolarityAttribute()

static const wxString GetGerberFilePolarityAttribute ( int  aLayer)
static

Definition at line 203 of file pcbplot.cpp.

References B_Adhes, B_Mask, B_Paste, B_SilkS, F_Adhes, F_Mask, F_Paste, F_SilkS, and IsCopperLayer().

Referenced by AddGerberX2Attribute().

◆ GetGerberProtelExtension()

const wxString GetGerberProtelExtension ( int  aLayer)
Returns
the appropriate Gerber file extension for aLayer

Definition at line 42 of file pcbplot.cpp.

References B_Adhes, B_Cu, B_Mask, B_Paste, B_SilkS, Cmts_User, Dwgs_User, Eco1_User, Eco2_User, Edge_Cuts, F_Adhes, F_Cu, F_Mask, F_Paste, F_SilkS, and IsCopperLayer().

Referenced by PCBNEW_JOBS_HANDLER::JobExportGerbers(), PLOT_CONTROLLER::OpenPlotfile(), and DIALOG_PLOT::Plot().

◆ makeStringCompatX1()

static wxString & makeStringCompatX1 ( wxString &  aText,
bool  aUseX1CompatibilityMode 
)
static

Definition at line 264 of file pcbplot.cpp.

Referenced by AddGerberX2Attribute(), and AddGerberX2Header().