80 LSET layer_mask( aLayer );
111 if( soldermask_min_thickness == 0 )
121 soldermask_min_thickness );
229 bool onFrontFab = (
LSET(
F_Fab ) & aLayerMask ).any();
230 bool onBackFab = (
LSET(
B_Fab ) & aLayerMask ).any();
249 for(
PAD*
pad : footprint->Pads() )
253 if( !(
pad->GetLayerSet() & aLayerMask ).any() )
256 ( ( onFrontFab &&
pad->GetLayerSet().Contains(
F_Cu ) ) ||
257 ( onBackFab &&
pad->GetLayerSet().Contains(
B_Cu ) ) ) )
268 if( onCopperLayer && !
pad->FlashLayer( aLayerMask ) )
273 if( (
pad->GetLayerSet() & aLayerMask )[
B_Cu] )
276 if( (
pad->GetLayerSet() & aLayerMask )[
F_Cu] )
279 if( sketchPads && aLayerMask[
F_Fab] )
281 else if( sketchPads && aLayerMask[
B_Fab] )
290 if( onSolderMaskLayer )
291 margin.x = margin.y =
pad->GetSolderMaskMargin();
293 if( onSolderPasteLayer )
294 margin =
pad->GetSolderPasteMargin();
300 int mask_clearance = margin.x;
303 wxSize padPlotsSize =
pad->GetSize() + margin * 2 + wxSize( width_adj, width_adj );
307 wxSize padSize =
pad->GetSize();
308 wxSize padDelta =
pad->GetDelta();
309 double padCornerRadius =
pad->GetRoundRectCornerRadius();
314 && ( padPlotsSize.x <= 0 || padPlotsSize.y <= 0 ) )
317 switch(
pad->GetShape() )
321 pad->SetSize( padPlotsSize );
325 (
pad->GetSize() ==
pad->GetDrillSize() ) &&
335 pad->SetSize( padPlotsSize );
337 if( mask_clearance > 0 )
340 pad->SetRoundRectCornerRadius( mask_clearance );
352 if( mask_clearance == 0 )
363 int dx = padSize.x / 2;
364 int dy = padSize.y / 2;
365 int ddx = padDelta.x / 2;
366 int ddy = padDelta.y / 2;
368 outline.
Append( -dx - ddy, dy + ddx );
369 outline.
Append( dx + ddy, dy - ddx );
370 outline.
Append( dx - ddy, -dy + ddx );
371 outline.
Append( -dx + ddy, -dy - ddx );
379 dummy.DeletePrimitivesList();
380 dummy.AddPrimitivePoly( outline, 0,
true );
385 dummy.SetSize( wxSize( 0,0 ) );
396 int initial_radius =
pad->GetRoundRectCornerRadius();
397 pad->SetSize( padPlotsSize );
398 pad->SetRoundRectCornerRadius( std::max( initial_radius + mask_clearance, 0 ) );
405 if( mask_clearance == 0 )
408 pad->SetSize( padPlotsSize );
421 dummy.SetOrientation( 0 );
433 dummy.DeletePrimitivesList();
434 dummy.AddPrimitivePoly( outline, 0,
true );
439 dummy.SetSize( wxSize( 0,0 ) );
441 dummy.SetOrientation(
pad->GetOrientation() );
454 pad->MergePrimitivesAsPolygon( &shape );
461 dummy.DeletePrimitivesList();
462 dummy.AddPrimitivePoly( shape, 0,
true );
467 if( mask_clearance < 0 )
468 dummy.SetSize( padPlotsSize );
476 pad->SetSize( padSize );
477 pad->SetDelta( padDelta );
478 pad->SetShape( padShape );
479 pad->SetRoundRectCornerRadius( padCornerRadius );
492 if( isOnCopperLayer )
502 const PCB_VIA*
via = dyn_cast<const PCB_VIA*>( track );
510 LSET via_mask_layer =
via->GetLayerSet();
514 if( via_mask_layer[
B_Cu] )
515 via_mask_layer.set(
B_Mask );
517 if( via_mask_layer[
F_Cu] )
518 via_mask_layer.set(
F_Mask );
521 if( !( via_mask_layer & aLayerMask ).any() )
525 double width_adj = 0;
534 int diameter =
via->GetWidth() + 2 * via_margin + width_adj;
537 if( onCopperLayer && !
via->FlashLayer( aLayerMask ) )
569 if( !aLayerMask[track->GetLayer()] )
576 gbr_metadata.
SetNetName( track->GetNetname() );
582 const PCB_ARC* arc = static_cast<const PCB_ARC*>( track );
586 double end_angle = start_angle + arc->
GetAngle();
588 aPlotter->
ThickArc( wxPoint( center.x, center.y ), -end_angle, -start_angle,
589 radius, width, plotMode, &gbr_metadata );
593 aPlotter->
ThickSegment( track->GetStart(), track->GetEnd(), width, plotMode,
605 for(
const ZONE* zone : aBoard->
Zones() )
609 if( !aLayerMask[layer] )
617 if( zone->IsIsland( layer, i ) )
629 dummy.SetNet( &nonet );
732 std::vector<wxPoint> cornerList;
737 for(
int kk = 0; kk <= outlines.
HoleCount(ii); kk++ )
741 ( kk == 0 ) ? outlines.
COutline( ii ) : outlines.
CHole( ii, kk - 1 );
755 for(
PAD*
pad : footprint->Pads() )
757 wxSize hole =
pad->GetDrillSize();
759 if( hole.x == 0 || hole.y == 0 )
762 if( hole.x == hole.y )
764 hole.x = std::min( smallDrill, hole.x );
782 const PCB_VIA*
via = dyn_cast<const PCB_VIA*>( track );
784 if(
via &&
via->IsOnLayer( layer ) )
832 boardOutline = &buffer;
837 int inflate = aMinThickness/2 - 1;
852 for(
BOARD_ITEM* item : footprint->GraphicalItems() )
882 footprint->TransformPadsWithClearanceToPolygon( initialPolys, layer, 0, maxError,
885 footprint->TransformPadsWithClearanceToPolygon( areas, layer, inflate, maxError,
894 int via_margin = via_clearance + inflate;
898 const PCB_VIA*
via = dyn_cast<const PCB_VIA*>( track );
904 LSET via_set =
via->GetLayerSet();
912 if( !( via_set & aLayerMask ).any() )
916 via->TransformShapeWithClearanceToPolygon( initialPolys, layer, via_clearance,
919 via->TransformShapeWithClearanceToPolygon( areas, layer, via_margin, maxError,
925 #if 0 // Set to 1 if a solder mask margin must be applied to zones on solder mask 933 if( !zone->IsOnLayer( layer ) )
937 zone->TransformSmoothedOutlineToPolygon( areas, inflate + zone_margin, maxError,
941 zone->TransformSmoothedOutlineToPolygon( initialPolys, zone_margin, maxError,
951 areas.
Deflate( inflate, numSegs );
999 constexpr
double poly_min_area_mm2 = 0.01;
1001 if( curr_area < poly_min_area_mm2 )
1024 wxSize pageSizeIU( pageInfo.GetSizeIU() );
1025 bool autocenter =
false;
1034 sheet_info = &pageA4;
1035 paperSizeIU = pageA4.GetSizeIU();
1036 paperscale = (double) paperSizeIU.x / pageSizeIU.x;
1041 sheet_info = &pageInfo;
1042 paperSizeIU = pageSizeIU;
1046 autocenter = (aPlotOpts->
GetScale() != 1.0);
1050 wxPoint boardCenter = bbox.
Centre();
1051 wxSize boardSize = bbox.
GetSize();
1053 double compound_scale;
1057 if( aPlotOpts->
GetAutoScale() && boardSize.x > 0 && boardSize.y > 0 )
1059 double xscale = (paperSizeIU.x * 0.8) / boardSize.x;
1060 double yscale = (paperSizeIU.y * 0.8) / boardSize.y;
1062 compound_scale = std::min( xscale, yscale ) * paperscale;
1066 compound_scale = aPlotOpts->
GetScale() * paperscale;
1071 wxPoint offset( 0, 0);
1075 offset.x =
KiROUND( boardCenter.x - ( paperSizeIU.x / 2.0 ) / compound_scale );
1076 offset.y =
KiROUND( boardCenter.y - ( paperSizeIU.y / 2.0 ) / compound_scale );
1138 const wxString& aFullFileName,
const wxString& aSheetDesc )
1150 plotter = DXF_plotter;
1158 plotter = PS_plotter;
1171 plotter = HPGL_plotter;
1202 if( plotter->
OpenFile( aFullFileName ) )
1211 GERBER_PLOTTER* gbrplotter = static_cast <GERBER_PLOTTER*> ( plotter );
static LSET AllCuMask(int aCuLayerCount=MAX_CU_LAYERS)
Return a mask holding the requested number of Cu PCB_LAYER_IDs.
OUTLINE_MODE GetPlotMode() const
COLOR4D getColor(LAYER_NUM aLayer) const
White color is special because it cannot be seen on a white paper in B&W mode.
virtual wxPoint GetCenter() const override
This defaults to the center of the bounding box if not overridden.
const POLYGON & CPolygon(int aIndex) const
const PAGE_INFO & GetPageSettings() const
virtual void SetCreator(const wxString &aCreator)
virtual void LoadColors(const COLOR_SETTINGS *aSettings) override
int OutlineCount() const
Return the number of vertices in a given outline/hole.
void UseX2NetAttributes(bool aEnable)
virtual void EndBlock(void *aData)
calling this function allows one to define the end of a group of drawing items for instance in SVG or...
bool GetBoardPolygonOutlines(SHAPE_POLY_SET &aOutlines, OUTLINE_ERROR_HANDLER *aErrorHandler=nullptr)
Extract the board outlines and build a closed polygon from lines, arcs and circle items on edge cut l...
bool GetPlotFrameRef() const
bool GetDXFPlotPolygonMode() const
void BooleanAdd(const SHAPE_POLY_SET &b, POLYGON_MODE aFastMode)
Perform boolean polyset difference For aFastMode meaning, see function booleanOp.
virtual bool StartPlot()=0
void ConvertBrdLayerToPolygonalContours(PCB_LAYER_ID aLayer, SHAPE_POLY_SET &aOutlines) const
Build a set of polygons which are the outlines of copper items (pads, tracks, vias,...
virtual void SetPosition(const wxPoint &aPos)
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
static void FillNegativeKnockout(PLOTTER *aPlotter, const EDA_RECT &aBbbox)
Prefill in black an area a little bigger than the board to prepare for the negative plot.
static constexpr double IU_PER_MM
Mock up a conversion function.
virtual void PlotPoly(const std::vector< wxPoint > &aCornerList, FILL_T aFill, int aWidth=USE_DEFAULT_LINE_WIDTH, void *aData=nullptr)=0
Draw a polygon ( filled or not ).
virtual bool OpenFile(const wxString &aFullFilename)
Open or create the plot file aFullFilename.
void PlotFootprintGraphicItems(const FOOTPRINT *aFootprint)
virtual void SetColorMode(bool aColorMode)
Plot in B/W or color.
bool GetDisableGerberMacros() const
void SetScaleAdjust(double scaleX, double scaleY)
Set the 'fine' scaling for the postscript engine.
virtual void SetLayerPolarity(bool aPositive)
Set the current Gerber layer polarity to positive or negative by writing %LPD*% or %LPC*% to the Gerb...
static const PCB_LAYER_ID plot_seq[]
void PlotStandardLayer(BOARD *aBoard, PLOTTER *aPlotter, LSET aLayerMask, const PCB_PLOT_PARAMS &aPlotOpt)
Plot a copper layer or mask.
void SetRenderSettings(RENDER_SETTINGS *aSettings)
PROJECT * GetProject() const
void PlotDrillMarks()
Draw a drill mark for pads and vias.
void SetMirror(bool aFlag)
virtual void SetPenDiameter(double diameter)
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 prepar...
virtual void StartBlock(void *aData)
calling this function allows one to define the beginning of a group of drawing items,...
class PCB_ARC, an arc track segment on a copper layer
void UseX2format(bool aEnable)
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.
class FP_SHAPE, a footprint edge
int GetHPGLPenSpeed() const
const SHAPE_LINE_CHAIN & CHole(int aOutline, int aHole) const
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 g...
void SetUnits(DXF_UNITS aUnit)
Set the units to use for plotting the DXF file.
void PlotFootprintGraphicItem(const FP_SHAPE *aShape)
void SetDrillMarksType(DrillMarksType aVal)
void PlotPad(const PAD *aPad, const COLOR4D &aColor, OUTLINE_MODE aPlotMode)
Plot a pad.
double m_SmallDrillMarkSize
The diameter of the drill marks on print and plot outputs (in mm), when the "Drill marks" option is s...
void PlotFootprintTextItems(const FOOTPRINT *aFootprint)
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...
LSEQ Seq(const PCB_LAYER_ID *aWishListSequence, unsigned aCount) const
Return an LSEQ from the union of this LSET and a desired sequence.
const wxString & GetFileName() const
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
bool GetUseGerberX2format() const
virtual void ThickSegment(const wxPoint &start, const wxPoint &end, int width, OUTLINE_MODE tracemode, void *aData)
virtual void SetGerberCoordinatesFormat(int aResolution, bool aUseInches=false)
virtual void SetSvgCoordinatesFormat(unsigned aResolution, bool aUseInches=false)
const SEG & GetSeg() const
Classes used in Pcbnew, CvPcb and GerbView.
void DeletePolygon(int aIdx)
Board plot function definition file.
static void PlotSolderMaskLayer(BOARD *aBoard, PLOTTER *aPlotter, LSET aLayerMask, const PCB_PLOT_PARAMS &aPlotOpt, int aMinThickness)
static LIB_SYMBOL * dummy()
Used to draw a dummy shape when a LIB_SYMBOL is not found in library.
PCB specific render settings.
const wxPoint GetEnd() const
PAD_SHAPE
The set of pad shapes, used with PAD::{Set,Get}Shape() DO NOT REORDER, legacy_plugin is dependent on ...
void PlotLayerOutlines(BOARD *aBoard, PLOTTER *aPlotter, LSET aLayerMask, const PCB_PLOT_PARAMS &aPlotOpt)
Plot outlines of copper layer.
like PAD_PTH, but not plated
int GetGerberPrecision() const
LSET is a set of PCB_LAYER_IDs.
PLOT_FORMAT GetFormat() const
void SetLayerSet(LSET aLayerMask)
Meta control for all vias opacity/visibility.
void PlotOneBoardLayer(BOARD *aBoard, PLOTTER *aPlotter, PCB_LAYER_ID aLayer, const PCB_PLOT_PARAMS &aPlotOpt)
Plot one copper or technical layer.
double GetArcAngleStart() const
Represent a set of closed polygons.
unsigned GetSvgPrecision() const
const wxPoint GetOrigin() const
virtual PLOT_FORMAT GetPlotterType() const =0
Returns the effective plot engine in use.
Describe the page size and margins of a paper page on which to eventually print or plot.
void PlotBoardGraphicItems()
Plot items like text and graphics but not tracks and footprints.
virtual void SetPenSpeed(int speed)
FOOTPRINTS & Footprints()
int getFineWidthAdj() const
bool GetIncludeGerberNetlistInfo() const
virtual void SetTextMode(PLOT_TEXT_MODE mode)
Change the current text mode.
void Deflate(int aAmount, int aCircleSegmentsCount, CORNER_STRATEGY aCornerStrategy=ROUND_ALL_CORNERS)
void SetSkipPlotNPTH_Pads(bool aSkip)
PLOT_TEXT_MODE GetTextMode() const
bool GetSkipPlotNPTH_Pads() const
constexpr std::size_t arrayDim(T const (&)[N]) noexcept
Returns # of elements in an array.
a few functions useful in geometry calculations.
void Simplify(POLYGON_MODE aFastMode)
Handle a list of polygons defining a copper zone.
void SetMinThickness(int aMinThickness)
bool GetAutoScale() const
Parameters and options when plotting/printing a board.
int NewOutline()
Creates a new hole in a given outline.
int HoleCount(int aOutline) const
Return the reference to aIndex-th outline in the set.
virtual void SetNegative(bool aNegative)
double GetFineScaleAdjustX() const
void Fracture(POLYGON_MODE aFastMode)
Convert a single outline slitted ("fractured") polygon into a set ouf outlines with holes.
LSEQ is a sequence (and therefore also a set) of PCB_LAYER_IDs.
bool IsCopperLayer(LAYER_NUM aLayerId)
Tests whether a layer is a copper layer.
virtual void SetViewport(const wxPoint &aOffset, double aIusPerDecimil, double aScale, bool aMirror)=0
Set the plot offset and scaling for the current plot.
virtual void SetColor(const COLOR4D &color)=0
void PlotFilledAreas(const ZONE *aZone, const SHAPE_POLY_SET &aPolysList)
void Inflate(int aAmount, int aCircleSegCount, CORNER_STRATEGY aCornerStrategy=ROUND_ALL_CORNERS)
Perform outline inflation/deflation.
Plotting engines similar to ps (PostScript, Gerber, svg)
int GetHPGLPenNum() const
int AddOutline(const SHAPE_LINE_CHAIN &aOutline)
Adds a new hole to the given outline (default: last) and returns its index.
void DisableApertMacros(bool aDisable)
Disable Aperture Macro (AM) command, only for broken Gerber Readers.
Base plotter engine class.
COLOR4D GetColor(int aLayer) const
bool GetSketchPadsOnFabLayers() const
Handle the data for a net.
RENDER_SETTINGS * RenderSettings()
bool GetPlotViaOnMaskLayer() const
TITLE_BLOCK & GetTitleBlock()
const wxPoint & GetAuxOrigin()
Information pertinent to a Pcbnew printed circuit board.
bool GetSubtractMaskFromSilk() const
Represent a polyline containing arcs as well as line segments: A chain of connected line and/or arc s...
PCB_LAYER_ID
A quick note on layer IDs:
When creating polygons to create a clearance polygonal area, the polygon must be same or bigger than ...
const SHAPE_LINE_CHAIN & COutline(int aIndex) const
virtual void SetPenNumber(int number)
void PlotDrawingSheet(PLOTTER *plotter, const PROJECT *aProject, const TITLE_BLOCK &aTitleBlock, const PAGE_INFO &aPageInfo, const wxString &aSheetNumber, int aSheetCount, const wxString &aSheetDesc, const wxString &aFilename, COLOR4D aColor, bool aIsFirstPage)
double GetHPGLPenDiameter() const
Handle the component boundary box.
constexpr ret_type KiROUND(fp_type v)
Round a floating point number to an integer using "round halfway cases away from zero".
void InflateWithLinkedHoles(int aFactor, int aCircleSegmentsCount, POLYGON_MODE aFastMode)
Perform outline inflation/deflation, using round corners.
virtual void Rect(const wxPoint &p1, const wxPoint &p2, FILL_T fill, int width=USE_DEFAULT_LINE_WIDTH)=0
void ClearHeaderLinesList()
Remove all lines from the list of free lines to print at the beginning of the file.
virtual void ThickArc(const wxPoint ¢re, double StAngle, double EndAngle, int rayon, int width, OUTLINE_MODE tracemode, void *aData)
EDA_RECT ComputeBoundingBox(bool aBoardEdgesOnly=false) const
Calculate the bounding box containing all board items (or board edge segments).
double GetFineScaleAdjustY() const
static const ADVANCED_CFG & GetCfg()
Get the singleton instance's config, which is shared by all consumers.
COLOR_SETTINGS * ColorSettings() const
DXF_UNITS GetDXFPlotUnits() const
virtual void SetLayer(PCB_LAYER_ID aLayer) override
Set the layer this item is on.
class PCB_VIA, a via (like a track segment on a copper layer)
bool GetSvgUseInch() const
void BooleanSubtract(const SHAPE_POLY_SET &b, POLYGON_MODE aFastMode)
Perform boolean polyset intersection For aFastMode meaning, see function booleanOp.
bool GetUseAuxOrigin() const
void SetDefaultPenWidth(int aWidth)
DrillMarksType GetDrillMarksType() const
static constexpr int Millimeter2iu(double mm)
int GetArcToSegmentCount(int aRadius, int aErrorMax, double aArcAngleDegree)
virtual void Circle(const wxPoint &pos, int diametre, FILL_T fill, int width=USE_DEFAULT_LINE_WIDTH)=0
bool GetExcludeEdgeLayer() const
virtual void FlashPadCircle(const wxPoint &aPadPos, int aDiameter, OUTLINE_MODE aTraceMode, void *aData)=0
EDA_RECT & Inflate(wxCoord dx, wxCoord dy)
Inflate the rectangle horizontally by dx and vertically by dy.
const wxSize GetSize() const
virtual void SetPageSettings(const PAGE_INFO &aPageSettings)
int Append(int x, int y, int aOutline=-1, int aHole=-1, bool aAllowDuplication=false)
Add a new vertex to the contour indexed by aOutline and aHole (defaults to the outline of the last po...
A color representation with 4 components: red, green, blue, alpha.