51 else if( aLayer ==
B_Cu )
62 case B_Adhes:
return wxT(
"gba" );
63 case F_Adhes:
return wxT(
"gta" );
65 case B_Paste:
return wxT(
"gbp" );
66 case F_Paste:
return wxT(
"gtp" );
68 case B_SilkS:
return wxT(
"gbo" );
69 case F_SilkS:
return wxT(
"gto" );
71 case B_Mask:
return wxT(
"gbs" );
72 case F_Mask:
return wxT(
"gts" );
80 default:
return wxT(
"gbr" );
101 attrib =
"Legend,Top";
105 attrib =
"Legend,Bot";
109 attrib =
"Soldermask,Top";
113 attrib =
"Soldermask,Bot";
117 attrib =
"Paste,Top";
121 attrib =
"Paste,Bot";
128 attrib =
"Profile,NP";
132 attrib =
"OtherDrawing,Comment";
136 attrib =
"Other,Comment";
140 attrib =
"Other,ECO1";
144 attrib =
"Other,ECO2";
149 attrib =
"AssemblyDrawing,Bot";
154 attrib =
"AssemblyDrawing,Top";
162 attrib =
"Copper,L1,Top";
167 attrib.Printf( wxT(
"Copper,L%d,Inr" ), aLayer+1 );
169 attrib.Printf( wxT(
"Other,User" ), aLayer+1 );
202 fileFct.Printf(
"%%TF.FileFunction,%s*%%", attrib );
252 wxString filePolarity;
255 filePolarity =
"%TF.FilePolarity,Positive*%";
257 filePolarity =
"%TF.FilePolarity,Negative*%";
269 if( aUseX1CompatibilityMode )
271 aText.Replace(
"%",
"" );
272 aText.Prepend(
"G04 #@! " );
285 text.Printf( wxT(
"%%TF.GenerationSoftware,KiCad,Pcbnew,%s*%%" ),
GetBuildVersion() );
304 wxString msg = fn.GetFullName();
312 msg.Replace( wxT(
"," ), wxT(
"_" ) );
316 rev.Replace( wxT(
"," ), wxT(
"_" ) );
321 text.Printf( wxT(
"%%TF.ProjectId,%s,%s,%s*%%" ), msg.ToAscii(), guid, rev.ToAscii() );
339 wxString registration_id =
"Original";
343 registration_id.Printf(
"PX%xPY%x", auxOrigin.x, auxOrigin.y );
345 text.Printf(
"%%TF.SameCoordinates,%s*%%", registration_id.GetData() );
351 const BOARD *aBoard,
LAYER_NUM aLayer,
bool aUseX1CompatibilityMode )
364 if( !text.IsEmpty() )
370 const wxString& aSuffix,
const wxString& aExtension )
375 aFilename->SetPath( aOutputDir );
378 aFilename->SetExt( aExtension );
386 wxString suffix = aSuffix;
388 suffix.Trim(
false );
390 wxString badchars = wxFileName::GetForbiddenChars(wxPATH_DOS);
391 badchars.Append(
"%." );
393 for(
unsigned ii = 0; ii < badchars.Len(); ii++ )
394 suffix.Replace( badchars[ii], wxT(
"_") );
396 if( !suffix.IsEmpty() )
397 aFilename->SetName( aFilename->GetName() + wxT(
"-" ) + suffix );
436 const wxString& aSuffix,
PLOT_FORMAT aFormat,
const wxString& aSheetDesc )
451 wxFileName outputDir = wxFileName::DirName( outputDirName );
PCB_PLOT_PARAMS & GetPlotOptions()
Accessor to the plot parameters and options.
~PLOT_CONTROLLER()
Batch plotter destructor, ensures that the last plot is closed.
Plot settings, and plotting engines (PostScript, Gerber, HPGL and DXF)
const PCB_PLOT_PARAMS & GetPlotOptions() const
void ClosePlot()
Close the current plot, nothing happens if it isn't open.
bool OpenPlotfile(const wxString &aSuffix, PLOT_FORMAT aFormat, const wxString &aSheetDesc)
Open a new plotfile; works as a factory for plotter objects.
Instantiate the current locale within a scope in which you are expecting exceptions to be thrown.
PLOTTER * m_plotter
This is the plotter object; it starts NULL and become instantiated when a plotfile is requested.
wxString GetDefaultPlotExtension(PLOT_FORMAT aFormat)
Returns the default plot extension for a format.
wxString ExpandTextVars(const wxString &aSource, const PROJECT *aProject)
Implementation of conversion functions that require both schematic and board internal units.
void PlotOneBoardLayer(BOARD *aBoard, PLOTTER *aPlotter, PCB_LAYER_ID aLayer, const PCB_PLOT_PARAMS &aPlotOpt)
Function PlotOneBoardLayer main function to plot one copper or technical layer.
virtual void SetColorMode(bool aColorMode)
Plot in B/W or color.
PROJECT * GetProject() const
const wxString GetGerberProtelExtension(LAYER_NUM aLayer)
Function GetGerberProtelExtension.
void AddGerberX2Header(PLOTTER *aPlotter, const BOARD *aBoard, bool aUseX1CompatibilityMode)
Calculates some X2 attributes, as defined in the Gerber file format specification J4 (chapter 5) and ...
wxFileName m_plotFile
The current plot filename, set by OpenPlotfile.
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
void AddGerberX2Attribute(PLOTTER *aPlotter, const BOARD *aBoard, LAYER_NUM aLayer, bool aUseX1CompatibilityMode)
Calculates some X2 attributes, as defined in the Gerber file format specification and add them to the...
void AddLineToHeader(const wxString &aExtraString)
Add a line to the list of free lines to print at the beginning of the file.
const wxString & GetFileName() const
BOARD * m_board
The board we're plotting.
PLOT_CONTROLLER(BOARD *aBoard)
Batch plotter constructor, nothing interesting here.
Board plot function definition file.
wxString GetBuildVersion()
Get the full KiCad version string.
const wxString & GetRevision() const
PLOT_FORMAT
The set of supported output plot formats.
bool EnsureFileDirectoryExists(wxFileName *aTargetFullFileName, const wxString &aBaseFilename, REPORTER *aReporter)
Make aTargetFullFileName absolute and create the path of this file if it doesn't yet exist.
void SetFormat(PLOT_FORMAT aFormat)
int LAYER_NUM
This can be replaced with int and removed.
wxString GetOutputDirectory() const
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
void BuildPlotFileName(wxFileName *aFilename, const wxString &aOutputDir, const wxString &aSuffix, const wxString &aExtension)
Function BuildPlotFileName (helper function) Complete a plot filename: forces the output directory,...
LAYER_T GetLayerType(PCB_LAYER_ID aLayer) const
Return the type of the copper layer given by aLayer.
static const wxString GetGerberFilePolarityAttribute(LAYER_NUM aLayer)
Base plotter engine class.
void SetColorMode(bool)
Plotters can plot in Black and White mode or Color mode SetColorMode activate/de-actiavte the Color m...
RENDER_SETTINGS * RenderSettings()
TITLE_BLOCK & GetTitleBlock()
static wxString & makeStringCompatX1(wxString &aText, bool aUseX1CompatibilityMode)
Information pertinent to a Pcbnew printed circuit board.
int GetCopperLayerCount() const
const wxString GetGerberFileFunctionAttribute(const BOARD *aBoard, LAYER_NUM aLayer)
Function GetGerberFileFunctionAttribute Returns the "file function" attribute for aLayer,...
bool IsCopperLayer(LAYER_NUM aLayerId)
Tests whether a layer is a copper layer.
PLOTTER * StartPlotBoard(BOARD *aBoard, PCB_PLOT_PARAMS *aPlotOpts, int aLayer, const wxString &aFullFileName, const wxString &aSheetDesc)
Open a new plotfile using the options (and especially the format) specified in the options and prepar...
bool GetUseAuxOrigin() const
bool PlotLayer()
Plot a single layer on the current plotfile m_plotLayer is the layer to plot.
LAYER_T
The allowed types of layers, same as Specctra DSN spec.
PCB_LAYER_ID ToLAYER_ID(int aLayer)
wxPoint m_AuxOrigin
origin for plot exports
LAYER_NUM m_plotLayer
the layer to plot
bool GetColorMode() const