@ -821,31 +821,16 @@ void PlotSolderMaskLayer( BOARD *aBoard, PLOTTER* aPlotter, LSET aLayerMask,
if ( aBoard - > GetBoardPolygonOutlines ( buffer ) )
boardOutline = & buffer ;
// We remove 1nm as we expand both sides of the shapes, so allowing for
// a strictly greater than or equal comparison in the shape separation (boolean add)
// means that we will end up with separate shapes that then are shrunk
// We remove 1nm as we expand both sides of the shapes, so allowing for a strictly greater
// than or equal comparison in the shape separation (boolean add)
int inflate = aMinThickness / 2 - 1 ;
BRDITEMS_PLOTTER itemplotter ( aPlotter , aBoard , aPlotOpt ) ;
itemplotter . SetLayerSet ( aLayerMask ) ;
// Plot edge layer and graphic items.
// They do not have a solder Mask margin, because they are graphic items
// on this layer (like logos), not actually areas around pads.
itemplotter . PlotBoardGraphicItems ( ) ;
for ( FOOTPRINT * footprint : aBoard - > Footprints ( ) )
{
itemplotter . PlotFootprintTextItems ( footprint ) ;
for ( BOARD_ITEM * item : footprint - > GraphicalItems ( ) )
{
if ( item - > Type ( ) = = PCB_FP_SHAPE_T & & item - > GetLayer ( ) = = layer )
itemplotter . PlotFootprintGraphicItem ( ( FP_SHAPE * ) item ) ;
}
}
// Build polygons for each pad shape. The size of the shape on solder mask should be size
// of pad + clearance around the pad, where clearance = solder mask clearance + extra margin.
// Extra margin is half the min width for solder mask, which is used to merge too-close shapes
@ -860,13 +845,13 @@ void PlotSolderMaskLayer( BOARD *aBoard, PLOTTER* aPlotter, LSET aLayerMask,
SHAPE_POLY_SET initialPolys ;
# if NEW_ALGO
// Generate polygons with arcs inside the shape or exact shape
// to minimize shape changes created by arc to segment size correction.
// Generate polygons with arcs inside the shape or exact shape to minimize shape changes
// created by arc to segment size correction.
DISABLE_ARC_RADIUS_CORRECTION disabler ;
# endif
{
// Plot pads
for ( FOOTPRINT * footprint : aBoard - > Footprints ( ) )
// Plot footprint pads and graphic s
for ( const FOOTPRINT * footprint : aBoard - > Footprints ( ) )
{
// add shapes with their exact mask layer size in initialPolys
footprint - > TransformPadsWithClearanceToPolygon ( initialPolys , layer , 0 , maxError ,
@ -874,40 +859,41 @@ void PlotSolderMaskLayer( BOARD *aBoard, PLOTTER* aPlotter, LSET aLayerMask,
// add shapes inflated by aMinThickness/2 in areas
footprint - > TransformPadsWithClearanceToPolygon ( areas , layer , inflate , maxError ,
ERROR_OUTSIDE ) ;
}
// Plot vias on solder masks, if aPlotOpt.GetPlotViaOnMaskLayer() is true,
if ( aPlotOpt . GetPlotViaOnMaskLayer ( ) )
{
for ( PCB_TRACK * track : aBoard - > Tracks ( ) )
for ( const BOARD_ITEM * item : footprint - > GraphicalItems ( ) )
{
const PCB_VIA * via = dyn_cast < const PCB_VIA * > ( track ) ;
int via_clearance = via - > GetSolderMaskExpansion ( ) ;
int via_margin = via_clearance + inflate ;
if ( ! via )
continue ;
// vias are plotted only if they are on the corresponding external copper layer
LSET via_set = via - > GetLayerSet ( ) ;
if ( via_set [ B_Cu ] )
via_set . set ( B_Mask ) ;
if ( item - > Type ( ) = = PCB_FP_SHAPE_T & & item - > IsOnLayer ( layer ) )
{
// add shapes with their exact mask layer size in initialPolys
item - > TransformShapeWithClearanceToPolygon ( initialPolys , layer , 0 , maxError ,
ERROR_OUTSIDE ) ;
// add shapes inflated by aMinThickness/2 in areas
item - > TransformShapeWithClearanceToPolygon ( areas , layer , inflate , maxError ,
ERROR_OUTSIDE ) ;
}
else if ( item - > Type ( ) = = PCB_FP_SHAPE_T & & item - > IsOnLayer ( Edge_Cuts ) )
{
itemplotter . PlotFootprintGraphicItem ( static_cast < const FP_SHAPE * > ( item ) ) ;
}
}
}
if ( via_set [ F_Cu ] )
via_set . set ( F_Mask ) ;
// Plot (untented) vias
for ( const PCB_TRACK * track : aBoard - > Tracks ( ) )
{
const PCB_VIA * via = dyn_cast < const PCB_VIA * > ( track ) ;
int clearance = via - > GetSolderMaskExpansion ( ) ;
if ( ! ( via_set & aLayerMask ) . any ( ) )
continue ;
// Note: IsOnLayer() checks relevant mask layers of untented vias
if ( ! via | | ! via - > IsOnLayer ( layer ) )
continue ;
// add shapes with their exact mask layer size in initialPolys
via - > TransformShapeWithClearanceToPolygon ( initialPolys , layer , via_clearance ,
maxError , ERROR_OUTSIDE ) ;
// add shapes inflated by aMinThickness/2 in areas
via - > TransformShapeWithClearanceToPolygon ( areas , layer , via_margin , maxError ,
ERROR_OUTSIDE ) ;
}
// add shapes with their exact mask layer size in initialPolys
via - > TransformShapeWithClearanceToPolygon ( initialPolys , layer , clearance , maxError ,
ERROR_OUTSIDE ) ;
// add shapes inflated by aMinThickness/2 in areas
via - > TransformShapeWithClearanceToPolygon ( areas , layer , clearance + inflate , maxError ,
ERROR_OUTSIDE ) ;
}
// Add filled zone areas.
@ -917,6 +903,23 @@ void PlotSolderMaskLayer( BOARD *aBoard, PLOTTER* aPlotter, LSET aLayerMask,
int zone_margin = 0 ;
# endif
for ( const BOARD_ITEM * item : aBoard - > Drawings ( ) )
{
if ( item - > IsOnLayer ( layer ) )
{
// add shapes with their exact mask layer size in initialPolys
item - > TransformShapeWithClearanceToPolygon ( initialPolys , layer , 0 , maxError ,
ERROR_OUTSIDE ) ;
// add shapes inflated by aMinThickness/2 in areas
item - > TransformShapeWithClearanceToPolygon ( areas , layer , inflate , maxError ,
ERROR_OUTSIDE ) ;
}
else if ( item - > IsOnLayer ( Edge_Cuts ) )
{
itemplotter . PlotPcbGraphicItem ( item ) ;
}
}
for ( ZONE * zone : aBoard - > Zones ( ) )
{
if ( ! zone - > IsOnLayer ( layer ) )