268 wxString
name = item.GetSettingsKey();
269 int code = item.GetErrorCode();
281 if( !aJson.is_object() )
286 wxString
name = item.GetSettingsKey();
287 std::string key(
name.ToUTF8() );
289 if( aJson.contains( key ) )
300 js.push_back( entry );
308 if( !aObj.is_array() )
327 js.push_back( Iu2Millimeter( width ) );
333 if( !aJson.is_array() )
357 entry[
"diameter"] = Iu2Millimeter(
via.m_Diameter );
358 entry[
"drill"] = Iu2Millimeter(
via.m_Drill );
360 js.push_back( entry );
367 if( !aObj.is_array() )
374 if( entry.empty() || !entry.is_object() )
377 if( !entry.contains(
"diameter" ) || !entry.contains(
"drill" ) )
380 int diameter =
Millimeter2iu( entry[
"diameter"].get<double>() );
397 entry[
"width"] = Iu2Millimeter( pair.m_Width );
398 entry[
"gap"] = Iu2Millimeter( pair.m_Gap );
399 entry[
"via_gap"] = Iu2Millimeter( pair.m_ViaGap );
401 js.push_back( entry );
408 if( !aObj.is_array() )
415 if( entry.empty() || !entry.is_object() )
418 if( !entry.contains(
"width" ) || !entry.contains(
"gap" )
419 || !entry.contains(
"via_gap" ) )
424 int via_gap =
Millimeter2iu( entry[
"via_gap"].get<double>() );
570 {
"width", Iu2Millimeter(
m_Pad_Master->GetSize().x ) },
571 {
"height", Iu2Millimeter(
m_Pad_Master->GetSize().y ) },
572 {
"drill", Iu2Millimeter(
m_Pad_Master->GetDrillSize().x ) }
579 if( aJson.contains(
"width" ) && aJson.contains(
"height" )
580 && aJson.contains(
"drill" ) )
583 sz.SetWidth(
Millimeter2iu( aJson[
"width"].get<double>() ) );
584 sz.SetHeight(
Millimeter2iu( aJson[
"height"].get<double>() ) );
620 if(
OPT<double> optval = Get<double>(
"rules.solder_mask_clearance" ) )
623 if(
OPT<double> optval = Get<double>(
"rules.solder_mask_min_width" ) )
626 if(
OPT<double> optval = Get<double>(
"rules.solder_paste_clearance" ) )
629 if(
OPT<double> optval = Get<double>(
"rules.solder_paste_margin_ratio" ) )
634 At(
"rules" ).erase(
"solder_mask_clearance" );
635 At(
"rules" ).erase(
"solder_mask_min_width" );
636 At(
"rules" ).erase(
"solder_paste_clearance" );
637 At(
"rules" ).erase(
"solder_paste_margin_ratio" );
660 m_Pad_Master( nullptr )
778 std::string units_ptr(
"defaults.dimension_units" );
779 std::string precision_ptr(
"defaults.dimension_precision" );
782 At( units_ptr ).is_number_integer() &&
783 At( precision_ptr ).is_number_integer() ) )
789 int units = Get<int>( units_ptr ).value();
790 int precision = Get<int>( precision_ptr ).value();
797 case 0: extraDigits = 3;
break;
798 case 2: extraDigits = 2;
break;
802 precision += extraDigits;
804 Set( precision_ptr, precision );
823 bool migrated =
false;
826 [](
int aCode ) -> std::string
829 wxString
name = item->GetSettingsKey();
830 return std::string(
name.ToUTF8() );
833 std::string bp =
"board.design_settings.rule_severities.";
834 std::string rs =
"rule_severities.";
836 if(
OPT<bool> v =
project->Get<
bool>( bp +
"legacy_no_courtyard_defined" ) )
843 project->Internals()->erase(
m_internals->PointerFromString( bp +
"legacy_no_courtyard_defined" ) );
864 project->At(
"legacy" ).erase(
"pcbnew" );
895 biggest = std::max( biggest, constraint.
Value().
Min() );
898 biggest = std::max( biggest, constraint.
Value().
Min() );
901 biggest = std::max( biggest, constraint.
Value().
Min() );
912 for(
const std::pair<const wxString, NETCLASSPTR>& netclass :
GetNetClasses().NetClasses() )
913 clearance = std::min( clearance, netclass.second->GetClearance() );
923 return netclass->GetuViaDiameter();
931 return netclass->GetuViaDrill();
964 return drill > 0 ? drill : -1;
1083 if( aNewLayerCount > 0 )
1112 else if( aLayer ==
F_Fab || aLayer ==
B_Fab )
int GetCurrentMicroViaSize()
static LSET AllCuMask(int aCuLayerCount=MAX_CU_LAYERS)
Return a mask holding the requested number of Cu PCB_LAYER_IDs.
#define DEFAULT_EDGE_WIDTH
#define DEFAULT_SILK_TEXT_WIDTH
unsigned m_trackWidthIndex
VIA_DIMENSION m_customViaSize
void SetCopperLayerCount(int aNewLayerCount)
Set the copper layer count to aNewLayerCount.
#define DEFAULT_TRACKMINWIDTH
Container to handle a stock of specific vias each with unique diameter and drill sizes in the BOARD c...
int m_ZoneFillVersion
Option to select different fill algorithms.
void SetEnabledLayers(LSET aMask)
Change the bit-mask of enabled layers to aMask.
void SetCopperEdgeClearance(int aDistance)
#define DEFAULT_COURTYARD_WIDTH
void SetTrackWidthIndex(unsigned aIndex)
Set the current track width list index to aIndex.
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...
wxString m_currentNetClassName
Current net class name used to display netclass info.
std::vector< TEXT_ITEM_INFO > m_DefaultFPTextItems
std::vector< PARAM_BASE * > m_params
The list of parameters (owned by this object)
static std::shared_ptr< DRC_ITEM > Create(int aErrorCode)
Constructs a DRC_ITEM for the given error code.
#define DEFAULT_SOLDERPASTE_RATIO
NETCLASSPTR Find(const wxString &aName) const
Search this container for a NETCLASS given by aName.
int GetDiffPairGap() const
int GetCurrentViaDrill() const
JSON_SETTINGS * GetParent()
bool m_DimensionSuppressZeroes
int GetCurrentTrackWidth() const
#define DEFAULT_VIASMINSIZE
#define TEXTS_MAX_WIDTH
Maximum text width in internal units (10 inches)
BOARD_DESIGN_SETTINGS(JSON_SETTINGS *aParent, const std::string &aPath)
MINOPTMAX< int > & Value()
std::vector< int > m_TrackWidthList
BOARD_STACKUP m_stackup
the description of layers stackup, for board fabrication only physical layers are in layers stackup.
int GetCurrentDiffPairGap() const
int GetCurrentMicroViaDrill()
static constexpr double IU_PER_MM
Mock up a conversion function.
std::vector< DIFF_PAIR_DIMENSION > m_DiffPairDimensionsList
int GetHolePlatingThickness() const
Pad & via drills are finish size.
A holder for a rule check item, DRC in Pcbnew or ERC in Eeschema.
NETCLASSES m_internalNetClasses
Net classes that are loaded from the board file before these were stored in the project.
bool Ignore(int aDRCErrorCode)
Return true if the DRC error code's severity is SEVERITY_IGNORE.
#define LEGACY_COPPEREDGECLEARANCE
wxPoint m_auxOrigin
origin for plot exports
#define DEFAULT_BOARD_THICKNESS_MM
int m_DimensionPrecision
Number of digits after the decimal.
ZONE_SETTINGS m_defaultZoneSettings
The default settings that will be used for new zones.
#define DEFAULT_LINE_WIDTH
#define DEFAULT_DIMENSION_ARROW_LENGTH
#define DEFAULT_COPPER_LINE_WIDTH
int GetSmallestClearanceValue() const
#define DEFAULT_HOLETOHOLEMIN
Text appears outside the dimension line (default)
Stores an enum as an integer.
DIFF_PAIR_DIMENSION m_customDiffPair
#define DEFAULT_CUSTOMDPAIRGAP
int GetTextThickness(PCB_LAYER_ID aLayer) const
Return the default text thickness from the layer class for the given layer.
static nlohmann::json::json_pointer PointerFromString(std::string aPath)
Builds a JSON pointer based on a given string.
VIATYPE m_CurrentViaType
(VIA_BLIND_BURIED, VIA_THROUGH, VIA_MICROVIA)
bool LoadFromFile(const wxString &aDirectory="") override
Loads the JSON document from the parent and then calls Load()
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...
The backing store for a PROJECT, in JSON format.
bool m_UseConnectedTrackWidth
Container to handle a stock of specific differential pairs each with unique track width,...
std::unique_ptr< PAD > m_Pad_Master
#define DEFAULT_MINCLEARANCE
#define DEFAULT_MINTHROUGHDRILL
DIM_TEXT_POSITION m_DimensionTextPosition
DIM_UNITS_MODE m_DimensionUnitsMode
#define DEFAULT_CUSTOMDPAIRVIAGAP
int GetLayerClass(PCB_LAYER_ID aLayer) const
#define DEFAULT_DIMENSION_EXTENSION_OFFSET
bool GetTextUpright(PCB_LAYER_ID aLayer) const
Text appears in line with the dimension line.
#define DEFAULT_SOLDERPASTE_CLEARANCE
bool GetTextItalic(PCB_LAYER_ID aLayer) const
int GetLineThickness(PCB_LAYER_ID aLayer) const
Return the default graphic segment thickness from the layer class for the given layer.
#define DEFAULT_TEXT_WIDTH
wxSize m_TextSize[LAYER_CLASS_COUNT]
void SetViaSizeIndex(unsigned aIndex)
Set the current via size list index to aIndex.
NESTED_SETTINGS is a JSON_SETTINGS that lives inside a JSON_SETTINGS.
#define DEFAULT_CUSTOMDPAIRWIDTH
int GetTrackWidth() const
#define DEFAULT_SILK_TEXT_SIZE
int m_TextThickness[LAYER_CLASS_COUNT]
LSET is a set of PCB_LAYER_IDs.
#define DEFAULT_SILK_LINE_WIDTH
int GetDiffPairViaGap() const
std::unique_ptr< JSON_SETTINGS_INTERNALS > m_internals
void SetMinHoleSeparation(int aDistance)
bool LoadFromFile(const wxString &aDirectory="") override
Loads the backing file from disk and then calls Load()
JSON_SETTINGS * m_parent
A pointer to the parent object to load and store from.
int GetCurrentDiffPairWidth() const
bool m_TextItalic[LAYER_CLASS_COUNT]
Represents a parameter that has a scaling factor between the value in the file and the value used int...
virtual ~BOARD_DESIGN_SETTINGS()
#define ZONE_CLEARANCE_MIL
BOARD_DESIGN_SETTINGS & operator=(const BOARD_DESIGN_SETTINGS &aOther)
NETCLASSES & GetNetClasses() const
bool m_BlindBuriedViaAllowed
true to allow blind/buried vias
SEVERITY GetSeverity(int aDRCErrorCode)
const int bdsSchemaVersion
int m_ViasMinAnnularWidth
#define TEXTS_MAX_SIZE
Maximum text size in internal units (10 inches)
void SetDiffPairIndex(unsigned aIndex)
int m_CopperEdgeClearance
#define DEFAULT_MICROVIASMINSIZE
int GetDiffPairWidth() const
NETCLASS * GetDefaultPtr() const
bool m_TempOverrideTrackWidth
#define DEFAULT_MICROVIASMINDRILL
#define DEFAULT_SOLDERMASK_MIN_WIDTH
int m_LineThickness[LAYER_CLASS_COUNT]
#define DEFAULT_HOLECLEARANCE
bool IsCopperLayer(LAYER_NUM aLayerId)
Tests whether a layer is a copper layer.
#define TEXTS_MIN_SIZE
Minimum text size in internal units (1 mil)
#define DEFAULT_COPPEREDGECLEARANCE
int m_DimensionArrowLength
int GetCurrentViaSize() const
bool m_UseHeightForLengthCalcs
Enable inclusion of stackup height in track length measurements and length tuning.
bool m_resetParamsIfMissing
Whether or not to set parameters to their default value if missing from JSON on Load()
wxString SeverityToString(const SEVERITY &aSeverity)
int GetDRCEpsilon() const
void registerMigration(int aOldSchemaVersion, int aNewSchemaVersion, std::function< bool(void)> aMigrator)
Registers a migration from one schema version to another.
wxPoint m_gridOrigin
origin for grid offsets
#define DEFAULT_SILKCLEARANCE
PCB_LAYER_ID
A quick note on layer IDs:
std::map< int, SEVERITY > m_DRCSeverities
SEVERITY SeverityFromString(const wxString &aSeverity)
static std::vector< std::reference_wrapper< RC_ITEM > > GetItemsWithSeverities()
int GetBiggestClearanceValue() const
NETCLASS * GetDefault() const
int GetViaDiameter() const
void SetSilkClearance(int aDistance)
Set the minimum distance between silk items to aValue.
int GetCurrentDiffPairViaGap() const
void initFromOther(const BOARD_DESIGN_SETTINGS &aOther)
#define DEFAULT_COPPER_TEXT_WIDTH
std::vector< VIA_DIMENSION > m_ViasDimensionsList
#define DEFAULT_CUSTOMTRACKWIDTH
bool m_ZoneKeepExternalFillets
DIM_UNITS_FORMAT m_DimensionUnitsFormat
#define DEFAULT_TEXT_SIZE
Ratio of the font height to the baseline of the text above the wire.
static const ADVANCED_CFG & GetCfg()
Get the singleton instance's config, which is shared by all consumers.
bool Contains(const std::string &aPath) const
NETCLASSES * m_netClasses
This will point to m_internalNetClasses until it is repointed to the project after load.
#define DEFAULT_SOLDERMASK_CLEARANCE
int m_copperLayerCount
Number of copper layers for this design.
#define DEFAULT_COPPER_TEXT_SIZE
bool m_MicroViasAllowed
true to allow micro vias
double m_SolderPasteMarginRatio
void ReleaseNestedSettings(NESTED_SETTINGS *aSettings)
Saves and frees a nested settings object, if it exists within this one.
std::set< wxString > m_DrcExclusions
int m_DimensionExtensionOffset
static constexpr int Millimeter2iu(double mm)
LSET m_enabledLayers
Bit-mask for layer enabling.
bool m_DimensionKeepTextAligned
wxSize GetTextSize(PCB_LAYER_ID aLayer) const
Return the default text size from the layer class for the given layer.
int m_boardThickness
Board thickness for 3D viewer.
std::shared_ptr< DRC_ENGINE > m_DRCEngine
virtual void Load()
Updates the parameters of this object based on the current JSON document contents.
bool m_TextUpright[LAYER_CLASS_COUNT]
Container for design settings for a BOARD object.