28#include <magic_enum.hpp>
58 m_NetSettings = std::make_shared<NET_SETTINGS>(
nullptr,
"" );
363 [&]() -> nlohmann::json
365 nlohmann::json ret = {};
369 wxString
name = item.GetSettingsKey();
370 int code = item.GetErrorCode();
380 [&](
const nlohmann::json& aJson )
382 if( !aJson.is_object() )
390 if( aJson.contains(
"hole_near_hole" ) )
395 wxString
name = item.GetSettingsKey();
396 std::string key(
name.ToUTF8() );
398 if( aJson.contains( key ) )
404 [&]() -> nlohmann::json
406 nlohmann::json js = nlohmann::json::array();
409 js.push_back( exclusion );
413 [&](
const nlohmann::json& aObj )
417 if( !aObj.is_array() )
420 for(
const nlohmann::json& entry : aObj )
422 if( entry.is_object() )
434 [&]() -> nlohmann::json
436 nlohmann::json js = nlohmann::json::array();
443 [&](
const nlohmann::json& aJson )
445 if( !aJson.is_array() )
450 for(
const nlohmann::json& entry : aJson )
461 [&]() -> nlohmann::json
463 nlohmann::json js = nlohmann::json::array();
467 nlohmann::json entry = {};
472 js.push_back( entry );
477 [&](
const nlohmann::json& aObj )
479 if( !aObj.is_array() )
484 for(
const nlohmann::json& entry : aObj )
486 if( entry.empty() || !entry.is_object() )
489 if( !entry.contains(
"diameter" ) || !entry.contains(
"drill" ) )
492 int diameter =
pcbIUScale.mmToIU( entry[
"diameter"].get<double>() );
493 int drill =
pcbIUScale.mmToIU( entry[
"drill"].get<double>() );
502 [&]() -> nlohmann::json
504 nlohmann::json js = nlohmann::json::array();
508 nlohmann::json entry = {};
510 entry[
"name"] = preset.m_Name.ToUTF8();
511 entry[
"start_layer"] =
LSET::Name( preset.m_StartLayer );
512 entry[
"end_layer"] =
LSET::Name( preset.m_EndLayer );
513 entry[
"staggered"] = preset.m_Staggered;
514 entry[
"via_size"] =
pcbIUScale.IUTomm( preset.m_ViaSize );
515 entry[
"via_drill"] =
pcbIUScale.IUTomm( preset.m_ViaDrill );
516 entry[
"use_netclass"] = preset.m_UseNetclass;
517 entry[
"filled"] = preset.m_Filled;
518 entry[
"capped"] = preset.m_Capped;
519 entry[
"pitch"] =
pcbIUScale.IUTomm( preset.m_Pitch );
521 js.push_back( entry );
526 [&](
const nlohmann::json& aObj )
528 if( !aObj.is_array() )
535 auto copperLayer = [](
const nlohmann::json& aEntry,
const char* aKey,
538 if( !aEntry.contains( aKey ) || !aEntry[aKey].is_string() )
541 wxString
name = wxString::FromUTF8( aEntry[aKey].get<std::string>() );
550 auto boolOr = [](
const nlohmann::json& aEntry,
const char* aKey,
bool aFallback )
552 return aEntry.contains( aKey ) && aEntry[aKey].is_boolean() ? aEntry[aKey].get<
bool>() : aFallback;
555 auto mmOr = [](
const nlohmann::json& aEntry,
const char* aKey )
557 if( !aEntry.contains( aKey ) || !aEntry[aKey].is_number() )
560 double mm = aEntry[aKey].get<
double>();
562 if( mm < 0.0 || mm >
pcbIUScale.IUTomm( std::numeric_limits<int>::max() ) )
570 auto boundedMmOr = [](
const nlohmann::json& aEntry,
const char* aKey,
double aMaxMM )
572 if( !aEntry.contains( aKey ) || !aEntry[aKey].is_number() )
575 return pcbIUScale.mmToIU( std::clamp( aEntry[aKey].get<double>(), 0.0, aMaxMM ) );
578 for(
const nlohmann::json& entry : aObj )
580 if( entry.empty() || !entry.is_object() || !entry.contains(
"name" ) || !entry[
"name"].is_string() )
587 preset.
m_Name = wxString::FromUTF8( entry[
"name"].get<std::string>() );
590 preset.
m_Staggered = boolOr( entry,
"staggered",
false );
591 preset.
m_ViaSize = mmOr( entry,
"via_size" );
592 preset.
m_ViaDrill = mmOr( entry,
"via_drill" );
593 preset.
m_UseNetclass = boolOr( entry,
"use_netclass",
false );
594 preset.
m_Filled = boolOr( entry,
"filled",
true );
595 preset.
m_Capped = boolOr( entry,
"capped",
false );
601 return aOther.m_Name.CmpNoCase( preset.
m_Name ) == 0;
611 [&]() -> nlohmann::json
613 nlohmann::json js = nlohmann::json::array();
617 nlohmann::json entry = {};
619 entry[
"width"] =
pcbIUScale.IUTomm( pair.m_Width );
620 entry[
"gap"] =
pcbIUScale.IUTomm( pair.m_Gap );
621 entry[
"via_gap"] =
pcbIUScale.IUTomm( pair.m_ViaGap );
623 js.push_back( entry );
628 [&](
const nlohmann::json& aObj )
630 if( !aObj.is_array() )
635 for(
const nlohmann::json& entry : aObj )
637 if( entry.empty() || !entry.is_object() )
640 if( !entry.contains(
"width" )
641 || !entry.contains(
"gap" )
642 || !entry.contains(
"via_gap" ) )
647 int width =
pcbIUScale.mmToIU( entry[
"width"].get<double>() );
648 int gap =
pcbIUScale.mmToIU( entry[
"gap"].get<double>() );
649 int via_gap =
pcbIUScale.mmToIU( entry[
"via_gap"].get<double>() );
658 [&]() -> nlohmann::json
660 nlohmann::json js = nlohmann::json::array();
661 nlohmann::json entry = {};
669 js.push_back( entry );
673 [&](
const nlohmann::json& aObj )
675 if( !aObj.is_array() )
678 for(
const nlohmann::json& entry : aObj )
680 if( entry.empty() || !entry.is_object() )
683 if( entry.contains(
"td_onvia" ) )
686 if( entry.contains(
"td_onpthpad" ) )
689 if( entry.contains(
"td_onsmdpad" ) )
692 if( entry.contains(
"td_ontrackend" ) )
695 if( entry.contains(
"td_onroundshapesonly" ) )
699 for(
int ii = 0; ii < 3; ++ii )
703 if( entry.contains(
"td_allow_use_two_tracks" ) )
706 if( entry.contains(
"td_curve_segcount" ) )
708 if( entry[
"td_curve_segcount"].get<int>() > 0 )
712 if( entry.contains(
"td_on_pad_in_zone" ) )
721 [&]() -> nlohmann::json
723 nlohmann::json js = nlohmann::json::array();
727 nlohmann::json entry = {};
741 js.push_back( entry );
746 [&](
const nlohmann::json& aObj )
748 if( !aObj.is_array() )
751 for(
const nlohmann::json& entry : aObj )
753 if( entry.empty() || !entry.is_object() )
756 if( !entry.contains(
"td_target_name" ) )
761 if( idx >= 0 && idx < 3 )
767 if( entry.contains(
"td_enabled" ) )
768 td_prm->
m_Enabled = entry[
"td_enabled"].get<
bool>();
770 if( entry.contains(
"td_maxlen" ) )
773 if( entry.contains(
"td_maxheight" ) )
776 if( entry.contains(
"td_length_ratio" ) )
779 if( entry.contains(
"td_height_ratio" ) )
782 if( entry.contains(
"td_curve_segcount" ) )
784 if( entry[
"td_curve_segcount"].get<int>() > 0 )
788 if( entry.contains(
"td_width_to_size_filter_ratio" ) )
791 if( entry.contains(
"td_allow_use_two_tracks" ) )
794 if( entry.contains(
"td_on_pad_in_zone" ) )
802 [&]() -> nlohmann::json
804 nlohmann::json js = {};
809 nlohmann::json entry = {};
811 entry[
"min_amplitude"] =
pcbIUScale.IUTomm( aSettings.m_minAmplitude );
812 entry[
"max_amplitude"] =
pcbIUScale.IUTomm( aSettings.m_maxAmplitude );
813 entry[
"spacing"] =
pcbIUScale.IUTomm( aSettings.m_spacing );
815 entry[
"corner_radius_percentage"] = aSettings.m_cornerRadiusPercentage;
816 entry[
"single_sided"] = aSettings.m_singleSided;
827 [&](
const nlohmann::json& aObj )
834 if( entry.contains(
"min_amplitude" ) )
837 if( entry.contains(
"max_amplitude" ) )
840 if( entry.contains(
"spacing" ) )
843 if( entry.contains(
"corner_style" ) )
849 if( entry.contains(
"corner_radius_percentage" ) )
852 if( entry.contains(
"single_sided" ) )
858 if( aObj.contains(
"single_track_defaults" ) )
861 if( aObj.contains(
"diff_pair_defaults" ) )
864 if( aObj.contains(
"diff_pair_skew_defaults" ) )
876 minStroke, maxStroke,
pcbIUScale.MM_PER_IU ) );
880 minTextSize, maxTextSize,
pcbIUScale.MM_PER_IU ) );
884 minTextSize, maxTextSize,
pcbIUScale.MM_PER_IU ) );
888 minStroke, maxStroke,
pcbIUScale.MM_PER_IU ) );
898 minStroke, maxStroke,
pcbIUScale.MM_PER_IU ) );
902 minTextSize, maxTextSize,
pcbIUScale.MM_PER_IU ) );
906 minTextSize, maxTextSize,
pcbIUScale.MM_PER_IU ) );
910 minStroke, maxStroke,
pcbIUScale.MM_PER_IU ) );
920 minStroke, maxStroke,
pcbIUScale.MM_PER_IU ) );
924 minStroke, maxStroke,
pcbIUScale.MM_PER_IU ) );
928 minStroke, maxStroke,
pcbIUScale.MM_PER_IU ) );
932 minTextSize, maxTextSize,
pcbIUScale.MM_PER_IU ) );
936 minTextSize, maxTextSize,
pcbIUScale.MM_PER_IU ) );
940 minStroke, maxStroke,
pcbIUScale.MM_PER_IU ) );
950 minStroke, maxStroke,
pcbIUScale.MM_PER_IU ) );
954 minTextSize, maxTextSize,
pcbIUScale.MM_PER_IU ) );
958 minTextSize, maxTextSize,
pcbIUScale.MM_PER_IU ) );
962 minStroke, maxStroke,
pcbIUScale.MM_PER_IU ) );
1036 "defaults.zones.hatch_orientation",
1074 "defaults.zones.pad_connection",
1086 "defaults.zones.corner_smoothing",
1094 magic_enum::enum_cast<ZONE_SETTINGS::CORNER_SMOOTHING>( aVal ).value_or(
1100 "defaults.zones.corner_radius",
1112 "defaults.zones.remove_islands",
1124 "defaults.zones.min_island_area",
1157 if( std::optional<double> optval =
Get<double>(
"rules.solder_mask_clearance" ) )
1160 if( std::optional<double> optval =
Get<double>(
"rules.solder_mask_min_width" ) )
1163 if( std::optional<double> optval =
Get<double>(
"rules.solder_paste_clearance" ) )
1166 if( std::optional<double> optval =
Get<double>(
"rules.solder_paste_margin_ratio" ) )
1171 At(
"rules" ).erase(
"solder_mask_clearance" );
1172 At(
"rules" ).erase(
"solder_mask_min_width" );
1173 At(
"rules" ).erase(
"solder_paste_clearance" );
1174 At(
"rules" ).erase(
"solder_paste_margin_ratio" );
1192 m_parent->ReleaseNestedSettings(
this );
1453 std::string units_ptr(
"defaults.dimension_units" );
1454 std::string precision_ptr(
"defaults.dimension_precision" );
1458 &&
At( units_ptr ).is_number_integer()
1459 &&
At( precision_ptr ).is_number_integer() ) )
1465 int units = *
Get<int>( units_ptr );
1466 int precision = *
Get<int>( precision_ptr );
1469 int extraDigits = 0;
1473 case 0: extraDigits = 3;
break;
1474 case 2: extraDigits = 2;
break;
1478 precision += extraDigits;
1480 Set( precision_ptr, precision );
1494 nlohmann::json migrated = nlohmann::json::array();
1496 for(
const nlohmann::json& entry : *opt )
1498 if( entry.is_object() )
1500 migrated.push_back( entry );
1502 else if( entry.is_array() && entry.size() > 0 )
1504 wxString markerData = entry[0].get<wxString>();
1505 wxString comment = entry.size() > 1 ? entry[1].get<wxString>() : wxString();
1510 migrated.push_back( ex );
1512 else if( entry.is_string() )
1517 migrated.push_back( ex );
1521 Set(
"drc_exclusions", migrated );
1531 [&](
const std::string& aParent,
const std::string& aOld,
const std::string& aNew )
1533 if( !
Contains( aParent ) || !
At( aParent ).is_object() )
1536 nlohmann::json& parent =
At( aParent );
1538 if( !parent.contains( aOld ) )
1542 if( !parent.contains( aNew ) )
1543 parent[aNew] = parent[aOld];
1545 parent.erase( aOld );
1548 renameKey(
"rule_severities",
"text_thickness",
"line_width" );
1549 renameKey(
"rules",
"min_text_thickness",
"min_silk_line_width" );
1567 bool migrated =
false;
1570 [](
int aCode ) -> std::string
1572 return std::string(
DRC_ITEM::Create( aCode )->GetSettingsKey().ToUTF8() );
1575 const std::string rs =
"rule_severities.";
1576 const std::string no_courtyard_key =
"legacy_no_courtyard_defined";
1577 const std::string courtyard_overlap_key =
"legacy_courtyards_overlap";
1581 nlohmann::json& severities =
1582 project->Internals()->at(
"/board/design_settings/rule_severities"_json_pointer );
1584 if( severities.contains( no_courtyard_key ) )
1586 if( severities[no_courtyard_key].get<bool>() )
1591 severities.erase( no_courtyard_key );
1595 if( severities.contains( courtyard_overlap_key ) )
1597 if( severities[courtyard_overlap_key].get<bool>() )
1602 severities.erase( courtyard_overlap_key );
1616 project->At(
"legacy" ).erase(
"pcbnew" );
1634 wxString::Format( wxT(
"DRC error code %d not found" ), aDRCErrorCode ) );
1646std::vector<BOARD_DESIGN_SETTINGS::VALIDATION_ERROR>
1649 std::vector<VALIDATION_ERROR> errors;
1652 auto addRangeError =
1653 [&](
const wxString& aField,
int aValue,
int aMin,
int aMax )
1655 if( aValue < aMin || aValue > aMax )
1660 errors.push_back( { aField,
1661 wxString::Format(
_(
"Value must be between %s and %s." ), min, max ) } );
1665 auto addRatioRangeError =
1666 [&](
const wxString& aField,
double aValue,
double aMin,
double aMax )
1668 if( !std::isfinite( aValue ) || aValue < aMin || aValue > aMax )
1670 errors.push_back( { aField,
1671 wxString::Format(
_(
"Value must be between %.3f and %.3f." ), aMin, aMax ) } );
1677 addRangeError( wxS(
"min_connection" ),
m_MinConn,
1708 errors.push_back( { wxS(
"min_resolved_spokes" ),
1709 _(
"Value must be between 0 and 99." ) } );
1712 addRangeError( wxS(
"max_error" ),
m_MaxError,
1734 addRatioRangeError( wxString::Format( wxS(
"teardrop_parameters[%s].best_length_ratio" ), target ),
1736 addRatioRangeError( wxString::Format( wxS(
"teardrop_parameters[%s].best_width_ratio" ), target ),
1738 addRatioRangeError( wxString::Format( wxS(
"teardrop_parameters[%s].width_to_size_filter_ratio" ), target ),
1748 errors.push_back( { wxString::Format( wxS(
"diff_pair_dimensions_list[%zu].gap" ), ii ),
1749 _(
"No differential pair gap defined." ) } );
1757 std::optional<int> viaDiameter;
1758 std::optional<int> viaDrill;
1769 errors.push_back( { wxString::Format( wxS(
"via_dimensions_list[%zu]" ), ii ),
1770 error->m_Message } );
1778std::vector<BOARD_DESIGN_SETTINGS::VALIDATION_ERROR>
1781 std::vector<VALIDATION_ERROR> warnings;
1795 warnings.push_back( { wxS(
"min_via_diameter" ),
1796 wxString::Format(
_(
"Minimum via diameter (%s) is smaller than the minimum drill "
1797 "size (%s) plus twice the minimum annular width (%s), so it "
1798 "has no effect. The effective minimum via diameter is %s." ),
1802 str( impliedViaMin ) ) } );
1820 biggest = std::max( biggest, constraint.
Value().
Min() );
1823 biggest = std::max( biggest, constraint.
Value().
Min() );
1826 biggest = std::max( biggest, constraint.
Value().
Min() );
1829 biggest = std::max( biggest, constraint.
Value().
Min() );
1832 biggest = std::max( biggest, constraint.
Value().
Min() );
1835 biggest = std::max( biggest, constraint.
Value().
Min() );
1849 if( netclass->HasClearance() )
1863 if( aListSize <= 1 )
1866 constexpr int lowestRealIndex = 1;
1867 int next = aIndex + ( aForward ? 1 : -1 );
1869 if(
next >= aListSize )
1870 next = lowestRealIndex;
1871 else if(
next < lowestRealIndex )
1872 next = aListSize - 1;
1898 return m_NetSettings->GetDefaultNetclass()->GetViaDiameter();
1915 return drill > 0 ? drill : -1;
1939 return m_NetSettings->GetDefaultNetclass()->GetTrackWidth();
1968 if(
m_NetSettings->GetDefaultNetclass()->HasDiffPairWidth() )
1969 return m_NetSettings->GetDefaultNetclass()->GetDiffPairWidth();
1971 return m_NetSettings->GetDefaultNetclass()->GetTrackWidth();
1989 return m_NetSettings->GetDefaultNetclass()->GetDiffPairGap();
2008 if(
m_NetSettings->GetDefaultNetclass()->HasDiffPairViaGap() )
2009 return m_NetSettings->GetDefaultNetclass()->GetDiffPairViaGap();
2027 if( aNewLayerCount > 0 )
2038 if( aNewLayerCount > 0 )
2055 LSET copperLayers = aMask;
2077 else if( aLayer ==
F_Fab || aLayer ==
B_Fab )
constexpr int ARC_HIGH_DEF
constexpr EDA_IU_SCALE pcbIUScale
const int bdsSchemaVersion
static int nextPredefinedIndex(int aIndex, bool aForward, int aListSize)
#define DEFAULT_MICROVIASMINDRILL
#define DEFAULT_SOLDERPASTE_CLEARANCE
#define DEFAULT_SOLDERPASTE_RATIO
#define DEFAULT_CUSTOMDPAIRWIDTH
#define DEFAULT_DP_MEANDER_SPACING
#define DEFAULT_VIASMINSIZE
#define DEFAULT_TEXT_WIDTH
#define DEFAULT_COPPER_TEXT_WIDTH
#define DEFAULT_CUSTOMDPAIRGAP
#define DEFAULT_MINCLEARANCE
#define MAXIMUM_ERROR_SIZE_MM
#define DEFAULT_HOLECLEARANCE
#define DEFAULT_SOLDERMASK_EXPANSION
#define DEFAULT_SOLDERMASK_MIN_WIDTH
#define MINIMUM_ERROR_SIZE_MM
#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 MAXIMUM_CLEARANCE
#define DEFAULT_HOLETOHOLEMIN
#define MAX_MICROVIA_STACK_PITCH_MM
#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_MINGROOVEWIDTH
#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_MEANDER_SPACING
#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.
BASE_SET & set(size_t pos)
DIM_PRECISION m_DimensionPrecision
Number of digits after the decimal.
std::vector< TEXT_ITEM_INFO > m_DefaultFPTextItems
std::vector< VALIDATION_ERROR > GetDesignRuleWarnings(std::optional< EDA_UNITS > aUnits=std::nullopt) const
Find design rule values that are legal but have no effect because other rules imply a stricter limit.
int GetHolePlatingThickness() const
Pad & via drills are finish size.
VIATYPE m_CurrentViaType
(VIA_BLIND_BURIED, VIA_THROUGH, VIA_MICROVIA)
void SetEnabledLayers(const LSET &aMask)
Change the bit-mask of enabled layers to aMask.
std::shared_ptr< NET_SETTINGS > m_NetSettings
bool Ignore(int aDRCErrorCode) const
Return true if the DRC error code's severity is RPT_SEVERITY_ERROR.
bool operator==(const BOARD_DESIGN_SETTINGS &aOther) const
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 GetCurrentViaSize() const
int GetNextDiffPairIndex(int aIndex, bool aForward) const
Compute the next diff pair dimensions list index when cycling predefined sizes, skipping the index-0 ...
wxString m_currentNetClassName
Current net class name used to display netclass info.
void SetViaSizeIndex(int aIndex)
Set the current via size list index to aIndex.
std::shared_ptr< DRC_ENGINE > m_DRCEngine
bool m_UseConnectedTrackWidth
virtual ~BOARD_DESIGN_SETTINGS()
std::vector< DIFF_PAIR_DIMENSION > m_DiffPairDimensionsList
VIA_DIMENSION m_customViaSize
void SetDiffPairIndex(int aIndex)
int m_SolderMaskToCopperClearance
std::map< std::string, wxString > m_UserLayerNames
bool m_TempOverrideTrackWidth
int GetSmallestClearanceValue() const
bool m_AllowSoldermaskBridgesInFPs
SEVERITY GetSeverity(int aDRCErrorCode) const
Return the severity of a given DRC error code.
bool m_DimensionSuppressZeroes
int GetNextTrackWidthIndex(int aIndex, bool aForward) const
Compute the next track width list index when cycling predefined sizes, skipping the index-0 netclass ...
TEARDROP_PARAMETERS_LIST m_TeardropParamsList
The parameters of teardrops for the different teardrop targets (via/pad, track end).
int GetCurrentDiffPairWidth() const
void SetUserDefinedLayerCount(int aNewLayerCount)
Set the number of user defined layers to aNewLayerCount.
int GetCurrentDiffPairViaGap() const
int GetCurrentDiffPairGap() const
int m_SolderMaskExpansion
int GetDRCEpsilon() const
Return an epsilon which accounts for rounding errors, etc.
int GetBiggestClearanceValue() const
int GetLayerClass(PCB_LAYER_ID aLayer) const
PNS::MEANDER_SETTINGS m_DiffPairMeanderSettings
int GetCurrentTrackWidth() const
int m_boardThickness
Board thickness for 3D viewer.
int m_copperLayerCount
Number of copper layers for this design.
int m_userDefinedLayerCount
Number of user defined layers for this design.
bool LoadFromFile(const wxString &aDirectory="") override
Loads the backing file from disk and then calls Load()
PNS::MEANDER_SETTINGS m_SingleTrackMeanderSettings
void SetTrackWidthIndex(int aIndex)
Set the current track width list index to aIndex.
int m_TextThickness[LAYER_CLASS_COUNT]
ZONE_SETTINGS m_defaultZoneSettings
The default settings that will be used for new zones.
int GetNextViaSizeIndex(int aIndex, bool aForward) const
Compute the next via size list index when cycling predefined sizes, skipping the index-0 netclass pla...
std::vector< int > m_TrackWidthList
DIFF_PAIR_DIMENSION m_customDiffPair
std::vector< VALIDATION_ERROR > ValidateDesignRules(std::optional< EDA_UNITS > aUnits=std::nullopt) const
Validate design settings values and return per-field errors.
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]
PNS::MEANDER_SETTINGS m_SkewMeanderSettings
LSET m_enabledLayers
Bit-mask for layer enabling.
bool m_TextItalic[LAYER_CLASS_COUNT]
std::vector< VIA_STACK_PRESET > m_ViaStackPresets
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
std::set< DRC_EXCLUSION, DRC_EXCLUSION_COMPARE > m_DrcExclusions
int m_DimensionArrowLength
MINOPTMAX< int > & Value()
Container for an DRC exclusion, which is a PCB_MARKER plus an optional comment.
static DRC_EXCLUSION FromLegacyStrings(const wxString &aMarkerData, const wxString &aComment)
std::string GetSortKey() const
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.
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 Contains(const std::string &aPath) const
virtual void Load()
Updates the parameters of this object based on the current JSON document contents.
std::optional< ValueType > Get(const std::string &aPath) const
Fetches a value from within the JSON document.
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...
JSON_SETTINGS(const wxString &aFilename, SETTINGS_LOC aLocation, int aSchemaVersion)
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 const LSET & AllCuMask()
return AllCuMask( MAX_CU_LAYERS );
LSET & ClearNonCopperLayers()
Clear the non-copper layers in this set.
static int NameToLayer(wxString &aName)
Return the layer number from a layer name.
static LSET UserDefinedLayersMask(int aUserDefinedLayerCount=MAX_USER_DEFINED_LAYERS)
Return a mask with the requested number of user defined layers.
static wxString Name(PCB_LAYER_ID aLayerId)
Return the fixed name association with aLayerId.
std::string m_path
The path (in pointer format) of where to store this document in the parent.
JSON_SETTINGS * GetParent()
JSON_SETTINGS * m_parent
A pointer to the parent object to load and store from.
NESTED_SETTINGS(const std::string &aName, int aSchemaVersion, JSON_SETTINGS *aParent, const std::string &aPath, bool aLoadFromFile=true)
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...
static std::optional< VIA_PARAMETER_ERROR > ValidateViaParameters(std::optional< int > aDiameter, std::optional< int > aPrimaryDrill, std::optional< PCB_LAYER_ID > aPrimaryStartLayer=std::nullopt, std::optional< PCB_LAYER_ID > aPrimaryEndLayer=std::nullopt, std::optional< int > aSecondaryDrill=std::nullopt, std::optional< PCB_LAYER_ID > aSecondaryStartLayer=std::nullopt, std::optional< PCB_LAYER_ID > aSecondaryEndLayer=std::nullopt, std::optional< int > aTertiaryDrill=std::nullopt, std::optional< PCB_LAYER_ID > aTertiaryStartLayer=std::nullopt, std::optional< PCB_LAYER_ID > aTertiaryEndLayer=std::nullopt, int aCopperLayerCount=0)
Dimensions for the meandering algorithm.
int m_minAmplitude
Minimum meandering amplitude.
int m_cornerRadiusPercentage
Rounding percentage (0 - 100).
bool m_singleSided
Place meanders on one side.
MEANDER_STYLE m_cornerStyle
Type of corners for the meandered line.
int m_maxAmplitude
Maximum meandering amplitude.
int m_spacing
Meandering period/spacing (see dialog picture for explanation).
The backing store for a PROJECT, in JSON format.
A holder for a rule check item, DRC in Pcbnew or ERC in Eeschema.
TEARDROP_PARAMETERS_LIST is a helper class to handle the list of TEARDROP_PARAMETERS needed to build ...
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...
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.
bool m_Enabled
Flag to enable teardrops.
bool m_CurvedEdges
True if the teardrop should be curved.
#define DEFAULT_TEXT_SIZE
The default text size in mils. (can be changed in preference menu)
@ EDGE_CLEARANCE_CONSTRAINT
@ PHYSICAL_HOLE_CLEARANCE_CONSTRAINT
@ HOLE_CLEARANCE_CONSTRAINT
@ PHYSICAL_CLEARANCE_CONSTRAINT
@ HOLE_TO_HOLE_CONSTRAINT
@ DRCE_FOOTPRINT_SCALED_WITH_PADS
@ DRCE_TUNING_PROFILE_IMPLICIT_RULES
@ DRCE_SILK_EDGE_CLEARANCE
@ DRCE_SILK_MASK_CLEARANCE
@ DRCE_MIRRORED_TEXT_ON_FRONT_LAYER
@ DRCE_LIB_FOOTPRINT_ISSUES
@ DRCE_MICROVIA_CROSSES_CORE
@ DRCE_OVERLAPPING_FOOTPRINTS
@ DRCE_SCHEMATIC_FIELDS_PARITY
@ DRCE_MICROVIA_STACK_NOT_FILLED
@ DRCE_TRACK_NOT_CENTERED_ON_VIA
@ DRCE_COPPER_OUTSIDE_BOARD
@ DRCE_MISSING_TUNING_PROFILE
@ DRCE_DRILLED_HOLES_TOO_CLOSE
@ DRCE_FOOTPRINT_TYPE_MISMATCH
@ DRCE_DUPLICATE_FOOTPRINT
@ DRCE_DRILLED_HOLES_COLOCATED
@ DRCE_LIB_FOOTPRINT_MISMATCH
@ DRCE_UNMIRRORED_TEXT_ON_BACK_LAYER
@ DRCE_MICROVIA_SPANS_DIELECTRICS
#define TEXT_MIN_SIZE_MM
Minimum text size (1 micron).
#define TEXT_MAX_SIZE_MM
Maximum text size in mm (~10 inches)
template KICOMMON_API std::optional< nlohmann::json > JSON_SETTINGS::Get< nlohmann::json >(const std::string &aPath) const
bool IsCopperLayer(int aLayerId)
Test whether a layer is a copper layer.
PCB_LAYER_ID
A quick note on layer IDs:
PCB_LAYER_ID ToLAYER_ID(int aLayer)
KICOMMON_API wxString StringFromValue(const EDA_IU_SCALE &aIuScale, EDA_UNITS aUnits, double aValue, bool aAddUnitsText=false, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE)
Return the string from aValue according to aUnits (inch, mm ...) for display.
@ OUTSIDE
Text appears outside the dimension line (default)
@ INLINE
Text appears in line with the dimension line.
static BOM_FMT_PRESET CSV()
Container to handle a stock of specific differential pairs each with unique track width,...
BOM_FMT_PRESET m_BomFmtSettings
List of stored BOM format presets.
wxString m_BomExportFileName
BOM_PRESET m_BomSettings
List of stored BOM presets.
std::vector< BOM_PRESET > m_BomPresets
std::vector< BOM_FMT_PRESET > m_BomFmtPresets
Container to handle a stock of specific vias each with unique diameter and drill sizes in the BOARD c...
A named microvia stack definition, chosen while routing instead of entering the values each time.
PCB_LAYER_ID m_StartLayer
std::string GetTeardropTargetCanonicalName(TARGET_TD aTdType)
TARGET_TD GetTeardropTargetTypeFromCanonicalName(const std::string &aTargetName)
SEVERITY SeverityFromString(const wxString &aSeverity)
wxString SeverityToString(const SEVERITY &aSeverity)
VECTOR2< int32_t > VECTOR2I
ISLAND_REMOVAL_MODE
Whether or not to remove isolated islands from a zone.
#define ZONE_THERMAL_RELIEF_GAP_MM
ZONE_CONNECTION
How pads are covered by copper in zone.
@ THERMAL
Use thermal relief for pads.
#define ZONE_BORDER_HATCH_DIST_MM
#define ZONE_BORDER_HATCH_MINDIST_MM
#define ZONE_THERMAL_RELIEF_COPPER_WIDTH_MM
#define ZONE_CLEARANCE_MM
#define ZONE_THICKNESS_MIN_VALUE_MM
#define ZONE_THICKNESS_MM
#define ZONE_BORDER_HATCH_MAXDIST_MM