KiCad PCB EDA Suite
|
#include <lset.h>
#include <padstack.h>
#include <pcb_plot_params.h>
#include <settings/color_settings.h>
#include <settings/settings_manager.h>
#include <board.h>
#include <board_design_settings.h>
#include <board_item.h>
Go to the source code of this file.
Classes | |
class | BRDITEMS_PLOTTER |
Namespaces | |
namespace | KIFONT |
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 &aLayerName, const wxString &aFullFileName, const wxString &aSheetName, const wxString &aSheetPath) |
Open a new plotfile using the options (and especially the format) specified in the options and prepare the page for plotting. | |
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) |
Plot one copper or technical layer. | |
void | PlotStandardLayer (BOARD *aBoard, PLOTTER *aPlotter, LSET aLayerMask, const PCB_PLOT_PARAMS &aPlotOpt) |
Plot copper or technical layers. | |
void | PlotLayerOutlines (BOARD *aBoard, PLOTTER *aPlotter, LSET aLayerMask, const PCB_PLOT_PARAMS &aPlotOpt) |
Plot copper outline of a copper layer. | |
void | BuildPlotFileName (wxFileName *aFilename, const wxString &aOutputDir, const wxString &aSuffix, const wxString &aExtension) |
Complete a plot filename. | |
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). | |
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. | |
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 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
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 360 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 294 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(), replaceReservedCharsField(), text, VECTOR2< T >::x, and VECTOR2< T >::y.
Referenced by AddGerberX2Attribute(), GERBER_WRITER::createDrillFile(), PLACEFILE_GERBER_WRITER::CreatePlaceFile(), and GENDRILL_WRITER_BASE::genDrillMapFile().
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 379 of file pcbplot.cpp.
Referenced by DIALOG_EXPORT_SVG::ExportSVGFile(), PCBNEW_JOBS_HANDLER::JobExportGerbers(), PLOT_CONTROLLER::OpenPlotfile(), and DIALOG_PLOT::Plot().
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.
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 82 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 | ( | int | aLayer | ) |
Definition at line 43 of file pcbplot.cpp.
References B_Adhes, B_Cu, B_Mask, B_Paste, B_SilkS, Cmts_User, CopperLayerToOrdinal(), Dwgs_User, Eco1_User, Eco2_User, Edge_Cuts, F_Adhes, F_Cu, F_Mask, F_Paste, F_SilkS, IsCopperLayer(), and ToLAYER_ID().
Referenced by PCBNEW_JOBS_HANDLER::JobExportGerbers(), PLOT_CONTROLLER::OpenPlotfile(), and DIALOG_PLOT::Plot().
void PlotBoardLayers | ( | BOARD * | aBoard, |
PLOTTER * | aPlotter, | ||
const LSEQ & | aLayerSequence, | ||
const PCB_PLOT_PARAMS & | aPlotOptions | ||
) |
Plot a sequence of board layer IDs.
aBoard | is the board to plot. |
aPlotter | is the plotter to use. |
aLayerSequence | is the sequence of layer IDs to plot. |
aPlotOptions | are the plot options (files, sketch). Has meaning for some formats only. |
Definition at line 57 of file plot_board_layers.cpp.
References PCB_PLOT_PARAMS::GetDrillMarksType(), IsCopperLayer(), NO_DRILL_SHAPE, and PlotOneBoardLayer().
Referenced by PCBNEW_JOBS_HANDLER::JobExportDxf(), PCBNEW_JOBS_HANDLER::JobExportGerber(), PCBNEW_JOBS_HANDLER::JobExportGerbers(), PCBNEW_JOBS_HANDLER::JobExportPdf(), EXPORT_SVG::Plot(), DIALOG_PLOT::Plot(), and PLOT_CONTROLLER::PlotLayers().
void PlotInteractiveLayer | ( | BOARD * | aBoard, |
PLOTTER * | aPlotter, | ||
const PCB_PLOT_PARAMS & | aPlotOpt | ||
) |
Plot interactive items (hypertext links, properties, etc.).
Definition at line 90 of file plot_board_layers.cpp.
References _, B_Cu, PLOTTER::Bookmark(), F_Cu, BOARD::Footprints(), BOX2< Vec >::GetHeight(), PCB_FIELD::GetName(), PLOTTER::GetPlotOffsetUserUnits(), EDA_TEXT::GetText(), BOX2< Vec >::GetWidth(), PLOTTER::HyperlinkMenu(), BOX2< Vec >::Inflate(), PCB_FIELD::IsReference(), PCB_FIELD::IsValue(), PCB_PLOT_PARAMS::m_PDFBackFPPropertyPopups, PCB_PLOT_PARAMS::m_PDFFrontFPPropertyPopups, and BOX2< Vec >::Move().
Referenced by PCBNEW_JOBS_HANDLER::JobExportPdf(), DIALOG_PLOT::Plot(), PLOT_CONTROLLER::PlotLayer(), and PLOT_CONTROLLER::PlotLayers().
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 792 of file plot_board_layers.cpp.
References SHAPE_POLY_SET::CHole(), PLOTTER::Circle(), BOARD::ConvertBrdLayerToPolygonalContours(), SHAPE_POLY_SET::COutline(), BOARD::Footprints(), ADVANCED_CFG::GetCfg(), PCB_PLOT_PARAMS::GetDrillMarksType(), SHAPE_POLY_SET::HoleCount(), ADVANCED_CFG::m_SmallDrillMarkSize, EDA_IU_SCALE::mmToIU(), NO_DRILL_SHAPE, NO_FILL, SHAPE_POLY_SET::OutlineCount(), pad, path, PCB_VIA_T, pcbIUScale, PLOTTER::PlotPoly(), SHAPE_POLY_SET::RemoveAllContours(), LSET::Seq(), LSET::SeqStackupForPlotting(), BRDITEMS_PLOTTER::SetLayerSet(), SHAPE_POLY_SET::Simplify(), SKETCH, 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 158 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::GetFormat(), PLOTTER::GetPlotterType(), PCB_PLOT_PARAMS::GetSubtractMaskFromSilk(), PCB_PLOT_PARAMS::GetTextMode(), IsCopperLayer(), BOARD_DESIGN_SETTINGS::m_SolderMaskMinWidth, Margin, NO_DRILL_SHAPE, PlotLayerOutlines(), PlotSolderMaskLayer(), PlotStandardLayer(), PLOTTER::SetColor(), PCB_PLOT_PARAMS::SetDrillMarksType(), PCB_PLOT_PARAMS::SetDXFPlotPolygonMode(), PLOTTER::SetLayerPolarity(), PCB_PLOT_PARAMS::SetSkipPlotNPTH_Pads(), and PLOTTER::SetTextMode().
Referenced by PlotBoardLayers(), 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 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 ) aVal = no hole, small hole, actual hole size
Plot copper or technical layers.
pads not connected to copper are optionally not drawn
Vias not connected to copper are optionally not drawn
Definition at line 281 of file plot_board_layers.cpp.
References SHAPE_POLY_SET::AddOutline(), LSET::AllCuMask(), ANGLE_0, SHAPE_POLY_SET::Append(), B_Cu, B_Fab, B_Mask, B_Paste, KIGFX::COLOR4D::BLACK, CHAMFERED_RECT, CIRCLE, SHAPE_POLY_SET::CloneDropTriangulation(), color, PCB_PLOT_PARAMS::ColorSettings(), SHAPE_POLY_SET::CPolygon(), CUSTOM, SHAPE_POLY_SET::DeletePolygon(), BOARD::Drawings(), dummy, PLOTTER::EndBlock(), ERROR_INSIDE, F_Cu, F_Fab, F_Mask, F_Paste, FILLED, PLOTTER::FlashPadCircle(), BOARD::Footprints(), GBR_APERTURE_METADATA::GBR_APERTURE_ATTRIB_CONDUCTOR, GBR_APERTURE_METADATA::GBR_APERTURE_ATTRIB_NONE, GBR_APERTURE_METADATA::GBR_APERTURE_ATTRIB_VIAPAD, GBR_NETLIST_METADATA::GBR_NETINFO_NET, GBR_NETLIST_METADATA::GBR_NETINFO_UNSPECIFIED, PCB_ARC::GetAngle(), PCB_ARC::GetArcAngleStart(), BOX2< Vec >::GetBottom(), PCB_ARC::GetCenter(), COLOR_SETTINGS::GetColor(), BRDITEMS_PLOTTER::getColor(), PCB_PLOT_PARAMS::GetCrossoutDNPFPsOnFabLayers(), BOARD::GetDesignSettings(), PCB_PLOT_PARAMS::GetDrillMarksType(), BOX2< Vec >::GetEnd(), BRDITEMS_PLOTTER::getFineWidthAdj(), PCB_PLOT_PARAMS::GetHideDNPFPsOnFabLayers(), BOX2< Vec >::GetLeft(), BOX2< Vec >::GetOrigin(), PCB_PLOT_PARAMS::GetPlotMode(), PCB_PLOT_PARAMS::GetPlotPadNumbers(), PCB_ARC::GetRadius(), BOX2< Vec >::GetRight(), PCB_PLOT_PARAMS::GetSketchPadsOnFabLayers(), PCB_PLOT_PARAMS::GetSkipPlotNPTH_Pads(), BOX2< Vec >::GetTop(), SHAPE_POLY_SET::InflateWithLinkedHoles(), PCB_ARC::IsDegenerated(), SHAPE_POLY_SET::IsEmpty(), LAYER_CLASS_FAB, LAYER_VIAS, LIGHTGRAY, BOARD_DESIGN_SETTINGS::m_LineThickness, BOARD_DESIGN_SETTINGS::m_MaxError, GBR_METADATA::m_NetlistMetadata, GBR_NETLIST_METADATA::m_NotInNet, SHAPE_POLY_SET::NewOutline(), NO_DRILL_SHAPE, NPTH, SHAPE_POLY_SET::OutlineCount(), OVAL, pad, PCB_ARC_T, PCB_VIA_T, BRDITEMS_PLOTTER::PlotBoardGraphicItem(), BRDITEMS_PLOTTER::PlotDrillMarks(), BRDITEMS_PLOTTER::PlotFootprintGraphicItems(), BRDITEMS_PLOTTER::PlotFootprintTextItems(), BRDITEMS_PLOTTER::PlotPad(), BRDITEMS_PLOTTER::PlotPadNumber(), BRDITEMS_PLOTTER::PlotZone(), RECTANGLE, ROUND_ALL_CORNERS, ROUNDRECT, LSET::Seq(), LSET::SeqStackupForPlotting(), GBR_METADATA::SetApertureAttrib(), PLOTTER::SetColor(), BRDITEMS_PLOTTER::SetLayerSet(), GBR_METADATA::SetNetAttribType(), GBR_METADATA::SetNetName(), SKETCH, PLOTTER::StartBlock(), PLOTTER::ThickArc(), PLOTTER::ThickSegment(), BOARD::Tracks(), TRAPEZOID, UNDEFINED_LAYER, KIGFX::COLOR4D::UNSPECIFIED, via, WHITE, VECTOR2< T >::x, VECTOR2< T >::y, and BOARD::Zones().
Referenced by PlotOneBoardLayer().
PLOTTER * StartPlotBoard | ( | BOARD * | aBoard, |
const PCB_PLOT_PARAMS * | aPlotOpts, | ||
int | aLayer, | ||
const wxString & | aLayerName, | ||
const wxString & | aFullFileName, | ||
const wxString & | aSheetName, | ||
const wxString & | aSheetPath | ||
) |
Open a new plotfile using the options (and especially the format) specified in the options and prepare the page for plotting.
Definition at line 1208 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(), KIGFX::RENDER_SETTINGS::GetLayerColor(), PCB_PLOT_PARAMS::GetMirror(), PCB_PLOT_PARAMS::GetNegative(), BOARD::GetPageSettings(), PCB_PLOT_PARAMS::GetPlotFrameRef(), PLOTTER::GetPlotterType(), BOARD::GetProject(), BOARD::GetProperties(), BOARD::GetTitleBlock(), PCB_PLOT_PARAMS::GetUseGerberX2format(), HPGL, initializePlotter(), LAYER_DRAWINGSHEET, KIGFX::PCB_RENDER_SETTINGS::LoadColors(), EDA_IU_SCALE::mmToIU(), PLOTTER::OpenFile(), PCB_LAYER_ID_COUNT, pcbIUScale, PDF, PlotDrawingSheet(), POST, PLOTTER::RenderSettings(), KIGFX::RENDER_SETTINGS::SetDefaultPenWidth(), KIGFX::RENDER_SETTINGS::SetLayerName(), PCB_PLOT_PARAMS::SetMirror(), PLOTTER::SetRenderSettings(), PSLIKE_PLOTTER::SetScaleAdjust(), DXF_PLOTTER::SetUnits(), PLOTTER::StartPlot(), SVG, GERBER_PLOTTER::UseX2format(), and GERBER_PLOTTER::UseX2NetAttributes().
Referenced by PCBNEW_JOBS_HANDLER::JobExportDxf(), PCBNEW_JOBS_HANDLER::JobExportGerber(), PCBNEW_JOBS_HANDLER::JobExportGerbers(), PCBNEW_JOBS_HANDLER::JobExportPdf(), PLOT_CONTROLLER::OpenPlotfile(), EXPORT_SVG::Plot(), and DIALOG_PLOT::Plot().