KiCad PCB EDA Suite
ADVANCED_CFG Class Reference

Class containing "advanced" configuration options. More...

#include <advanced_config.h>

Static Public Member Functions

static const ADVANCED_CFGGetCfg ()
 Get the singleton instance's config, which is shared by all consumers. More...
 

Public Attributes

double m_DrawArcAccuracy
 Distance from an arc end point and the estimated end point, when rotating from the start point to the end point. More...
 
double m_DrawArcCenterMaxAngle
 When drawing an arc, the angle ( center - start ) - ( start - end ) can be limited to avoid extremely high radii. More...
 
double m_ExtraClearance
 Extra fill clearance for zone fills. More...
 
double m_DRCEpsilon
 Epsilon for DRC tests. More...
 
double m_HoleWallThickness
 Hole wall plating thickness. More...
 
bool m_RealTimeConnectivity
 Do real-time connectivity. More...
 
int m_CoroutineStackSize
 Set the stack size for coroutines. More...
 
bool m_ShowRouterDebugGraphics
 Show PNS router debug graphics. More...
 
bool m_CompactSave
 Save files in compact display mode When is is not specified, points are written one per line. More...
 
bool m_DrawTriangulationOutlines
 When true, strokes the triangulations with visible color. More...
 
bool m_PluginAltiumSch
 When true, enable Altium Schematic import (*.SchDoc) the current implementation is highly incomplete. More...
 
double m_MinPlotPenWidth
 Sets an absolute minimum pen width for plotting. More...
 
bool m_DebugZoneFiller
 A mode that dumps the various stages of a F_Cu fill into In1_Cu through In9_Cu. More...
 
bool m_DebugPDFWriter
 A mode that writes PDFs without compression. More...
 
bool m_SkipBoundingBoxOnFpLoad
 Skip bounding box calculation when loading footprints. More...
 

Private Member Functions

 ADVANCED_CFG ()
 
void loadFromConfigFile ()
 Load the config from the normal config file. More...
 
void loadSettings (wxConfigBase &aCfg)
 

Detailed Description

Class containing "advanced" configuration options.

Options set here are for developer or advanced users only. If a general user needs to set one of these for normal KiCad use, either:

  • They are working around some bug that should be fixed, or
  • The parameter they are setting is of general interest and should be in the main application config, with UI provided.

Options in this class are, in general, preferable to #defines, as they allow more flexible configuration by developers, and don't hide code from the compiler on other configurations, which can result in broken builds.

Never use advanced configs in an untestable way. If a function depends on advanced config such that you cannot test it without changing the config, "lift" the config to a higher level and make pass it as parameter of the code under test. The tests can pass their own values as needed.

This also applies to code that does not depend on "common" - it cannot use this class, so you must pass configuration in as proper parameters.

Sometimes you can just use values directly, and sometimes helper functions might be provided to allow extra logic (for example when a advanced config applies only on certain platforms).

For more information on what config keys set these parameters in the config files, and why you might want to set them, see AC_KEYS

Definition at line 58 of file advanced_config.h.

Constructor & Destructor Documentation

◆ ADVANCED_CFG()

ADVANCED_CFG::ADVANCED_CFG ( )
private

Definition at line 217 of file advanced_config.cpp.

