50 else if( aLayer ==
B_Cu )
59 case B_Adhes:
return wxT(
"gba" );
60 case F_Adhes:
return wxT(
"gta" );
62 case B_Paste:
return wxT(
"gbp" );
63 case F_Paste:
return wxT(
"gtp" );
65 case B_SilkS:
return wxT(
"gbo" );
66 case F_SilkS:
return wxT(
"gto" );
68 case B_Mask:
return wxT(
"gbs" );
69 case F_Mask:
return wxT(
"gts" );
77 default:
return wxT(
"gbr" );
91 attrib = wxT(
"Glue,Top" );
95 attrib = wxT(
"Glue,Bot" );
99 attrib = wxT(
"Legend,Top" );
103 attrib = wxT(
"Legend,Bot" );
107 attrib = wxT(
"Soldermask,Top" );
111 attrib = wxT(
"Soldermask,Bot" );
115 attrib = wxT(
"Paste,Top" );
119 attrib = wxT(
"Paste,Bot" );
126 attrib = wxT(
"Profile,NP" );
130 attrib = wxT(
"OtherDrawing,Comment" );
134 attrib = wxT(
"Other,Comment" );
138 attrib = wxT(
"Other,ECO1" );
142 attrib = wxT(
"Other,ECO2" );
147 attrib = wxT(
"AssemblyDrawing,Bot" );
152 attrib = wxT(
"AssemblyDrawing,Top" );
160 attrib = wxT(
"Copper,L1,Top" );
168 int ly_id = ( ( aLayer -
B_Cu ) / 2 ) + 1;
169 attrib.Printf( wxT(
"Copper,L%d,Inr" ), ly_id );
172 attrib.Printf( wxT(
"Other,User" ), aLayer+1 );
190 attrib += wxT(
",Signal" );
193 attrib += wxT(
",Plane" );
196 attrib += wxT(
",Mixed" );
205 fileFct.Printf( wxT(
"%%TF.FileFunction,%s*%%" ), attrib );
255 wxString filePolarity;
258 filePolarity = wxT(
"%TF.FilePolarity,Positive*%" );
260 filePolarity = wxT(
"%TF.FilePolarity,Negative*%" );
274 if( aUseX1CompatibilityMode )
276 aText.Replace( wxT(
"%" ), wxEmptyString );
277 aText.Prepend( wxT(
"G04 #@! " ) );
289 aMsg.Replace( wxT(
"," ), wxT(
"_" ) );
290 aMsg.Replace( wxT(
"*" ), wxT(
"\\u002A" ) );
291 aMsg.Replace( wxT(
"%" ), wxT(
"\\u0025" ) );
319 wxString msg = fn.GetFullName();
336 text.Printf( wxT(
"%%TF.ProjectId,%s,%s,%s*%%" ), msg.ToAscii(), guid, rev.ToAscii() );
350 wxString registration_id = wxT(
"Original" );
354 registration_id.Printf( wxT(
"PX%xPY%x" ), auxOrigin.
x, auxOrigin.
y );
356 text.Printf( wxT(
"%%TF.SameCoordinates,%s*%%" ), registration_id.GetData() );
362 bool aUseX1CompatibilityMode )
375 if( !
text.IsEmpty() )
381 const wxString& aSuffix,
const wxString& aExtension )
421 const wxString& aSheetName,
const wxString& aSheetPath )
433 std::function<bool( wxString* )> textResolver =
434 [&]( wxString* token ) ->
bool
437 return m_board->ResolveTextVar( token, 0 );
444 wxFileName outputDir = wxFileName::DirName( outputDirName );
445 wxString boardFilename =
m_board->GetFileName();
447 wxString layerName =
m_board->GetLayerName( layer );
468 m_plotFile.GetFullPath(), aSheetName, aSheetPath );
LAYER_T
The allowed types of layers, same as Specctra DSN spec.
wxString GetBuildVersion()
Get the full KiCad version string.
const VECTOR2I & GetAuxOrigin() const
Information pertinent to a Pcbnew printed circuit board.
LAYER_T GetLayerType(PCB_LAYER_ID aLayer) const
Return the type of the copper layer given by aLayer.
TITLE_BLOCK & GetTitleBlock()
int GetCopperLayerCount() const
const wxString & GetFileName() const
const PCB_PLOT_PARAMS & GetPlotOptions() const
PROJECT * GetProject() const
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
LSEQ is a sequence (and therefore also a set) of PCB_LAYER_IDs.
static void BuildPlotFileName(wxFileName *aFilename, const wxString &aOutputDir, const wxString &aSuffix, const wxString &aExtension)
Complete a plot filename.
bool GetUseAuxOrigin() const
wxString GetOutputDirectory() const
void SetFormat(PLOT_FORMAT aFormat)
Base plotter engine class.
void AddLineToHeader(const wxString &aExtraString)
Add a line to the list of free lines to print at the beginning of the file.
~PLOT_CONTROLLER()
Ensure that the last plot is closed.
bool PlotLayer()
Plot a single layer on the current plotfile m_plotLayer is the layer to plot.
PLOT_CONTROLLER(BOARD *aBoard)
Batch plotter constructor, nothing interesting here.
void SetColorMode(bool aColorMode)
Choose color or bland and white plot mode.
bool OpenPlotfile(const wxString &aSuffix, PLOT_FORMAT aFormat, const wxString &aSheetName=wxEmptyString, const wxString &aSheetPath=wxEmptyString)
Open a new plotfile; works as a factory for plotter objects/.
bool PlotLayers(const LSEQ &aLayerSequence)
Plot a sequence of board layer IDs in the given order.
PLOTTER * m_plotter
This is the plotter object; it starts NULL and become instantiated when a plotfile is.
PCB_PLOT_PARAMS & GetPlotOptions()
Accessor to the plot parameters and options.
void ClosePlot()
Close the current plot, nothing happens if it isn't open.
const wxString & GetRevision() const
const wxString ExpandEnvVarSubstitutions(const wxString &aString, const PROJECT *aProject)
Replace any environment variable & text variable references with their values.
wxString ExpandTextVars(const wxString &aSource, const PROJECT *aProject, int aFlags)
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.
wxString GetDefaultPlotExtension(PLOT_FORMAT aFormat)
Return the default plot extension for a format.
bool IsCopperLayer(int aLayerId)
Test whether a layer is a copper layer.
size_t CopperLayerToOrdinal(PCB_LAYER_ID aLayer)
Converts KiCad copper layer enum to an ordinal between the front and back layers.
PCB_LAYER_ID
A quick note on layer IDs:
PCB_LAYER_ID ToLAYER_ID(int aLayer)
const wxString GetGerberProtelExtension(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 ad...
const wxString GetGerberFileFunctionAttribute(const BOARD *aBoard, int aLayer)
Return the "file function" attribute for aLayer, as defined in the Gerber file format specification J...
static void replaceReservedCharsField(wxString &aMsg)
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 g...
void BuildPlotFileName(wxFileName *aFilename, const wxString &aOutputDir, const wxString &aSuffix, const wxString &aExtension)
Complete a plot filename.
static const wxString GetGerberFilePolarityAttribute(int aLayer)
PLOTTER * StartPlotBoard(BOARD *aBoard, const PCB_PLOT_PARAMS *aPlotOpts, int aLayer, const wxString &aLayerName, const wxString &aFullFileName, const wxString &aSheetName, const wxString &aSheetPath, const wxString &aPageName=wxT("1"), const wxString &aPageNumber=wxEmptyString, const int aPageCount=1)
Open a new plotfile using the options (and especially the format) specified in the options and prepar...
void PlotBoardLayers(BOARD *aBoard, PLOTTER *aPlotter, const LSEQ &aLayerSequence, const PCB_PLOT_PARAMS &aPlotOptions)
Plot a sequence of board layer IDs.
void PlotInteractiveLayer(BOARD *aBoard, PLOTTER *aPlotter, const PCB_PLOT_PARAMS &aPlotOpt)
Plot interactive items (hypertext links, properties, etc.).
void PlotOneBoardLayer(BOARD *aBoard, PLOTTER *aPlotter, PCB_LAYER_ID aLayer, const PCB_PLOT_PARAMS &aPlotOpt, bool isPrimaryLayer)
Plot one copper or technical layer.
PLOT_FORMAT
The set of supported output plot formats.
VECTOR2< int32_t > VECTOR2I