52 m_NetSettings = std::make_shared<NET_SETTINGS>(
nullptr,
"" );
293 [&]() -> nlohmann::json
295 nlohmann::json ret = {};
299 wxString
name = item.GetSettingsKey();
300 int code = item.GetErrorCode();
310 [&](
const nlohmann::json& aJson )
312 if( !aJson.is_object() )
317 wxString name = item.GetSettingsKey();
318 std::string key( name.ToUTF8() );
320 if( aJson.contains( key ) )
321 m_DRCSeverities[item.GetErrorCode()] = SeverityFromString( aJson[key] );
326 [&]() -> nlohmann::json
328 nlohmann::json js = nlohmann::json::array();
331 js.push_back( entry );
335 [&](
const nlohmann::json& aObj )
339 if( !aObj.is_array() )
342 for(
const nlohmann::json& entry : aObj )
353 [&]() -> nlohmann::json
355 nlohmann::json js = nlohmann::json::array();
362 [&](
const nlohmann::json& aJson )
364 if( !aJson.is_array() )
369 for(
const nlohmann::json& entry : aJson )
380 [&]() -> nlohmann::json
382 nlohmann::json js = nlohmann::json::array();
386 nlohmann::json entry = {};
391 js.push_back( entry );
396 [&](
const nlohmann::json& aObj )
398 if( !aObj.is_array() )
403 for(
const nlohmann::json& entry : aObj )
405 if( entry.empty() || !entry.is_object() )
408 if( !entry.contains(
"diameter" ) || !entry.contains(
"drill" ) )
420 [&]() -> nlohmann::json
422 nlohmann::json js = nlohmann::json::array();
426 nlohmann::json entry = {};
432 js.push_back( entry );
437 [&](
const nlohmann::json& aObj )
439 if( !aObj.is_array() )
444 for(
const nlohmann::json& entry : aObj )
446 if( entry.empty() || !entry.is_object() )
449 if( !entry.contains(
"width" ) || !entry.contains(
"gap" )
450 || !entry.contains(
"via_gap" ) )
465 [&]() -> nlohmann::json
467 nlohmann::json js = nlohmann::json::array();
468 nlohmann::json entry = {};
475 js.push_back( entry );
479 [&](
const nlohmann::json& aObj )
481 if( !aObj.is_array() )
484 for(
const nlohmann::json& entry : aObj )
486 if( entry.empty() || !entry.is_object() )
489 if( entry.contains(
"td_onviapad" ) )
492 if( entry.contains(
"td_onpadsmd" ) )
495 if( entry.contains(
"td_ontrackend" ) )
498 if( entry.contains(
"td_onroundshapesonly" ) )
502 for(
int ii = 0; ii < 3; ++ii )
506 if( entry.contains(
"td_allow_use_two_tracks" ) )
509 if( entry.contains(
"td_curve_segcount" ) )
512 if( entry.contains(
"td_on_pad_in_zone" ) )
521 [&]() -> nlohmann::json
523 nlohmann::json js = nlohmann::json::array();
527 nlohmann::json entry = {};
541 js.push_back( entry );
546 [&](
const nlohmann::json& aObj )
548 if( !aObj.is_array() )
551 for(
const nlohmann::json& entry : aObj )
553 if( entry.empty() || !entry.is_object() )
556 if( !entry.contains(
"td_target_name" ) )
561 if( idx >= 0 && idx < 3 )
565 if( entry.contains(
"td_maxlen" ) )
568 if( entry.contains(
"td_maxheight" ) )
571 if( entry.contains(
"td_length_ratio" ) )
574 if( entry.contains(
"td_height_ratio" ) )
577 if( entry.contains(
"td_curve_segcount" ) )
580 if( entry.contains(
"td_width_to_size_filter_ratio" ) )
583 if( entry.contains(
"td_allow_use_two_tracks" ) )
586 if( entry.contains(
"td_curve_segcount" ) )
589 if( entry.contains(
"td_on_pad_in_zone" ) )
694 DIM_UNITS_MODE::AUTOMATIC ) );
701 DIM_UNITS_FORMAT::PAREN_SUFFIX ) );
709 DIM_TEXT_POSITION::INLINE ) );
727 [&]() -> nlohmann::json
738 [&](
const nlohmann::json& aJson )
740 if( aJson.contains(
"width" ) && aJson.contains(
"height" )
741 && aJson.contains(
"drill" ) )
773 if( std::optional<double> optval = Get<double>(
"rules.solder_mask_clearance" ) )
776 if( std::optional<double> optval = Get<double>(
"rules.solder_mask_min_width" ) )
779 if( std::optional<double> optval = Get<double>(
"rules.solder_paste_clearance" ) )
782 if( std::optional<double> optval = Get<double>(
"rules.solder_paste_margin_ratio" ) )
787 At(
"rules" ).erase(
"solder_mask_clearance" );
788 At(
"rules" ).erase(
"solder_mask_min_width" );
789 At(
"rules" ).erase(
"solder_paste_clearance" );
790 At(
"rules" ).erase(
"solder_paste_margin_ratio" );
813 m_Pad_Master( nullptr )
926 std::string units_ptr(
"defaults.dimension_units" );
927 std::string precision_ptr(
"defaults.dimension_precision" );
930 At( units_ptr ).is_number_integer() &&
931 At( precision_ptr ).is_number_integer() ) )
937 int units = *Get<int>( units_ptr );
938 int precision = *Get<int>( precision_ptr );
945 case 0: extraDigits = 3;
break;
946 case 2: extraDigits = 2;
break;
950 precision += extraDigits;
952 Set( precision_ptr, precision );
971 bool migrated =
false;
974 [](
int aCode ) -> std::string
977 wxString
name = item->GetSettingsKey();
978 return std::string(
name.ToUTF8() );
981 const std::string rs =
"rule_severities.";
982 const std::string no_courtyard_key =
"legacy_no_courtyard_defined";
983 const std::string courtyard_overlap_key =
"legacy_courtyards_overlap";
987 nlohmann::json& severities =
988 project->Internals()->at(
"/board/design_settings/rule_severities"_json_pointer );
990 if( severities.contains( no_courtyard_key ) )
992 if( severities[no_courtyard_key].get<bool>() )
997 severities.erase( no_courtyard_key );
1001 if( severities.contains( courtyard_overlap_key ) )
1003 if( severities[courtyard_overlap_key].get<bool>() )
1008 severities.erase( courtyard_overlap_key );
1021 project->At(
"legacy" ).erase(
"pcbnew" );
1052 biggest = std::max( biggest, constraint.
Value().
Min() );
1055 biggest = std::max( biggest, constraint.
Value().
Min() );
1058 biggest = std::max( biggest, constraint.
Value().
Min() );
1061 biggest = std::max( biggest, constraint.
Value().
Min() );
1070 int clearance =
m_NetSettings->m_DefaultNetClass->GetClearance();
1073 clearance = std::min( clearance, netclass->GetClearance() );
1108 return drill > 0 ? drill : -1;
1151 return m_NetSettings->m_DefaultNetClass->GetDiffPairWidth();
1191 return m_NetSettings->m_DefaultNetClass->GetDiffPairViaGap();
1209 if( aNewLayerCount > 0 )
1238 else if( aLayer ==
F_Fab || aLayer ==
B_Fab )
constexpr int ARC_HIGH_DEF
constexpr EDA_IU_SCALE pcbIUScale
const int bdsSchemaVersion
#define DEFAULT_MICROVIASMINDRILL
#define DEFAULT_SOLDERPASTE_CLEARANCE
#define DEFAULT_SOLDERPASTE_RATIO
#define DEFAULT_CUSTOMDPAIRWIDTH
#define DEFAULT_VIASMINSIZE
#define DEFAULT_TEXT_WIDTH
#define DEFAULT_COPPER_TEXT_WIDTH
#define DEFAULT_CUSTOMDPAIRGAP
#define DEFAULT_MINCLEARANCE
#define DEFAULT_HOLECLEARANCE
#define DEFAULT_SOLDERMASK_EXPANSION
#define LEGACY_COPPEREDGECLEARANCE
#define DEFAULT_SOLDERMASK_MIN_WIDTH
#define DEFAULT_DIMENSION_EXTENSION_OFFSET
#define DEFAULT_COPPEREDGECLEARANCE
#define DEFAULT_DIMENSION_ARROW_LENGTH
#define DEFAULT_TRACKMINWIDTH
#define DEFAULT_MINTHROUGHDRILL
#define DEFAULT_SILK_TEXT_SIZE
#define DEFAULT_HOLETOHOLEMIN
#define DEFAULT_MINCONNECTION
#define DEFAULT_COPPER_LINE_WIDTH
#define DEFAULT_SILK_LINE_WIDTH
#define DEFAULT_SILKCLEARANCE
#define DEFAULT_MICROVIASMINSIZE
#define DEFAULT_SILK_TEXT_WIDTH
#define DEFAULT_TEXT_SIZE
#define DEFAULT_EDGE_WIDTH
#define DEFAULT_CUSTOMTRACKWIDTH
#define DEFAULT_CUSTOMDPAIRVIAGAP
#define DEFAULT_COPPER_TEXT_SIZE
#define DEFAULT_SOLDERMASK_TO_COPPER_CLEARANCE
#define DEFAULT_LINE_WIDTH
#define DEFAULT_COURTYARD_WIDTH
#define DEFAULT_BOARD_THICKNESS_MM
#define DEFAULT_MINRESOLVEDSPOKES
static const ADVANCED_CFG & GetCfg()
Get the singleton instance's config, which is shared by all consumers.
Container for design settings for a BOARD object.
DIM_PRECISION m_DimensionPrecision
Number of digits after the decimal.
std::vector< TEXT_ITEM_INFO > m_DefaultFPTextItems
int GetHolePlatingThickness() const
Pad & via drills are finish size.
VIATYPE m_CurrentViaType
(VIA_BLIND_BURIED, VIA_THROUGH, VIA_MICROVIA)
void SetDiffPairIndex(unsigned aIndex)
std::shared_ptr< NET_SETTINGS > m_NetSettings
DIM_UNITS_FORMAT m_DimensionUnitsFormat
void initFromOther(const BOARD_DESIGN_SETTINGS &aOther)
int m_CopperEdgeClearance
bool GetTextUpright(PCB_LAYER_ID aLayer) const
std::map< int, SEVERITY > m_DRCSeverities
VECTOR2I m_gridOrigin
origin for grid offsets
int GetTextThickness(PCB_LAYER_ID aLayer) const
Return the default text thickness from the layer class for the given layer.
VECTOR2I m_auxOrigin
origin for plot exports
bool m_TextUpright[LAYER_CLASS_COUNT]
BOARD_DESIGN_SETTINGS(JSON_SETTINGS *aParent, const std::string &aPath)
bool GetTextItalic(PCB_LAYER_ID aLayer) const
int m_MinSilkTextThickness
int GetCurrentViaSize() const
wxString m_currentNetClassName
Current net class name used to display netclass info.
std::shared_ptr< DRC_ENGINE > m_DRCEngine
bool m_UseConnectedTrackWidth
virtual ~BOARD_DESIGN_SETTINGS()
void SetEnabledLayers(LSET aMask)
Change the bit-mask of enabled layers to aMask.
std::vector< DIFF_PAIR_DIMENSION > m_DiffPairDimensionsList
VIA_DIMENSION m_customViaSize
std::set< wxString > m_DrcExclusions
bool Ignore(int aDRCErrorCode)
Return true if the DRC error code's severity is SEVERITY_IGNORE.
int m_SolderMaskToCopperClearance
unsigned m_trackWidthIndex
bool m_TempOverrideTrackWidth
int GetSmallestClearanceValue() const
bool m_AllowSoldermaskBridgesInFPs
std::unique_ptr< PAD > m_Pad_Master
bool m_DimensionSuppressZeroes
void SetTrackWidthIndex(unsigned aIndex)
Set the current track width list index to aIndex.
TEARDROP_PARAMETERS_LIST m_TeardropParamsList
The parameters of teardrops for the different teardrop targets (via/pad, track end) 3 set of paramete...
int GetCurrentDiffPairWidth() const
void SetViaSizeIndex(unsigned aIndex)
Set the current via size list index to aIndex.
int GetCurrentDiffPairViaGap() const
int GetCurrentDiffPairGap() const
int m_SolderMaskExpansion
int GetDRCEpsilon() const
int GetBiggestClearanceValue() const
int GetLayerClass(PCB_LAYER_ID aLayer) const
int GetCurrentTrackWidth() const
int m_boardThickness
Board thickness for 3D viewer.
int m_copperLayerCount
Number of copper layers for this design.
bool LoadFromFile(const wxString &aDirectory="") override
Loads the backing file from disk and then calls Load()
int m_TextThickness[LAYER_CLASS_COUNT]
ZONE_SETTINGS m_defaultZoneSettings
The default settings that will be used for new zones.
SEVERITY GetSeverity(int aDRCErrorCode)
std::vector< int > m_TrackWidthList
DIFF_PAIR_DIMENSION m_customDiffPair
int m_LineThickness[LAYER_CLASS_COUNT]
bool m_DimensionKeepTextAligned
VECTOR2I GetTextSize(PCB_LAYER_ID aLayer) const
Return the default text size from the layer class for the given layer.
double m_SolderPasteMarginRatio
int GetLineThickness(PCB_LAYER_ID aLayer) const
Return the default graphic segment thickness from the layer class for the given layer.
bool m_UseHeightForLengthCalcs
Enable inclusion of stackup height in track length measurements and length tuning.
int GetCurrentViaDrill() const
VECTOR2I m_TextSize[LAYER_CLASS_COUNT]
LSET m_enabledLayers
Bit-mask for layer enabling.
bool m_TextItalic[LAYER_CLASS_COUNT]
void SetCopperLayerCount(int aNewLayerCount)
Set the copper layer count to aNewLayerCount.
DIM_TEXT_POSITION m_DimensionTextPosition
BOARD_STACKUP m_stackup
the description of layers stackup, for board fabrication only physical layers are in layers stackup.
bool m_ZoneKeepExternalFillets
DIM_UNITS_MODE m_DimensionUnitsMode
std::vector< VIA_DIMENSION > m_ViasDimensionsList
int m_ViasMinAnnularWidth
BOARD_DESIGN_SETTINGS & operator=(const BOARD_DESIGN_SETTINGS &aOther)
int m_DimensionExtensionOffset
int m_DimensionArrowLength
MINOPTMAX< int > & Value()
static std::vector< std::reference_wrapper< RC_ITEM > > GetItemsWithSeverities()
static std::shared_ptr< DRC_ITEM > Create(int aErrorCode)
Constructs a DRC_ITEM for the given error code.
bool Contains(const std::string &aPath) const
virtual void Load()
Updates the parameters of this object based on the current JSON document contents.
std::vector< PARAM_BASE * > m_params
The list of parameters (owned by this object)
void registerMigration(int aOldSchemaVersion, int aNewSchemaVersion, std::function< bool(void)> aMigrator)
Registers a migration from one schema version to another.
nlohmann::json & At(const std::string &aPath)
Wrappers for the underlying JSON API so that most consumers don't need json.hpp All of these function...
void ReleaseNestedSettings(NESTED_SETTINGS *aSettings)
Saves and frees a nested settings object, if it exists within this one.
void Set(const std::string &aPath, ValueType aVal)
Stores a value into the JSON document Will throw an exception if ValueType isn't something that the l...
bool m_resetParamsIfMissing
Whether or not to set parameters to their default value if missing from JSON on Load()
LSET is a set of PCB_LAYER_IDs.
static LSET AllCuMask(int aCuLayerCount=MAX_CU_LAYERS)
Return a mask holding the requested number of Cu PCB_LAYER_IDs.
NESTED_SETTINGS is a JSON_SETTINGS that lives inside a JSON_SETTINGS.
JSON_SETTINGS * GetParent()
JSON_SETTINGS * m_parent
A pointer to the parent object to load and store from.
bool LoadFromFile(const wxString &aDirectory="") override
Loads the JSON document from the parent and then calls Load()
Stores an enum as an integer.
Like a normal param, but with custom getter and setter functions.
Represents a parameter that has a scaling factor between the value in the file and the value used int...
The backing store for a PROJECT, in JSON format.
A holder for a rule check item, DRC in Pcbnew or ERC in Eeschema.
bool m_TargetPadsWithNoHole
True to create teardrops for pads without holes (SMD and others.
bool m_TargetViasPads
True to create teardrops for vias and pads with holes.
bool m_UseRoundShapesOnly
True to create teardrops for round shapes only.
bool m_TargetTrack2Track
True to create teardrops at the end of a track connected to the end of another track having a differe...
TEARDROP_PARAMETERS * GetParameters(TARGET_TD aTdType)
size_t GetParametersCount()
TEARDROP_PARAMETARS is a helper class to handle parameters needed to build teardrops for a board thes...
int m_CurveSegCount
number of segments to build the curved sides of a teardrop area must be > 2.
double m_BestWidthRatio
The height of a teardrop as ratio between height and size of pad/via.
int m_TdMaxLen
max allowed length for teardrops in IU. <= 0 to disable
bool m_AllowUseTwoTracks
True to create teardrops using 2 track segments if the first in too small.
int m_TdMaxWidth
max allowed height for teardrops in IU. <= 0 to disable
double m_BestLengthRatio
The length of a teardrop as ratio between length and size of pad/via.
double m_WidthtoSizeFilterRatio
The ratio (H/D) between the via/pad size and the track width max value to create a teardrop 1....
bool m_TdOnPadsInZones
A filter to exclude pads inside zone fills.
@ DRCE_SILK_EDGE_CLEARANCE
@ DRCE_LIB_FOOTPRINT_ISSUES
@ DRCE_OVERLAPPING_FOOTPRINTS
@ DRCE_FOOTPRINT_TYPE_MISMATCH
@ DRCE_DUPLICATE_FOOTPRINT
@ DRCE_DRILLED_HOLES_COLOCATED
@ DRCE_LIB_FOOTPRINT_MISMATCH
@ EDGE_CLEARANCE_CONSTRAINT
@ HOLE_CLEARANCE_CONSTRAINT
@ HOLE_TO_HOLE_CONSTRAINT
bool IsCopperLayer(int aLayerId)
Tests whether a layer is a copper layer.
PCB_LAYER_ID
A quick note on layer IDs:
#define TEXTS_MAX_SIZE
Maximum text size in internal units (10 inches)
#define TEXTS_MIN_SIZE
Minimum text size in internal units (1 mil)
#define TEXTS_MAX_WIDTH
Maximum text width in internal units (10 inches)
Container to handle a stock of specific differential pairs each with unique track width,...
constexpr double IUTomm(int iu) const
constexpr int MilsToIU(int mils) const
constexpr int mmToIU(double mm) const
Container to handle a stock of specific vias each with unique diameter and drill sizes in the BOARD c...
std::string GetTeardropTargetCanonicalName(TARGET_TD aTdType)
TARGET_TD GetTeardropTargetTypeFromCanonicalName(const std::string &aTargetName)
wxString SeverityToString(const SEVERITY &aSeverity)
#define ZONE_CLEARANCE_MM