![]() |
KiCad PCB EDA Suite
|
Board plot function definition file. More...
#include <layer_ids.h>
#include <pad_shapes.h>
#include <pcb_plot_params.h>
#include <settings/color_settings.h>
#include <settings/settings_manager.h>
Go to the source code of this file.
Classes | |
class | BRDITEMS_PLOTTER |
Macros | |
#define | PLOT_MIN_SCALE 0.01 |
#define | PLOT_MAX_SCALE 100.0 |
Functions | |
PLOTTER * | StartPlotBoard (BOARD *aBoard, const 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 prepare the page for plotting. More... | |
void | PlotOneBoardLayer (BOARD *aBoard, PLOTTER *aPlotter, PCB_LAYER_ID aLayer, const PCB_PLOT_PARAMS &aPlotOpt) |
Plot one copper or technical layer. More... | |
void | PlotStandardLayer (BOARD *aBoard, PLOTTER *aPlotter, LSET aLayerMask, const PCB_PLOT_PARAMS &aPlotOpt) |
Plot copper or technical layers. More... | |
void | PlotLayerOutlines (BOARD *aBoard, PLOTTER *aPlotter, LSET aLayerMask, const PCB_PLOT_PARAMS &aPlotOpt) |
Plot copper outline of a copper layer. More... | |
void | BuildPlotFileName (wxFileName *aFilename, const wxString &aOutputDir, const wxString &aSuffix, const wxString &aExtension) |
Complete a plot filename. More... | |
const wxString | GetGerberProtelExtension (LAYER_NUM aLayer) |
const wxString | GetGerberFileFunctionAttribute (const BOARD *aBoard, LAYER_NUM aLayer) |
Return the "file function" attribute for aLayer, as defined in the Gerber file format specification J1 (chapter 5). More... | |
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. More... | |
void | AddGerberX2Attribute (PLOTTER *aPlotter, const BOARD *aBoard, LAYER_NUM aLayer, bool aUseX1CompatibilityMode) |
Calculate some X2 attributes as defined in the Gerber file format specification and add them to the gerber file header. More... | |
Board plot function definition file.
Definition in file pcbplot.h.
void AddGerberX2Attribute | ( | PLOTTER * | aPlotter, |
const BOARD * | aBoard, | ||
LAYER_NUM | 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
aPlotter | is the current plotter. |
aBoard | is the board, needed to extract some info. |
aLayer | is the layer number to create the attribute for. |
aUseX1CompatibilityMode | set 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 353 of file pcbplot.cpp.
References AddGerberX2Header(), PLOTTER::AddLineToHeader(), GetGerberFileFunctionAttribute(), GetGerberFilePolarityAttribute(), makeStringCompatX1(), and text.
Referenced by StartPlotBoard().
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
aPlotter | is the current plotter. |
aBoard | is the board, needed to extract some info. |
aUseX1CompatibilityMode | set 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 282 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(), and text.
Referenced by AddGerberX2Attribute(), GERBER_WRITER::createDrillFile(), and PLACEFILE_GERBER_WRITER::CreatePlaceFile().
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.
aFilename | is the file name to initialize that contains the base filename. |
aOutputDir | is the path. |
aSuffix | is the suffix to add to the base filename. |
aExtension | is the file extension. |
Definition at line 372 of file pcbplot.cpp.
Referenced by DIALOG_EXPORT_SVG::ExportSVGFile(), PLOT_CONTROLLER::OpenPlotfile(), and DIALOG_PLOT::Plot().
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.
aBoard | is the board, needed to get the total count of copper layers. |
aLayer | is the layer number to create the attribute for. |
Definition at line 87 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().
const wxString GetGerberProtelExtension | ( | LAYER_NUM | aLayer | ) |
Definition at line 46 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, Format(), and IsCopperLayer().
Referenced by PLOT_CONTROLLER::OpenPlotfile(), and DIALOG_PLOT::Plot().
void PlotLayerOutlines | ( | BOARD * | aBoard, |
PLOTTER * | aPlotter, | ||
LSET | aLayerMask, | ||
const PCB_PLOT_PARAMS & | aPlotOpt | ||
) |
Plot copper outline of a copper layer.
aBoard | is the board to plot. |
aPlotter | is the plotter to use. |
aLayerMask | is the mask to define the layers to plot. |
aPlotOpt | is the plot options. Has meaning for some formats only. |
Plot copper outline of a copper layer.
Definition at line 714 of file plot_board_layers.cpp.
References SEG::A, arrayDim(), SEG::B, SHAPE_POLY_SET::CHole(), PLOTTER::Circle(), BOARD::ConvertBrdLayerToPolygonalContours(), SHAPE_POLY_SET::COutline(), BOARD::Footprints(), ADVANCED_CFG::GetCfg(), PCB_PLOT_PARAMS::GetDrillMarksType(), SHAPE_SEGMENT::GetSeg(), SHAPE_SEGMENT::GetWidth(), SHAPE_POLY_SET::HoleCount(), ADVANCED_CFG::m_SmallDrillMarkSize, PCB_PLOT_PARAMS::NO_DRILL_SHAPE, NO_FILL, SHAPE_POLY_SET::OutlineCount(), pad, path, plot_seq, PLOTTER::PlotPoly(), SHAPE_POLY_SET::PM_FAST, SHAPE_POLY_SET::RemoveAllContours(), LSET::Seq(), BRDITEMS_PLOTTER::SetLayerSet(), SHAPE_POLY_SET::Simplify(), SKETCH, PCB_PLOT_PARAMS::SMALL_DRILL_SHAPE, PLOTTER::ThickSegment(), BOARD::Tracks(), and via.
Referenced by PlotOneBoardLayer().
void PlotOneBoardLayer | ( | BOARD * | aBoard, |
PLOTTER * | aPlotter, | ||
PCB_LAYER_ID | aLayer, | ||
const PCB_PLOT_PARAMS & | aPlotOpt | ||
) |
Plot one copper or technical layer.
It prepares options and calls the specialized plot function according to the layer type.
aBoard | is the board to plot. |
aPlotter | is the plotter to use. |
aLayer | is the layer id to plot. |
aPlotOpt | is the plot options (files, sketch). Has meaning for some formats only. |
Definition at line 68 of file plot_board_layers.cpp.
References B_Adhes, B_CrtYd, B_Fab, B_Mask, B_Paste, B_SilkS, BLACK, Cmts_User, Dwgs_User, DXF, Eco1_User, Eco2_User, Edge_Cuts, F_Adhes, F_CrtYd, F_Fab, F_Mask, F_Paste, F_SilkS, GERBER, BOARD::GetDesignSettings(), PCB_PLOT_PARAMS::GetDXFPlotPolygonMode(), PCB_PLOT_PARAMS::GetExcludeEdgeLayer(), PCB_PLOT_PARAMS::GetFormat(), PLOTTER::GetPlotterType(), PCB_PLOT_PARAMS::GetSubtractMaskFromSilk(), PCB_PLOT_PARAMS::GetTextMode(), IsCopperLayer(), BOARD_DESIGN_SETTINGS::m_SolderMaskMinWidth, Margin, PCB_PLOT_PARAMS::NO_DRILL_SHAPE, PlotLayerOutlines(), PlotSolderMaskLayer(), PlotStandardLayer(), PLOTTER::SetColor(), PCB_PLOT_PARAMS::SetDrillMarksType(), PLOTTER::SetLayerPolarity(), PCB_PLOT_PARAMS::SetSkipPlotNPTH_Pads(), and PLOTTER::SetTextMode().
Referenced by DIALOG_EXPORT_SVG::CreateSVGFile(), DIALOG_PLOT::Plot(), and PLOT_CONTROLLER::PlotLayer().
void PlotStandardLayer | ( | BOARD * | aBoard, |
PLOTTER * | aPlotter, | ||
LSET | aLayerMask, | ||
const PCB_PLOT_PARAMS & | aPlotOpt | ||
) |
Plot copper or technical layers.
This is not used for silk screen layers because these layers have specific requirements. This is mainly for pads.
aBoard | is the board to plot. |
aPlotter | is the plotter to use. |
aLayerMask | is the mask to define the layers to plot. |
aPlotOpt | is the plot options (files, sketch). Has meaning for some formats only. |
aPlotOpt has 3 important options to control this plot, which are set, depending on the layer type to plot SetEnablePlotVia( bool aEnable ) aEnable = true to plot vias, false to skip vias (has meaning only for solder mask layers). SetSkipPlotNPTH_Pads( bool aSkip ) aSkip = true to skip NPTH Pads, when the pad size and the pad hole have the same size. Used in GERBER format only. SetDrillMarksType( DrillMarksType aVal ) control the actual hole: no hole, small hole, actual hole
Plot copper or technical layers.
Silk screen layers are not plotted here.
pads not connected to copper are optionally not drawn
Vias not connected to copper are optionally not drawn
Definition at line 218 of file plot_board_layers.cpp.
References SHAPE_POLY_SET::AddOutline(), LSET::AllCuMask(), SHAPE_POLY_SET::Append(), B_Cu, B_Fab, B_Mask, B_Paste, BLACK, CHAMFERED_RECT, CIRCLE, color, PCB_PLOT_PARAMS::ColorSettings(), SHAPE_POLY_SET::CPolygon(), CUSTOM, SHAPE_POLY_SET::DeletePolygon(), dummy(), PLOTTER::EndBlock(), ERROR_INSIDE, F_Cu, F_Fab, F_Mask, F_Paste, PLOTTER::FlashPadCircle(), BOARD::Footprints(), GBR_APERTURE_METADATA::GBR_APERTURE_ATTRIB_CONDUCTOR, GBR_APERTURE_METADATA::GBR_APERTURE_ATTRIB_VIAPAD, GBR_NETLIST_METADATA::GBR_NETINFO_NET, PCB_ARC::GetAngle(), PCB_ARC::GetArcAngleStart(), GetArcToSegmentCount(), PCB_ARC::GetCenter(), COLOR_SETTINGS::GetColor(), BRDITEMS_PLOTTER::getColor(), BOARD::GetDesignSettings(), PCB_PLOT_PARAMS::GetDrillMarksType(), BRDITEMS_PLOTTER::getFineWidthAdj(), PCB_PLOT_PARAMS::GetPlotMode(), PCB_PLOT_PARAMS::GetPlotViaOnMaskLayer(), PCB_ARC::GetRadius(), PCB_PLOT_PARAMS::GetSketchPadsOnFabLayers(), PCB_PLOT_PARAMS::GetSkipPlotNPTH_Pads(), SHAPE_POLY_SET::InflateWithLinkedHoles(), SHAPE_POLY_SET::IsEmpty(), LAYER_VIAS, LIGHTGRAY, BOARD_DESIGN_SETTINGS::m_MaxError, GBR_METADATA::m_NetlistMetadata, GBR_NETLIST_METADATA::m_NotInNet, BOARD_DESIGN_SETTINGS::m_SolderMaskMargin, SHAPE_POLY_SET::NewOutline(), PCB_PLOT_PARAMS::NO_DRILL_SHAPE, NPTH, SHAPE_POLY_SET::OutlineCount(), OVAL, pad, PCB_ARC_T, PCB_VIA_T, BRDITEMS_PLOTTER::PlotBoardGraphicItems(), BRDITEMS_PLOTTER::PlotDrillMarks(), BRDITEMS_PLOTTER::PlotFilledAreas(), BRDITEMS_PLOTTER::PlotFootprintGraphicItems(), BRDITEMS_PLOTTER::PlotFootprintTextItems(), BRDITEMS_PLOTTER::PlotPad(), SHAPE_POLY_SET::PM_FAST, RECT, ROUNDRECT, GBR_METADATA::SetApertureAttrib(), PLOTTER::SetColor(), BRDITEMS_PLOTTER::SetLayerSet(), GBR_METADATA::SetNetAttribType(), GBR_METADATA::SetNetName(), EDA_ITEM::SetPosition(), SKETCH, PLOTTER::StartBlock(), PLOTTER::ThickArc(), PLOTTER::ThickSegment(), BOARD::Tracks(), TRAPEZOID, UNDEFINED_LAYER, via, WHITE, and BOARD::Zones().
Referenced by PlotOneBoardLayer(), and PlotSolderMaskLayer().
PLOTTER* StartPlotBoard | ( | BOARD * | aBoard, |
const 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 prepare the page for plotting.
Definition at line 1137 of file plot_board_layers.cpp.
References AddGerberX2Attribute(), PLOTTER::ClearHeaderLinesList(), PCB_PLOT_PARAMS::ColorSettings(), BOARD::ComputeBoundingBox(), ConfigureHPGLPenSizes(), GERBER_PLOTTER::DisableApertMacros(), DXF, FillNegativeKnockout(), GERBER, PCB_PLOT_PARAMS::GetDisableGerberMacros(), PCB_PLOT_PARAMS::GetDXFPlotUnits(), BOARD::GetFileName(), PCB_PLOT_PARAMS::GetFineScaleAdjustX(), PCB_PLOT_PARAMS::GetFineScaleAdjustY(), PCB_PLOT_PARAMS::GetFormat(), PCB_PLOT_PARAMS::GetIncludeGerberNetlistInfo(), PCB_PLOT_PARAMS::GetMirror(), PCB_PLOT_PARAMS::GetNegative(), BOARD::GetPageSettings(), PCB_PLOT_PARAMS::GetPlotFrameRef(), PLOTTER::GetPlotterType(), BOARD::GetProject(), BOARD::GetTitleBlock(), PCB_PLOT_PARAMS::GetUseGerberX2format(), HPGL, initializePlotter(), KIGFX::PCB_RENDER_SETTINGS::LoadColors(), Millimeter2iu(), PLOTTER::OpenFile(), PDF, PlotDrawingSheet(), POST, PLOTTER::RenderSettings(), KIGFX::RENDER_SETTINGS::SetDefaultPenWidth(), PCB_PLOT_PARAMS::SetMirror(), PLOTTER::SetRenderSettings(), PSLIKE_PLOTTER::SetScaleAdjust(), DXF_PLOTTER::SetUnits(), PLOTTER::StartPlot(), SVG, GERBER_PLOTTER::UseX2format(), and GERBER_PLOTTER::UseX2NetAttributes().
Referenced by DIALOG_EXPORT_SVG::CreateSVGFile(), PLOT_CONTROLLER::OpenPlotfile(), and DIALOG_PLOT::Plot().