75 LSET layer_mask( aLayer );
106 if( soldermask_min_thickness == 0 )
115 soldermask_min_thickness );
217 bool onFrontFab = (
LSET(
F_Fab ) & aLayerMask ).any();
218 bool onBackFab = (
LSET(
B_Fab ) & aLayerMask ).any();
237 for(
PAD* pad : footprint->Pads() )
241 if( !( pad->GetLayerSet() & aLayerMask ).any() )
244 ( ( onFrontFab && pad->GetLayerSet().Contains(
F_Cu ) ) ||
245 ( onBackFab && pad->GetLayerSet().Contains(
B_Cu ) ) ) )
252 if( onCopperLayer && !pad->FlashLayer( aLayerMask ) )
257 if( pad->GetLayerSet()[
B_Cu] )
260 if( pad->GetLayerSet()[
F_Cu] )
263 if( sketchPads && aLayerMask[
F_Fab] )
265 else if( sketchPads && aLayerMask[
B_Fab] )
274 if( onSolderMaskLayer )
275 margin.x = margin.y = pad->GetSolderMaskMargin();
277 if( onSolderPasteLayer )
278 margin = pad->GetSolderPasteMargin();
284 int mask_clearance = margin.x;
287 wxSize padPlotsSize = pad->GetSize() + margin * 2 + wxSize( width_adj, width_adj );
291 wxSize padSize = pad->GetSize();
292 wxSize padDelta = pad->GetDelta();
293 double padCornerRadius = pad->GetRoundRectCornerRadius();
296 if( padPlotsSize.x <= 0 || padPlotsSize.y <= 0 )
299 switch( pad->GetShape() )
303 pad->SetSize( padPlotsSize );
307 ( pad->GetSize() == pad->GetDrillSize() ) &&
315 pad->SetSize( padPlotsSize );
317 if( mask_clearance > 0 )
320 pad->SetRoundRectCornerRadius( mask_clearance );
332 if( mask_clearance == 0 )
341 int dx = padSize.x / 2;
342 int dy = padSize.y / 2;
343 int ddx = padDelta.x / 2;
344 int ddy = padDelta.y / 2;
346 outline.
Append( -dx - ddy, dy + ddx );
347 outline.
Append( dx + ddy, dy - ddx );
348 outline.
Append( dx - ddy, -dy + ddx );
349 outline.
Append( -dx + ddy, -dy - ddx );
356 dummy.DeletePrimitivesList();
357 dummy.AddPrimitivePoly( outline, 0,
true );
362 dummy.SetSize( wxSize( 0,0 ) );
372 pad->SetSize( padPlotsSize );
388 dummy.DeletePrimitivesList();
389 dummy.AddPrimitivePoly( shape, 0,
true );
394 if( mask_clearance < 0 )
395 dummy.SetSize( padPlotsSize );
403 pad->SetSize( padSize );
404 pad->SetDelta( padDelta );
405 pad->SetShape( padShape );
406 pad->SetRoundRectCornerRadius( padCornerRadius );
419 if( isOnCopperLayer )
429 const VIA* via = dyn_cast<const VIA*>( track );
441 if( via_mask_layer[
B_Cu] )
442 via_mask_layer.set(
B_Mask );
444 if( via_mask_layer[
F_Cu] )
445 via_mask_layer.set(
F_Mask );
448 if( !( via_mask_layer & aLayerMask ).any() )
452 double width_adj = 0;
461 int diameter = via->
GetWidth() + 2 * via_margin + width_adj;
464 if( onCopperLayer && !via->
FlashLayer( aLayerMask ) )
495 if( !aLayerMask[track->GetLayer()] )
502 gbr_metadata.
SetNetName( track->GetNetname() );
508 ARC* arc = static_cast<ARC*>( track );
512 double end_angle = start_angle + arc->
GetAngle();
514 aPlotter->
ThickArc( wxPoint( center.x, center.y ), -end_angle, -start_angle,
515 radius, width, plotMode, &gbr_metadata );
519 aPlotter->
ThickSegment( track->GetStart(), track->GetEnd(), width, plotMode,
536 if( !aLayerMask[layer] )
544 if( zone->IsIsland( layer, i ) )
556 dummy.SetNet( &nonet );
650 std::vector<wxPoint> cornerList;
655 for(
int kk = 0; kk <= outlines.
HoleCount (ii); kk++ )
660 for(
int jj = 0; jj < path.
PointCount(); jj++ )
661 cornerList.emplace_back( (wxPoint) path.
CPoint( jj ) );
664 if( cornerList[0] != cornerList[cornerList.size() - 1] )
665 cornerList.push_back( cornerList[0] );
679 for(
PAD* pad : footprint->Pads() )
681 wxSize hole = pad->GetDrillSize();
683 if( hole.x == 0 || hole.y == 0 )
686 if( hole.x == hole.y )
688 hole.x = std::min( smallDrill, hole.x );
706 const VIA* via = dyn_cast<const VIA*>( track );
756 boardOutline = &buffer;
761 int inflate = aMinThickness/2 - 1;
774 for(
BOARD_ITEM* item : footprint->GraphicalItems() )
805 footprint->TransformPadsWithClearanceToPolygon( initialPolys, layer, 0, maxError,
808 footprint->TransformPadsWithClearanceToPolygon( areas, layer, inflate, maxError,
817 int via_margin = via_clearance + inflate;
821 const VIA* via = dyn_cast<const VIA*>( track );
835 if( !( via_set & aLayerMask ).any() )
848 #if 0 // Set to 1 if a solder mask margin must be applied to zones on solder mask 856 if( zone->GetLayer() != layer )
860 zone->TransformSmoothedOutlineToPolygon( areas, inflate + zone_margin, boardOutline );
862 zone->TransformSmoothedOutlineToPolygon( initialPolys, zone_margin, boardOutline );
870 areas.
Deflate( inflate, numSegs );
909 std::vector<wxPoint> cornerList;
922 constexpr
double poly_min_area_mm2 = 0.01;
924 if( curr_area < poly_min_area_mm2 )
927 for(
int jj = 0; jj < path.
PointCount(); jj++ )
928 cornerList.emplace_back( (wxPoint) path.
CPoint( jj ) );
931 if( cornerList[0] != cornerList[cornerList.size() - 1] )
932 cornerList.push_back( cornerList[0] );
954 wxSize pageSizeIU( pageInfo.GetSizeIU() );
955 bool autocenter =
false;
964 sheet_info = &pageA4;
965 paperSizeIU = pageA4.GetSizeIU();
966 paperscale = (double) paperSizeIU.x / pageSizeIU.x;
971 sheet_info = &pageInfo;
972 paperSizeIU = pageSizeIU;
976 autocenter = (aPlotOpts->
GetScale() != 1.0);
980 wxPoint boardCenter = bbox.
Centre();
981 wxSize boardSize = bbox.
GetSize();
983 double compound_scale;
987 if( aPlotOpts->
GetAutoScale() && boardSize.x > 0 && boardSize.y > 0 )
989 double xscale = (paperSizeIU.x * 0.8) / boardSize.x;
990 double yscale = (paperSizeIU.y * 0.8) / boardSize.y;
992 compound_scale = std::min( xscale, yscale ) * paperscale;
995 compound_scale = aPlotOpts->
GetScale() * paperscale;
1000 wxPoint offset( 0, 0);
1004 offset.x =
KiROUND( boardCenter.x - ( paperSizeIU.x / 2.0 ) / compound_scale );
1005 offset.y =
KiROUND( boardCenter.y - ( paperSizeIU.y / 2.0 ) / compound_scale );
1064 const wxString& aFullFileName,
const wxString& aSheetDesc )
1076 plotter = DXF_plotter;
1084 plotter = PS_plotter;
1097 plotter = HPGL_plotter;
1128 if( plotter->
OpenFile( aFullFileName ) )
1137 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
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
virtual LSET GetLayerSet() const override
Return a std::bitset of all layers on which the item physically resides.
bool GetDXFPlotPolygonMode() const
static void initializePlotter(PLOTTER *aPlotter, BOARD *aBoard, PCB_PLOT_PARAMS *aPlotOpts)
Set up most plot options for plotting a board (especially the viewport) Important thing: page size is...
void BooleanAdd(const SHAPE_POLY_SET &b, POLYGON_MODE aFastMode)
Perform boolean polyset difference For aFastMode meaning, see function booleanOp.
virtual bool StartPlot()=0
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Plotting engines (PostScript, Gerber, HPGL and DXF)
virtual void SetColor(COLOR4D color)=0
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.
virtual void Rect(const wxPoint &p1, const wxPoint &p2, FILL_TYPE fill, int width=USE_DEFAULT_LINE_WIDTH)=0
const wxPoint & GetStart() const
static constexpr double IU_PER_MM
Mock up a conversion function.
virtual bool OpenFile(const wxString &aFullFilename)
Open or create the plot file aFullFilename.
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)
Function PlotStandardLayer plot copper or technical layers.
void SetRenderSettings(RENDER_SETTINGS *aSettings)
PROJECT * GetProject() const
void PlotDrillMarks()
Function PlotDrillMarks Draw a drill mark for pads and vias.
void SetMirror(bool aFlag)
virtual void SetPenDiameter(double diameter)
virtual void StartBlock(void *aData)
calling this function allows one to define the beginning of a group of drawing items,...
void PlotFootprintTextItems(FOOTPRINT *aFootprint)
class ARC, an arc track segment on a copper layer
static LIB_PART * dummy()
Used to draw a dummy shape when a LIB_PART is not found in library.
void UseX2format(bool aEnable)
wxString GetNetname() const
virtual void PlotPoly(const std::vector< wxPoint > &aCornerList, FILL_TYPE aFill, int aWidth=USE_DEFAULT_LINE_WIDTH, void *aData=NULL)=0
Draw a polygon ( filled or not )
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
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)
Calculates some X2 attributes, as defined in the Gerber file format specification and add them to the...
void SetUnits(DXF_UNITS aUnit)
Set the units to use for plotting the DXF file.
void SetDrillMarksType(DrillMarksType aVal)
void Inflate(int aAmount, int aCircleSegmentsCount, CORNER_STRATEGY aCornerStrategy=ROUND_ALL_CORNERS)
Perform outline inflation/deflation.
like PAD_PTH, but not plated mechanical use only, no connection allowed
double m_SmallDrillMarkSize
The diameter of the drill marks on print and plot outputs (in mm), when the "Drill marks" option is s...
int PointCount() const
Function PointCount()
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
bool GetUseGerberX2format() const
virtual void ThickSegment(const wxPoint &start, const wxPoint &end, int width, OUTLINE_MODE tracemode, void *aData)
PAD_SHAPE_T
The set of pad shapes, used with PAD::{Set,Get}Shape()
virtual void SetGerberCoordinatesFormat(int aResolution, bool aUseInches=false)
virtual void SetSvgCoordinatesFormat(unsigned aResolution, bool aUseInches=false)
const SEG & GetSeg() const
void TransformShapeWithClearanceToPolygon(SHAPE_POLY_SET &aCornerBuffer, PCB_LAYER_ID aLayer, int aClearanceValue, int aError, ERROR_LOC aErrorLoc, bool ignoreLineWidth=false) const override
Function TransformShapeWithClearanceToPolygon Convert the track shape to a closed polygon Used in fil...
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)
PCB specific render settings.
const VECTOR2I & CPoint(int aIndex) const
Function Point()
const wxPoint GetEnd() const
void PlotLayerOutlines(BOARD *aBoard, PLOTTER *aPlotter, LSET aLayerMask, const PCB_PLOT_PARAMS &aPlotOpt)
Function PlotLayerOutlines plot copper outline of a copper layer.
PCB_LAYER_ID
A quick note on layer IDs:
int GetGerberPrecision() const
LSET is a set of PCB_LAYER_IDs.
PLOT_FORMAT GetFormat() const
void SetLayerSet(LSET aLayerMask)
int GetDrillValue() const
Function GetDrillValue "calculates" the drill value for vias (m-Drill if > 0, or default drill value ...
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.
Represent a set of closed polygons.
unsigned GetSvgPrecision() const
bool FlashLayer(int aLayer) const
Checks to see whether the via should have a pad on the specific layer.
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()
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
void ConvertBrdLayerToPolygonalContours(PCB_LAYER_ID aLayer, SHAPE_POLY_SET &aOutlines)
Build a set of polygons which are the outlines of copper items (pads, tracks, vias,...
bool GetSkipPlotNPTH_Pads() const
void PlotFootprintGraphicItems(FOOTPRINT *aFootprint)
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)
ZONE handles a list of polygons defining a copper zone.
static void ConfigureHPGLPenSizes(HPGL_PLOTTER *aPlotter, PCB_PLOT_PARAMS *aPlotOpts)
Calculate the effective size of HPGL pens and set them in the plotter object.
void SetMinThickness(int aMinThickness)
bool GetAutoScale() const
PCB_PLOT_PARAMS handles plot parameters and options when plotting/printing a board.
virtual void Circle(const wxPoint &pos, int diametre, FILL_TYPE fill, int width=USE_DEFAULT_LINE_WIDTH)=0
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.
PLOTTER * StartPlotBoard(BOARD *aBoard, 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 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.
virtual void SetViewport(const wxPoint &aOffset, double aIusPerDecimil, double aScale, bool aMirror)=0
Set the plot offset and scaling for the current plot.
int GetHPGLPenNum() const
void PlotFilledAreas(ZONE *aZone, SHAPE_POLY_SET &aPolysList)
int AddOutline(const SHAPE_LINE_CHAIN &aOutline)
Adds a new hole to the given outline (default: last) and returns its index.
void PlotPad(PAD *aPad, COLOR4D aColor, OUTLINE_MODE aPlotMode)
Plot a pad.
void DisableApertMacros(bool aDisable)
Disable Aperture Macro (AM) command, only for broken Gerber Readers Regions will be used instead of A...
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()
Meta control for all vias opacity/visibility.
Information pertinent to a Pcbnew printed circuit board.
bool GetSubtractMaskFromSilk() const
When creating polygons to create a clearance polygonal area, the polygon must be same or bigger than ...
void PlotFootprintGraphicItem(FP_SHAPE *aShape)
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.
VIATYPE GetViaType() const
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.
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).
bool IsCopperLayer(LAYER_NUM aLayerId)
Tests whether a layer is a copper layer.
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
double GetArcAngleStart() const
virtual void SetLayer(PCB_LAYER_ID aLayer) override
Set the layer this item is on.
class 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 IsOnLayer(PCB_LAYER_ID aLayer) const override
Test to see if this object is on the given layer.
bool GetUseAuxOrigin() const
void SetDefaultPenWidth(int aWidth)
wxPoint GetPosition() const override
DrillMarksType GetDrillMarksType() const
static constexpr int Millimeter2iu(double mm)
int GetArcToSegmentCount(int aRadius, int aErrorMax, double aArcAngleDegree)
wxPoint m_AuxOrigin
origin for plot exports
COLOR4D getColor(LAYER_NUM aLayer)
Function getColor.
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.