KiCad PCB EDA Suite
|
Functions to plot one board layer (silkscreen layers or other layers). More...
#include <wx/log.h>
#include <eda_item.h>
#include <layer_ids.h>
#include <geometry/geometry_utils.h>
#include <geometry/shape_segment.h>
#include <pcb_base_frame.h>
#include <math/util.h>
#include <board.h>
#include <footprint.h>
#include <pcb_track.h>
#include <pad.h>
#include <zone.h>
#include <pcb_shape.h>
#include <pcb_target.h>
#include <pcb_dimension.h>
#include <pcbplot.h>
#include <plotters/plotter_dxf.h>
#include <plotters/plotter_hpgl.h>
#include <plotters/plotter_gerber.h>
#include <plotters/plotters_pslike.h>
#include <pcb_painter.h>
#include <gbr_metadata.h>
#include <advanced_config.h>
Go to the source code of this file.
Functions | |
static void | PlotSolderMaskLayer (BOARD *aBoard, PLOTTER *aPlotter, LSET aLayerMask, const PCB_PLOT_PARAMS &aPlotOpt, int aMinThickness) |
Plot a solder mask layer. More... | |
void | PlotBoardLayers (BOARD *aBoard, PLOTTER *aPlotter, const LSEQ &aLayers, const PCB_PLOT_PARAMS &aPlotOptions) |
Plot a sequence of board layer IDs. More... | |
void | PlotInteractiveLayer (BOARD *aBoard, PLOTTER *aPlotter, const PCB_PLOT_PARAMS &aPlotOpt) |
Plot interactive items (hypertext links, properties, etc.). 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 a copper layer or mask. More... | |
void | PlotLayerOutlines (BOARD *aBoard, PLOTTER *aPlotter, LSET aLayerMask, const PCB_PLOT_PARAMS &aPlotOpt) |
Plot outlines of copper layer. More... | |
static void | initializePlotter (PLOTTER *aPlotter, const BOARD *aBoard, const PCB_PLOT_PARAMS *aPlotOpts) |
Set up most plot options for plotting a board (especially the viewport) Important thing: page size is the 'drawing' page size, paper size is the physical page size. More... | |
static void | FillNegativeKnockout (PLOTTER *aPlotter, const BOX2I &aBbbox) |
Prefill in black an area a little bigger than the board to prepare for the negative plot. More... | |
static void | ConfigureHPGLPenSizes (HPGL_PLOTTER *aPlotter, const PCB_PLOT_PARAMS *aPlotOpts) |
Calculate the effective size of HPGL pens and set them in the plotter object. More... | |
PLOTTER * | StartPlotBoard (BOARD *aBoard, const PCB_PLOT_PARAMS *aPlotOpts, int aLayer, 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. More... | |
Functions to plot one board layer (silkscreen layers or other layers).
Silkscreen layers have specific requirement for pads (not filled) and texts (with option to remove them from some copper areas (pads...)
Definition in file plot_board_layers.cpp.
|
static |
Calculate the effective size of HPGL pens and set them in the plotter object.
Definition at line 1114 of file plot_board_layers.cpp.
References PCB_PLOT_PARAMS::GetHPGLPenDiameter(), PCB_PLOT_PARAMS::GetHPGLPenNum(), PCB_PLOT_PARAMS::GetHPGLPenSpeed(), PCB_PLOT_PARAMS::GetScale(), EDA_IU_SCALE::IU_PER_MILS, KiROUND(), pcbIUScale, HPGL_PLOTTER::SetPenDiameter(), HPGL_PLOTTER::SetPenNumber(), and HPGL_PLOTTER::SetPenSpeed().
Referenced by StartPlotBoard().
Prefill in black an area a little bigger than the board to prepare for the negative plot.
Definition at line 1098 of file plot_board_layers.cpp.
References BLACK, FILLED_SHAPE, BOX2< Vec >::GetEnd(), BOX2< Vec >::GetOrigin(), BOX2< Vec >::Inflate(), EDA_IU_SCALE::IU_PER_MM, pcbIUScale, PLOTTER::Rect(), PLOTTER::SetColor(), PLOTTER::SetNegative(), and WHITE.
Referenced by StartPlotBoard().
|
static |
Set up most plot options for plotting a board (especially the viewport) Important thing: page size is the 'drawing' page size, paper size is the physical page size.
Definition at line 1011 of file plot_board_layers.cpp.
References BOX2< Vec >::Centre(), BOARD::ComputeBoundingBox(), PCB_PLOT_PARAMS::GetA4Output(), PCB_PLOT_PARAMS::GetAutoScale(), BOARD_DESIGN_SETTINGS::GetAuxOrigin(), PCB_PLOT_PARAMS::GetBlackAndWhite(), BOARD::GetDesignSettings(), PCB_PLOT_PARAMS::GetGerberPrecision(), PCB_PLOT_PARAMS::GetMirror(), BOARD::GetPageSettings(), PCB_PLOT_PARAMS::GetScale(), BOX2< Vec >::GetSize(), PAGE_INFO::GetSizeIU(), PCB_PLOT_PARAMS::GetSvgPrecision(), PCB_PLOT_PARAMS::GetTextMode(), PCB_PLOT_PARAMS::GetUseAuxOrigin(), EDA_IU_SCALE::IU_PER_MILS, KiROUND(), pcbIUScale, PLOTTER::SetColorMode(), PLOTTER::SetCreator(), PLOTTER::SetGerberCoordinatesFormat(), PLOTTER::SetPageSettings(), PLOTTER::SetSvgCoordinatesFormat(), PLOTTER::SetTextMode(), PLOTTER::SetViewport(), VECTOR2< T >::x, and VECTOR2< T >::y.
Referenced by StartPlotBoard().
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 64 of file plot_board_layers.cpp.
References 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 74 of file plot_board_layers.cpp.
References _, B_Cu, PLOTTER::Bookmark(), F_Cu, BOARD::Footprints(), PCB_FIELD::GetName(), EDA_TEXT::GetText(), PLOTTER::HyperlinkMenu(), PCB_FIELD::IsFootprint(), PCB_FIELD::IsReference(), PCB_FIELD::IsValue(), PCB_PLOT_PARAMS::m_PDFBackFPPropertyPopups, and PCB_PLOT_PARAMS::m_PDFFrontFPPropertyPopups.
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 outlines of copper layer.
Plot copper outline of a copper layer.
Definition at line 717 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::PM_FAST, SHAPE_POLY_SET::RemoveAllContours(), LSET::Seq(), LSET::SeqStackupBottom2Top(), 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 129 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::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(), PLOTTER::SetLayerPolarity(), PCB_PLOT_PARAMS::SetSkipPlotNPTH_Pads(), and PLOTTER::SetTextMode().
Referenced by PlotBoardLayers(), and PLOT_CONTROLLER::PlotLayer().
|
static |
Plot a solder mask layer.
Solder mask layers have a minimum thickness value and cannot be drawn like standard layers, unless the minimum thickness is 0.
The algorithm is somewhat complicated to allow for min web thickness while also preserving pad attributes in Gerber.
1 - create initial polygons for every shape 2 - inflate and deflate polygons with Min Thickness/2, and merges the result 3 - substract all initial polygons from (2), leaving the areas where the thickness was less than min thickness 4 - plot all initial shapes by flashing (or using regions), including Gerber attribute data 5 - plot remaining polygons from (2) (witout any Gerber attributes)
Definition at line 813 of file plot_board_layers.cpp.
References B_Mask, SHAPE_POLY_SET::BooleanAdd(), SHAPE_POLY_SET::CHAMFER_ALL_CORNERS, SHAPE_POLY_SET::Deflate(), BOARD::Drawings(), ERROR_OUTSIDE, F_Mask, BOARD::Footprints(), SHAPE_POLY_SET::Fracture(), BOARD::GetBoardPolygonOutlines(), BOARD::GetDesignSettings(), PCB_PLOT_PARAMS::GetPlotFPText(), PCB_PLOT_PARAMS::GetPlotInvisibleText(), PCB_PLOT_PARAMS::GetPlotReference(), PCB_PLOT_PARAMS::GetPlotValue(), BOARD_DESIGN_SETTINGS::m_MaxError, BOARD_DESIGN_SETTINGS::m_SolderMaskExpansion, PCB_TEXT_T, PCB_VIA_T, BRDITEMS_PLOTTER::PlotZone(), SHAPE_POLY_SET::PM_FAST, SHAPE_POLY_SET::PM_STRICTLY_SIMPLE, ZONE::SetLayer(), BRDITEMS_PLOTTER::SetLayerSet(), ZONE::SetMinThickness(), SHAPE_POLY_SET::Simplify(), text, BOARD::Tracks(), via, and BOARD::Zones().
Referenced by PlotOneBoardLayer().
void PlotStandardLayer | ( | BOARD * | aBoard, |
PLOTTER * | aPlotter, | ||
LSET | aLayerMask, | ||
const PCB_PLOT_PARAMS & | aPlotOpt | ||
) |
Plot a copper layer or mask.
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 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, 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(), PCB_ARC::GetCenter(), COLOR_SETTINGS::GetColor(), BRDITEMS_PLOTTER::getColor(), BOARD::GetDesignSettings(), PCB_PLOT_PARAMS::GetDrillMarksType(), BRDITEMS_PLOTTER::getFineWidthAdj(), PCB_PLOT_PARAMS::GetPlotMode(), PCB_ARC::GetRadius(), PCB_PLOT_PARAMS::GetSketchPadsOnFabLayers(), PCB_PLOT_PARAMS::GetSkipPlotNPTH_Pads(), SHAPE_POLY_SET::InflateWithLinkedHoles(), PCB_ARC::IsDegenerated(), SHAPE_POLY_SET::IsEmpty(), LAYER_VIAS, LIGHTGRAY, 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::PlotZone(), SHAPE_POLY_SET::PM_FAST, RECTANGLE, SHAPE_POLY_SET::ROUND_ALL_CORNERS, ROUNDRECT, LSET::Seq(), 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, 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 & | 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 1133 of file plot_board_layers.cpp.
References AddGerberX2Attribute(), PLOTTER::ClearHeaderLinesList(), PCB_PLOT_PARAMS::ColorSettings(), BOARD::ComputeBoundingBox(), ConfigureHPGLPenSizes(), GERBER_PLOTTER::DisableApertMacros(), DXF, FillNegativeKnockout(), GAL_LAYER_ID_END, 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(), BOARD::GetLayerName(), 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, ToLAYER_ID(), 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().