KiCad PCB EDA Suite
Loading...
Searching...
No Matches
pcbplot.h File Reference
#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

PLOTTERStartPlotBoard (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.
 

Macro Definition Documentation

◆ PLOT_MAX_SCALE

#define PLOT_MAX_SCALE   100.0

Definition at line 58 of file pcbplot.h.

◆ PLOT_MIN_SCALE

#define PLOT_MIN_SCALE   0.01

Definition at line 57 of file pcbplot.h.

Function Documentation

◆ AddGerberX2Attribute()

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

Parameters
aPlotteris the current plotter.
aBoardis the board, needed to extract some info.
aLayeris the layer number to create the attribute for.
aUseX1CompatibilityModeset 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().

◆ AddGerberX2Header()

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

Parameters
aPlotteris the current plotter.
aBoardis the board, needed to extract some info.
aUseX1CompatibilityModeset 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().

◆ BuildPlotFileName()

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.

Parameters
aFilenameis the file name to initialize that contains the base filename.
aOutputDiris the path.
aSuffixis the suffix to add to the base filename.
aExtensionis 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().

◆ GetGerberFileFunctionAttribute()

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.

Parameters
aBoardis the board, needed to get the total count of copper layers.
aLayeris the layer number to create the attribute for.
Returns
The attribute, as a text string

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().

◆ GetGerberProtelExtension()

const wxString GetGerberProtelExtension ( int  aLayer)

◆ PlotBoardLayers()

void PlotBoardLayers ( BOARD aBoard,
PLOTTER aPlotter,
const LSEQ aLayerSequence,
const PCB_PLOT_PARAMS aPlotOptions 
)

Plot a sequence of board layer IDs.

Parameters
aBoardis the board to plot.
aPlotteris the plotter to use.
aLayerSequenceis the sequence of layer IDs to plot.
aPlotOptionsare 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().

◆ PlotInteractiveLayer()

◆ PlotLayerOutlines()

void PlotLayerOutlines ( BOARD aBoard,
PLOTTER aPlotter,
LSET  aLayerMask,
const PCB_PLOT_PARAMS aPlotOpt 
)

◆ PlotOneBoardLayer()

void PlotOneBoardLayer ( BOARD aBoard,
PLOTTER aPlotter,
PCB_LAYER_ID  aLayer,
const PCB_PLOT_PARAMS aPlotOpt 
)

◆ PlotStandardLayer()

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.

Parameters
aBoardis the board to plot.
aPlotteris the plotter to use.
aLayerMaskis the mask to define the layers to plot.
aPlotOptis 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().

◆ StartPlotBoard()

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.

Returns
the plotter object if OK, NULL if the file is not created (or has a problem).

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().