Change Zone extra clearance magic number to AC

Rather than keeping a magic number in the code, we set the default in
the advanced config setting and allow users/developers to modify it.
This commit is contained in:
Seth Hillbrand 2020-07-26 07:20:24 -07:00
parent 552dde8976
commit 6900f04ee0
3 changed files with 14 additions and 5 deletions

View File

@ -60,12 +60,12 @@ namespace AC_STACK
*/
namespace AC_KEYS
{
/**
* In Pcbnew, pads can have a fabrication property
* Because this feature adds a new keyword in *.kicad_pcb and *.kicad_modfiles,
* this is an advanced feature until it is fully finalized
* When filling zones, we add an extra amount of clearance to each zone to ensure that rounding
* errors do not overrun minimum clearance distances. This is the extra in mm.
*/
static const wxChar UsePadProperty[] = wxT( "UsePadProperty" );
static const wxChar ExtraFillMargin[] = wxT( "ExtraFillMargin" );
/**
* Testing mode for new connectivity algorithm. Setting this to on will cause all modifications
@ -201,6 +201,9 @@ void ADVANCED_CFG::loadSettings( wxConfigBase& aCfg )
configParams.push_back( new PARAM_CFG_BOOL( true, AC_KEYS::RealtimeConnectivity,
&m_realTimeConnectivity, false ) );
configParams.push_back( new PARAM_CFG_DOUBLE( true, AC_KEYS::ExtraFillMargin,
&m_extraClearance, 0.002, 0.0, 1.0 ) );
configParams.push_back( new PARAM_CFG_INT( true, AC_KEYS::CoroutineStackSize,
&m_coroutineStackSize, AC_STACK::default_stack,
AC_STACK::min_stack, AC_STACK::max_stack ) );

View File

@ -68,6 +68,11 @@ public:
*/
static const ADVANCED_CFG& GetCfg();
/**
* Extra fill clearance for zone fills
*/
double m_extraClearance;
/**
* Do real-time connectivity
*/

View File

@ -27,6 +27,7 @@
#include <algorithm>
#include <future>
#include <advanced_config.h>
#include <class_board.h>
#include <class_zone.h>
#include <class_module.h>
@ -560,7 +561,7 @@ void ZONE_FILLER::buildCopperItemClearances( const ZONE_CONTAINER* aZone, PCB_LA
// than requested clearance due to many approximations in calculations,
// like arc to segment approx, rounding issues...
// 2 microns are a good value
int extra_margin = Millimeter2iu( 0.002 );
int extra_margin = Millimeter2iu( ADVANCED_CFG::GetCfg().m_extraClearance );
BOARD_DESIGN_SETTINGS& bds = m_board->GetDesignSettings();
int zone_clearance = aZone->GetLocalClearance();