![]() |
KiCad PCB EDA Suite
|
Board plot function definition file. More...
#include <layers_id_colors_and_visibility.h>
#include <math/util.h>
#include <pad_shapes.h>
#include <pcb_plot_params.h>
#include <pgm_base.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) |
Function PlotOneBoardLayer main function to plot one copper or technical layer. More... | |
void | PlotStandardLayer (BOARD *aBoard, PLOTTER *aPlotter, LSET aLayerMask, const PCB_PLOT_PARAMS &aPlotOpt) |
Function PlotStandardLayer plot copper or technical layers. More... | |
void | PlotLayerOutlines (BOARD *aBoard, PLOTTER *aPlotter, LSET aLayerMask, const PCB_PLOT_PARAMS &aPlotOpt) |
Function PlotLayerOutlines plot copper outline of a copper layer. More... | |
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, add a suffix to the name and sets the specified extension the suffix is usually the layer name replaces not allowed chars in suffix by '_'. More... | |
const wxString | GetGerberProtelExtension (LAYER_NUM aLayer) |
Function GetGerberProtelExtension. More... | |
const wxString | GetGerberFileFunctionAttribute (const BOARD *aBoard, LAYER_NUM aLayer) |
Function GetGerberFileFunctionAttribute Returns 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) |
Calculates 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. More... | |
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 gerber file header: TF.GenerationSoftware TF.CreationDate TF.ProjectId TF.FileFunction TF.FilePolarity. More... | |
Board plot function definition file.
Definition in file pcbplot.h.
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 gerber file header: TF.GenerationSoftware TF.CreationDate TF.ProjectId TF.FileFunction TF.FilePolarity.
aPlotter | = the current plotter. |
aBoard | = the board, needed to extract some info |
aLayer | = the layer number to create the attribute for |
aUseX1CompatibilityMode | = 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 350 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 |
||
) |
Calculates 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 | = the current plotter. |
aBoard | = the board, needed to extract some info |
aUseX1CompatibilityMode | = 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 279 of file pcbplot.cpp.
References PLOTTER::AddLineToHeader(), ExpandTextVars(), GBR_NC_STRING_FORMAT_X1, GBR_NC_STRING_FORMAT_X2, GbrMakeCreationDateAttributeString(), GbrMakeProjectGUIDfromString(), GetBuildVersion(), BOARD::GetDesignSettings(), BOARD::GetFileName(), BOARD::GetPlotOptions(), BOARD::GetProject(), TITLE_BLOCK::GetRevision(), BOARD::GetTitleBlock(), PCB_PLOT_PARAMS::GetUseAuxOrigin(), BOARD_DESIGN_SETTINGS::m_AuxOrigin, 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 | ||
) |
Function BuildPlotFileName (helper function) Complete a plot filename: forces the output directory, add a suffix to the name and sets the specified extension the suffix is usually the layer name replaces not allowed chars in suffix by '_'.
aFilename | = the wxFileName to initialize Contains the base filename |
aOutputDir | = the path |
aSuffix | = the suffix to add to the base filename |
aExtension | = the file extension |
Definition at line 369 of file pcbplot.cpp.
Referenced by DIALOG_EXPORT_SVG::ExportSVGFile(), PLOT_CONTROLLER::OpenPlotfile(), and DIALOG_PLOT::Plot().
Function GetGerberFileFunctionAttribute Returns 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 | = the board, needed to get the total count of copper layers |
aLayer | = the layer number to create the attribute for |
Definition at line 86 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 | ) |
Function GetGerberProtelExtension.
Definition at line 45 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 | ||
) |
Function PlotLayerOutlines plot copper outline of a copper layer.
aBoard | = the board to plot |
aPlotter | = the plotter to use |
aLayerMask | = the mask to define the layers to plot |
aPlotOpt | = the plot options. Has meaning for some formats only |
Definition at line 632 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, NULL, 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 | ||
) |
Function PlotOneBoardLayer main function to plot one copper or technical layer.
It prepare options and calls the specialized plot function, according to the layer type
aBoard | = the board to plot |
aPlotter | = the plotter to use |
aLayer | = the layer id to plot |
aPlotOpt | = the plot options (files, sketch). Has meaning for some formats only |
Definition at line 63 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 | ||
) |
Function PlotStandardLayer plot copper or technical layers.
not used for silk screen layers, because these layers have specific requirements, mainly for pads
aBoard | = the board to plot |
aPlotter | = the plotter to use |
aLayerMask | = the mask to define the layers to plot |
aPlotOpt | = 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 ) controle the actual hole: no hole, small hole, actual hole
pads not connected to copper are optionally not drawn
Vias not connected to copper are optionally not drawn
Definition at line 206 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, color, PCB_PLOT_PARAMS::ColorSettings(), SHAPE_POLY_SET::CPolygon(), SHAPE_POLY_SET::DeletePolygon(), dummy(), PLOTTER::EndBlock(), 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, ARC::GetAngle(), ARC::GetArcAngleStart(), GetArcToSegmentCount(), 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(), ARC::GetRadius(), PCB_PLOT_PARAMS::GetSketchPadsOnFabLayers(), PCB_PLOT_PARAMS::GetSkipPlotNPTH_Pads(), SHAPE_POLY_SET::InflateWithLinkedHoles(), SHAPE_POLY_SET::IsEmpty(), LAYER_PAD_BK, LAYER_PAD_FR, 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, NULL, SHAPE_POLY_SET::OutlineCount(), pad, PAD_ATTRIB_NPTH, PAD_SHAPE_CHAMFERED_RECT, PAD_SHAPE_CIRCLE, PAD_SHAPE_CUSTOM, PAD_SHAPE_OVAL, PAD_SHAPE_RECT, PAD_SHAPE_ROUNDRECT, PAD_SHAPE_TRAPEZOID, 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, GBR_METADATA::SetApertureAttrib(), PLOTTER::SetColor(), BRDITEMS_PLOTTER::SetLayerSet(), GBR_METADATA::SetNetAttribType(), GBR_METADATA::SetNetName(), SKETCH, PLOTTER::StartBlock(), PLOTTER::ThickArc(), PLOTTER::ThickSegment(), BOARD::Tracks(), 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.
Return the plotter object if OK, NULL if the file is not created (or has a problem)
Definition at line 1063 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(), NULL, 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().