diff --git a/pcbnew/board_items_to_polygon_shape_transform.cpp b/pcbnew/board_items_to_polygon_shape_transform.cpp index 2207abfb32..6fd68988d5 100644 --- a/pcbnew/board_items_to_polygon_shape_transform.cpp +++ b/pcbnew/board_items_to_polygon_shape_transform.cpp @@ -1,8 +1,8 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 2009-2018 Jean-Pierre Charras, jp.charras at wanadoo.fr - * Copyright (C) 1992-2019 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2009-2021 Jean-Pierre Charras, jp.charras at wanadoo.fr + * Copyright (C) 1992-2021 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -731,7 +731,7 @@ void PAD::TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer, case PAD_SHAPE_CUSTOM: { SHAPE_POLY_SET outline; - MergePrimitivesAsPolygon( &outline, aLayer ); + MergePrimitivesAsPolygon( &outline, aLayer, aErrorLoc ); outline.Rotate( -DECIDEG2RAD( m_orient ) ); outline.Move( VECTOR2I( m_pos ) ); diff --git a/pcbnew/pad.h b/pcbnew/pad.h index ee79b7d9e5..b74167ee6b 100644 --- a/pcbnew/pad.h +++ b/pcbnew/pad.h @@ -279,8 +279,16 @@ public: * Merge all basic shapes to a #SHAPE_POLY_SET. * * @note The results are relative to the pad position, orientation 0. + * + * @param aMergedPolygon will store the final polygon + * @param aLayer is the layer to take in account, as the exact shape can depend on the layer + * @param aErrorLoc is used when a circle (or arc) is approximated by segments + * = ERROR_INSIDE to build a polygon inside the arc/circle (usual shape to raw/plot) + * = ERROR_OUIDE to build a polygon outside the arc/circle + * (for instance when building a clearance area) */ - void MergePrimitivesAsPolygon( SHAPE_POLY_SET* aMergedPolygon, PCB_LAYER_ID aLayer ) const; + void MergePrimitivesAsPolygon( SHAPE_POLY_SET* aMergedPolygon, PCB_LAYER_ID aLayer, + ERROR_LOC aErrorLoc = ERROR_INSIDE ) const; /** * Clear the basic shapes list. diff --git a/pcbnew/pad_custom_shape_functions.cpp b/pcbnew/pad_custom_shape_functions.cpp index 6747f5bbc1..eb7f8a71a6 100644 --- a/pcbnew/pad_custom_shape_functions.cpp +++ b/pcbnew/pad_custom_shape_functions.cpp @@ -200,7 +200,8 @@ void PAD::addPadPrimitivesToPolygon( SHAPE_POLY_SET* aMergedPolygon, PCB_LAYER_I } } -void PAD::MergePrimitivesAsPolygon( SHAPE_POLY_SET* aMergedPolygon, PCB_LAYER_ID aLayer ) const +void PAD::MergePrimitivesAsPolygon( SHAPE_POLY_SET* aMergedPolygon, PCB_LAYER_ID aLayer, + ERROR_LOC aErrorLoc ) const { BOARD* board = GetBoard(); int maxError = board ? board->GetDesignSettings().m_MaxError: ARC_HIGH_DEF; @@ -225,7 +226,7 @@ void PAD::MergePrimitivesAsPolygon( SHAPE_POLY_SET* aMergedPolygon, PCB_LAYER_ID break; } - addPadPrimitivesToPolygon( aMergedPolygon, aLayer, maxError, ERROR_INSIDE ); + addPadPrimitivesToPolygon( aMergedPolygon, aLayer, maxError, aErrorLoc ); }