218 {
219  wxLogTrace( AdvancedConfigMask, "Init advanced config" );
220 
221  // Init defaults - this is done in case the config doesn't exist,
222  // then the values will remain as set here.
223  m_RealTimeConnectivity = true;
226  m_DrawArcAccuracy = 10.0;
229  m_PluginAltiumSch = false;
230 
231  m_ExtraClearance = 0.0001;
232  m_DRCEpsilon = 0.0001; // 0.1um is small enough not to materially violate
233  // any constraints.
234 
235  m_HoleWallThickness = 0.020; // IPC-6012 says 15-18um; Cadence says at least
236  // 0.020 for a Class 2 board and at least 0.025
237  // for Class 3.
238 
239  m_MinPlotPenWidth = 0.0212; // 1 pixel at 1200dpi.
240 
241  m_DebugZoneFiller = false;
242  m_DebugPDFWriter = false;
243 
245 
247 }
bool m_SkipBoundingBoxOnFpLoad
Skip bounding box calculation when loading footprints.
bool m_PluginAltiumSch
When true, enable Altium Schematic import (*.SchDoc) the current implementation is highly incomplete.
bool m_DrawTriangulationOutlines
When true, strokes the triangulations with visible color.
double m_DrawArcCenterMaxAngle
When drawing an arc, the angle ( center - start ) - ( start - end ) can be limited to avoid extremely...
double m_DrawArcAccuracy
Distance from an arc end point and the estimated end point, when rotating from the start point to the...
bool m_ShowRouterDebugGraphics
Show PNS router debug graphics.
void loadFromConfigFile()
Load the config from the normal config file.
double m_ExtraClearance
Extra fill clearance for zone fills.
double m_DRCEpsilon
Epsilon for DRC tests.
double m_MinPlotPenWidth
Sets an absolute minimum pen width for plotting.
int m_CoroutineStackSize
Set the stack size for coroutines.
bool m_DebugPDFWriter
A mode that writes PDFs without compression.
static constexpr int default_stack
bool m_RealTimeConnectivity
Do real-time connectivity.
bool m_DebugZoneFiller
A mode that dumps the various stages of a F_Cu fill into In1_Cu through In9_Cu.
static const wxChar AdvancedConfigMask[]
double m_HoleWallThickness
Hole wall plating thickness.

References AdvancedConfigMask, AC_STACK::default_stack, loadFromConfigFile(), m_CoroutineStackSize, m_DebugPDFWriter, m_DebugZoneFiller, m_DrawArcAccuracy, m_DrawArcCenterMaxAngle, m_DrawTriangulationOutlines, m_DRCEpsilon, m_ExtraClearance, m_HoleWallThickness, m_MinPlotPenWidth, m_PluginAltiumSch, m_RealTimeConnectivity, m_ShowRouterDebugGraphics, and m_SkipBoundingBoxOnFpLoad.

Member Function Documentation

◆ GetCfg()

◆ loadFromConfigFile()

void ADVANCED_CFG::loadFromConfigFile ( )
private

Load the config from the normal config file.

Definition at line 257 of file advanced_config.cpp.

258 {
259  const wxFileName k_advanced = getAdvancedCfgFilename();
260 
261  if( !k_advanced.FileExists() )
262  {
263  wxLogTrace( AdvancedConfigMask, "File does not exist %s", k_advanced.GetFullPath() );
264 
265  // load the defaults
266  wxConfig emptyConfig;
267  loadSettings( emptyConfig );
268 
269  return;
270  }
271 
272  wxLogTrace( AdvancedConfigMask, "Loading advanced config from: %s", k_advanced.GetFullPath() );
273 
274  wxFileConfig file_cfg( "", "", k_advanced.GetFullPath() );
275  loadSettings( file_cfg );
276 }
void loadSettings(wxConfigBase &aCfg)
static wxFileName getAdvancedCfgFilename()
Get the filename for the advanced config file.
static const wxChar AdvancedConfigMask[]

References AdvancedConfigMask, getAdvancedCfgFilename(), and loadSettings().

Referenced by ADVANCED_CFG().

◆ loadSettings()

void ADVANCED_CFG::loadSettings ( wxConfigBase &  aCfg)
private

Definition at line 279 of file advanced_config.cpp.

280 {
281  std::vector<PARAM_CFG*> configParams;
282 
283  configParams.push_back( new PARAM_CFG_BOOL( true, AC_KEYS::RealtimeConnectivity,
284  &m_RealTimeConnectivity, true ) );
285 
286  configParams.push_back( new PARAM_CFG_DOUBLE( true, AC_KEYS::ExtraFillMargin,
287  &m_ExtraClearance, 0.0005, 0.0, 1.0 ) );
288 
289  configParams.push_back( new PARAM_CFG_DOUBLE( true, AC_KEYS::DRCEpsilon,
290  &m_DRCEpsilon, 0.0005, 0.0, 1.0 ) );
291 
292  configParams.push_back( new PARAM_CFG_DOUBLE( true, AC_KEYS::HoleWallThickness,
293  &m_HoleWallThickness, 0.020, 0.0, 1.0 ) );
294 
295  configParams.push_back( new PARAM_CFG_INT( true, AC_KEYS::CoroutineStackSize,
298 
299  configParams.push_back( new PARAM_CFG_BOOL( true, AC_KEYS::ShowRouterDebugGraphics,
300  &m_ShowRouterDebugGraphics, false ) );
301 
302  configParams.push_back( new PARAM_CFG_BOOL( true, AC_KEYS::CompactFileSave,
303  &m_CompactSave, false ) );
304 
305  configParams.push_back( new PARAM_CFG_DOUBLE( true, AC_KEYS::DrawArcAccuracy,
306  &m_DrawArcAccuracy, 10.0, 0.0, 100000.0 ) );
307 
308  configParams.push_back( new PARAM_CFG_DOUBLE( true, AC_KEYS::DrawArcCenterStartEndMaxAngle,
309  &m_DrawArcCenterMaxAngle, 50.0, 0.0, 100000.0 ) );
310 
311  configParams.push_back( new PARAM_CFG_BOOL( true, AC_KEYS::StrokeTriangulation,
312  &m_DrawTriangulationOutlines, false ) );
313 
314  configParams.push_back( new PARAM_CFG_BOOL( true, AC_KEYS::PluginAltiumSch,
315  &m_PluginAltiumSch, false ) );
316 
317  configParams.push_back( new PARAM_CFG_DOUBLE( true, AC_KEYS::MinPlotPenWidth,
318  &m_MinPlotPenWidth, 0.0212, 0.0, 1.0 ) );
319 
320  configParams.push_back( new PARAM_CFG_BOOL( true, AC_KEYS::DebugZoneFiller,
321  &m_DebugZoneFiller, false ) );
322 
323  configParams.push_back( new PARAM_CFG_BOOL( true, AC_KEYS::DebugPDFWriter,
324  &m_DebugPDFWriter, false ) );
325 
326  configParams.push_back( new PARAM_CFG_BOOL( true, AC_KEYS::SkipBoundingBoxFpLoad,
327  &m_SkipBoundingBoxOnFpLoad, false ) );
328 
329  wxConfigLoadSetups( &aCfg, configParams );
330 
331  for( PARAM_CFG* param : configParams )
332  delete param;
333 
334  dumpCfg( configParams );
335 }
bool m_CompactSave
Save files in compact display mode When is is not specified, points are written one per line.
bool m_SkipBoundingBoxOnFpLoad
Skip bounding box calculation when loading footprints.
bool m_PluginAltiumSch
When true, enable Altium Schematic import (*.SchDoc) the current implementation is highly incomplete.
void wxConfigLoadSetups(wxConfigBase *aCfg, const std::vector< PARAM_CFG * > &aList)
Function wxConfigLoadSetups uses aList of PARAM_CFG to load configuration values from aCfg.
static const wxChar DrawArcAccuracy[]
For drawsegments - arcs.
static const wxChar HoleWallThickness[]
Used to calculate the actual hole size from the finish hole size.
Configuration parameter - Double Precision Class.
bool m_DrawTriangulationOutlines
When true, strokes the triangulations with visible color.
double m_DrawArcCenterMaxAngle
When drawing an arc, the angle ( center - start ) - ( start - end ) can be limited to avoid extremely...
static const wxChar DrawArcCenterStartEndMaxAngle[]
For drawsegments - arcs.
double m_DrawArcAccuracy
Distance from an arc end point and the estimated end point, when rotating from the start point to the...
bool m_ShowRouterDebugGraphics
Show PNS router debug graphics.
static const wxChar RealtimeConnectivity[]
Testing mode for new connectivity algorithm.
static const wxChar DRCEpsilon[]
A fudge factor for DRC.
static const wxChar DebugPDFWriter[]
static void dumpCfg(const std::vector< PARAM_CFG * > &aArray)
Dump the configs in the given array to trace.
Configuration parameter - Integer Class.
Configuration parameter - Boolean Class.
static const wxChar SkipBoundingBoxFpLoad[]
double m_ExtraClearance
Extra fill clearance for zone fills.
double m_DRCEpsilon
Epsilon for DRC tests.
double m_MinPlotPenWidth
Sets an absolute minimum pen width for plotting.
static const wxChar MinPlotPenWidth[]
Absolute minimum pen width to send to the plotter.
int m_CoroutineStackSize
Set the stack size for coroutines.
bool m_DebugPDFWriter
A mode that writes PDFs without compression.
PARAM_CFG is a base class which establishes the interface functions ReadParam and SaveParam,...
Definition: config_params.h:85
static const wxChar CoroutineStackSize[]
Configure the coroutine stack size in bytes.
static constexpr int default_stack
static const wxChar StrokeTriangulation[]
When true, GAL will stroke the triangulations (only used in OpenGL) with a visible color.
static const wxChar DebugZoneFiller[]
static const wxChar PluginAltiumSch[]
When true, enable Altium Schematic import (*.SchDoc)
static constexpr int max_stack
static const wxChar ShowRouterDebugGraphics[]
Show PNS router debug graphics while routing.
bool m_RealTimeConnectivity
Do real-time connectivity.
bool m_DebugZoneFiller
A mode that dumps the various stages of a F_Cu fill into In1_Cu through In9_Cu.
static const wxChar CompactFileSave[]
When set to true, this will wrap polygon point sets at 4 points per line rather than a single point p...
static constexpr int min_stack
static const wxChar ExtraFillMargin[]
When filling zones, we add an extra amount of clearance to each zone to ensure that rounding errors d...
double m_HoleWallThickness
Hole wall plating thickness.

References AC_KEYS::CompactFileSave, AC_KEYS::CoroutineStackSize, AC_KEYS::DebugPDFWriter, AC_KEYS::DebugZoneFiller, AC_STACK::default_stack, AC_KEYS::DrawArcAccuracy, AC_KEYS::DrawArcCenterStartEndMaxAngle, AC_KEYS::DRCEpsilon, dumpCfg(), AC_KEYS::ExtraFillMargin, AC_KEYS::HoleWallThickness, m_CompactSave, m_CoroutineStackSize, m_DebugPDFWriter, m_DebugZoneFiller, m_DrawArcAccuracy, m_DrawArcCenterMaxAngle, m_DrawTriangulationOutlines, m_DRCEpsilon, m_ExtraClearance, m_HoleWallThickness, m_MinPlotPenWidth, m_PluginAltiumSch, m_RealTimeConnectivity, m_ShowRouterDebugGraphics, m_SkipBoundingBoxOnFpLoad, AC_STACK::max_stack, AC_STACK::min_stack, AC_KEYS::MinPlotPenWidth, AC_KEYS::PluginAltiumSch, AC_KEYS::RealtimeConnectivity, AC_KEYS::ShowRouterDebugGraphics, AC_KEYS::SkipBoundingBoxFpLoad, AC_KEYS::StrokeTriangulation, and wxConfigLoadSetups().

Referenced by loadFromConfigFile().

Member Data Documentation

◆ m_CompactSave

bool ADVANCED_CFG::m_CompactSave

Save files in compact display mode When is is not specified, points are written one per line.

Definition at line 118 of file advanced_config.h.

Referenced by PCB_IO::format(), loadSettings(), and SCH_SEXPR_PLUGIN_CACHE::savePolyLine().

◆ m_CoroutineStackSize

int ADVANCED_CFG::m_CoroutineStackSize

Set the stack size for coroutines.

Definition at line 107 of file advanced_config.h.

Referenced by ADVANCED_CFG(), COROUTINE< int, const TOOL_EVENT & >::COROUTINE(), and loadSettings().

◆ m_DebugPDFWriter

bool ADVANCED_CFG::m_DebugPDFWriter

A mode that writes PDFs without compression.

Definition at line 145 of file advanced_config.h.

Referenced by ADVANCED_CFG(), and loadSettings().

◆ m_DebugZoneFiller

bool ADVANCED_CFG::m_DebugZoneFiller

A mode that dumps the various stages of a F_Cu fill into In1_Cu through In9_Cu.

Definition at line 140 of file advanced_config.h.

Referenced by ADVANCED_CFG(), loadSettings(), and ZONE_FILLER::ZONE_FILLER().

◆ m_DrawArcAccuracy

double ADVANCED_CFG::m_DrawArcAccuracy

Distance from an arc end point and the estimated end point, when rotating from the start point to the end point.

Definition at line 73 of file advanced_config.h.

Referenced by ADVANCED_CFG(), POINT_EDITOR::editArcMidKeepEnpoints(), and loadSettings().

◆ m_DrawArcCenterMaxAngle

double ADVANCED_CFG::m_DrawArcCenterMaxAngle

When drawing an arc, the angle ( center - start ) - ( start - end ) can be limited to avoid extremely high radii.

Definition at line 79 of file advanced_config.h.

Referenced by ADVANCED_CFG(), POINT_EDITOR::editArcEndpointKeepTangent(), and loadSettings().

◆ m_DrawTriangulationOutlines

bool ADVANCED_CFG::m_DrawTriangulationOutlines

When true, strokes the triangulations with visible color.

Definition at line 123 of file advanced_config.h.

Referenced by ADVANCED_CFG(), and loadSettings().

◆ m_DRCEpsilon

double ADVANCED_CFG::m_DRCEpsilon

Epsilon for DRC tests.

Note that for zone tests this is essentially additive with m_extraClearance. Units are mm.

Definition at line 91 of file advanced_config.h.

Referenced by ADVANCED_CFG(), and loadSettings().

◆ m_ExtraClearance

double ADVANCED_CFG::m_ExtraClearance

Extra fill clearance for zone fills.

Note that for zone tests this is essentially additive with m_DRCEpsilon. Units are mm.

Definition at line 85 of file advanced_config.h.

Referenced by ADVANCED_CFG(), and loadSettings().

◆ m_HoleWallThickness

double ADVANCED_CFG::m_HoleWallThickness

Hole wall plating thickness.

Used to determine actual hole size from finish hole size. Units are mm.

Definition at line 97 of file advanced_config.h.

Referenced by ADVANCED_CFG(), and loadSettings().

◆ m_MinPlotPenWidth

double ADVANCED_CFG::m_MinPlotPenWidth

Sets an absolute minimum pen width for plotting.

Some formats (PDF, for example) don't like ultra-thin lines. Units are mm.

Definition at line 135 of file advanced_config.h.

Referenced by ADVANCED_CFG(), loadSettings(), and KIGFX::SCH_RENDER_SETTINGS::SCH_RENDER_SETTINGS().

◆ m_PluginAltiumSch

bool ADVANCED_CFG::m_PluginAltiumSch

When true, enable Altium Schematic import (*.SchDoc) the current implementation is highly incomplete.

Definition at line 129 of file advanced_config.h.

Referenced by ADVANCED_CFG(), and loadSettings().

◆ m_RealTimeConnectivity

bool ADVANCED_CFG::m_RealTimeConnectivity

Do real-time connectivity.

Definition at line 102 of file advanced_config.h.

Referenced by ADVANCED_CFG(), SCH_EDITOR_CONTROL::AssignNetclass(), and loadSettings().

◆ m_ShowRouterDebugGraphics

bool ADVANCED_CFG::m_ShowRouterDebugGraphics

Show PNS router debug graphics.

Definition at line 112 of file advanced_config.h.

Referenced by ADVANCED_CFG(), and loadSettings().

◆ m_SkipBoundingBoxOnFpLoad

bool ADVANCED_CFG::m_SkipBoundingBoxOnFpLoad

Skip bounding box calculation when loading footprints.

Definition at line 150 of file advanced_config.h.

Referenced by ADVANCED_CFG(), and loadSettings().


The documentation for this class was generated from the following files: