26#include <drc_rules_lexer.h>
48#include <unordered_map>
50using CODE_MAP = std::unordered_map<DRC_RULE_EDITOR_CONSTRAINT_NAME, const char*>;
51using REVERSE_CODE_MAP = std::unordered_map<wxString, DRC_RULE_EDITOR_CONSTRAINT_NAME, wxStringHash, wxStringEqual>;
60 {
HOLE_ASPECT_RATIO, DRC_RULES_LEXER::TokenName( DRCRULE_T::T_hole_aspect_ratio ) },
66 {
HOLE_SIZE, DRC_RULES_LEXER::TokenName( DRCRULE_T::T_hole_size ) },
78 {
ROUTING_WIDTH, DRC_RULES_LEXER::TokenName( DRCRULE_T::T_track_width ) },
89 for(
const auto& [type, code] :
sCodeMap )
90 map.emplace( wxString::FromUTF8( code ), type );
96 static std::vector<DRC_RULE_EDITOR_UTILS::RuleConverter> converters;
135 case LENGTH_CONSTRAINT:
return DRC_RULES_LEXER::TokenName( DRCRULE_T::T_length );
136 case SKEW_CONSTRAINT:
return DRC_RULES_LEXER::TokenName( DRCRULE_T::T_skew );
151 static bool initialized =
false;
158 [](
const std::shared_ptr<DRC_RULE>& aRule ) -> std::shared_ptr<DRC_RE_BASE_CONSTRAINT_DATA>
160 if( aRule->m_Constraints.empty() )
return nullptr;
162 const auto& constraint = aRule->m_Constraints[0];
165 if( code.IsEmpty() )
return nullptr;
173 double val = constraint.GetValue().Min() / 1000000.0;
175 data->SetRuleName( aRule->m_Name );
176 data->SetNumericInputValue( val );
177 data->SetConstraintCode( code );
182 auto data = std::make_shared<DRC_RE_BOOL_INPUT_CONSTRAINT_DATA>( 0,
true, aRule->m_Name );
183 data->SetConstraintCode( code );
186 else if( code ==
"track_width" )
188 double minW = constraint.GetValue().Min() / 1000000.0;
189 double optW = constraint.GetValue().Opt() / 1000000.0;
190 double maxW = constraint.GetValue().Max() / 1000000.0;
194 tol = std::max( optW - minW, maxW - optW );
196 auto data = std::make_shared<DRC_RE_ROUTING_WIDTH_CONSTRAINT_DATA>( 0, aRule->m_Name, optW, tol );
197 data->SetConstraintCode( code );
206 [](
const std::shared_ptr<DRC_RULE>& aRule ) -> std::shared_ptr<DRC_RE_BASE_CONSTRAINT_DATA>
211 if( diaConstraint && holeConstraint )
213 double minDia = diaConstraint->GetValue().Min() / 1000000.0;
214 double maxDia = diaConstraint->GetValue().Max() / 1000000.0;
216 double minDrill = holeConstraint->GetValue().Min() / 1000000.0;
217 double maxDrill = holeConstraint->GetValue().Max() / 1000000.0;
221 if( aRule->m_Condition )
223 wxString expr = aRule->m_Condition->GetExpression();
225 if( expr.Contains( wxS(
"'Micro'" ) ) )
227 else if( expr.Contains( wxS(
"'Through'" ) ) )
229 else if( expr.Contains( wxS(
"'Blind'" ) ) )
231 else if( expr.Contains( wxS(
"'Buried'" ) ) )
235 auto data = std::make_shared<DRC_RE_VIA_STYLE_CONSTRAINT_DATA>( 0, aRule->m_Name, minDia, maxDia,
236 minDrill, maxDrill, viaType );
237 data->SetConstraintCode(
"via_style" );
247 auto it =
sCodeMap.find( aConstraintType );
249 return wxString::FromUTF8( it->second );
273 switch( aConstraintType )
275 default:
return false;
282 switch( aConstraintType )
314 int* aErrorCount, wxString* aValidationMessage )
319 if( !aTextCtrl->Validate() )
328 *aValidationMessage +=
330 wxString::Format(
_(
"%s should not be empty." ), aLabel ) );
337 *aErrorCount, wxString::Format(
_(
"The value of %s must be a valid number." ), aLabel ) );
344 *aErrorCount, wxString::Format(
_(
"The value of %s must be greater than 0." ), aLabel ) );
356 int* aErrorCount, wxString* aValidationMessage )
361 if( !aTextCtrl->Validate() )
370 *aValidationMessage +=
372 wxString::Format(
_(
"%s should not be empty." ), aLabel ) );
379 *aErrorCount, wxString::Format(
_(
"The value of %s must be a valid integer." ), aLabel ) );
386 *aErrorCount, wxString::Format(
_(
"The value of %s must be greater than 0." ), aLabel ) );
398 wxString* aValidationMessage )
401 aComboBox->SetValidator( cmbCtrlValidator );
403 if( !aComboBox->Validate() )
413 wxString::Format(
_(
"Please choose %s." ), aLabel ) );
425 const wxString& aMinLabel,
const wxString& aMaxLabel,
426 int* aErrorCount, wxString* aValidationMessage )
428 aMinTextCtrl->SetName(
"min" );
429 aMaxTextCtrl->SetName(
"max" );
433 if( !aMinTextCtrl->Validate() )
443 *aErrorCount, wxString::Format(
_(
"%s value cannot be greater than %s value." ),
444 aMinLabel, aMaxLabel ) );
451 aMinTextCtrl->SetName(
"text" );
452 aMaxTextCtrl->SetName(
"text" );
459 wxTextCtrl* aMaxTextCtrl,
const wxString& aMinLabel,
460 const wxString& aPreferredLabel,
const wxString& aMaxLabel,
461 int* aErrorCount, wxString* aValidationMessage )
463 aMinTextCtrl->SetName(
"min" );
464 aPreferredTextCtrl->SetName(
"preferred" );
465 aMaxTextCtrl->SetName(
"max" );
469 if( !aMinTextCtrl->Validate() )
480 *aErrorCount, wxString::Format(
_(
"%s value cannot be greater than %s value." ),
481 aMinLabel, aPreferredLabel ) );
488 *aErrorCount, wxString::Format(
_(
"%s value cannot be greater than %s value." ),
489 aPreferredLabel, aMaxLabel ) );
496 *aErrorCount, wxString::Format(
_(
"%s value cannot be greater than %s value." ),
497 aMinLabel, aMaxLabel ) );
504 aMinTextCtrl->SetName(
"text" );
505 aPreferredTextCtrl->SetName(
"text" );
506 aMaxTextCtrl->SetName(
"text" );
513 int* aErrorCount, wxString* aValidationMessage )
517 aCheckboxes[0]->SetValidator(
validator );
519 if( !aCheckboxes[0]->Validate() )
529 *aErrorCount, wxString::Format(
_(
"Please select at least one option from %s list." ), aLabel ));
542 return wxString::Format( wxS(
"%d. %s\n" ), aErrorCount, aErrorMessage );
551 if( !aCanBeZero && aValue <= 0.0 )
553 aResult->
AddError( wxString::Format(
_(
"The value of %s must be greater than 0." ), aLabel ) );
562 bool aIntegerOnly,
const wxString& aLabel,
565 if( aValueStr.IsEmpty() )
567 aResult->
AddError( wxString::Format(
_(
"%s should not be empty." ), aLabel ) );
575 std::string stdStr = aValueStr.ToStdString();
577 long intVal = std::stol( stdStr, &pos );
579 if( pos != stdStr.length() )
581 aResult->
AddError( wxString::Format(
_(
"The value of %s must be a valid integer." ), aLabel ) );
585 if( !aCanBeZero && intVal <= 0 )
587 aResult->
AddError( wxString::Format(
_(
"The value of %s must be greater than 0." ), aLabel ) );
593 std::string stdStr = aValueStr.ToStdString();
595 double floatVal = std::stod( stdStr, &pos );
597 if( pos != stdStr.length() )
599 aResult->
AddError( wxString::Format(
_(
"The value of %s must be a valid number." ), aLabel ) );
603 if( !aCanBeZero && floatVal <= 0.0 )
605 aResult->
AddError( wxString::Format(
_(
"The value of %s must be greater than 0." ), aLabel ) );
610 catch(
const std::exception& )
613 aResult->
AddError( wxString::Format(
_(
"The value of %s must be a valid integer." ), aLabel ) );
615 aResult->
AddError( wxString::Format(
_(
"The value of %s must be a valid number." ), aLabel ) );
629 aResult->
AddError( wxString::Format(
_(
"%s value cannot be greater than %s value." ), aMinLabel, aMaxLabel ));
638 const wxString& aMinLabel,
639 const wxString& aPrefLabel,
640 const wxString& aMaxLabel,
645 if( aMin > aPreferred )
647 aResult->
AddError( wxString::Format(
_(
"%s value cannot be greater than %s value." ), aMinLabel, aPrefLabel ));
651 if( aPreferred > aMax )
653 aResult->
AddError( wxString::Format(
_(
"%s value cannot be greater than %s value." ), aPrefLabel, aMaxLabel ));
659 aResult->
AddError( wxString::Format(
_(
"%s value cannot be greater than %s value." ), aMinLabel, aMaxLabel ));
668 const wxString& aLabel,
671 for(
bool selected : aSelected )
677 aResult->
AddError( wxString::Format(
_(
"Please select at least one option from %s list." ), aLabel ) );
685 if( aSelectionIndex < 0 )
687 aResult->
AddError( wxString::Format(
_(
"Please choose %s." ), aLabel ) );
699 std::vector<std::shared_ptr<DRC_RE_BASE_CONSTRAINT_DATA>> rules;
700 std::vector<std::shared_ptr<DRC_RULE>> parsedRules;
702 wxString rulesText = aRules;
703 if( !rulesText.Contains(
"(version" ) )
704 rulesText.Prepend(
"(version 2)\n" );
709 parser.
Parse( parsedRules,
nullptr );
715 for(
const auto& rule : parsedRules )
717 std::shared_ptr<DRC_RE_BASE_CONSTRAINT_DATA> data;
721 data = converter( rule );
728 auto customData = std::make_shared<DRC_RE_CUSTOM_RULE_CONSTRAINT_DATA>( 0, rule->m_Name );
729 customData->SetRuleText( wxString::Format(
"(rule \"%s\" ...)", rule->m_Name ) );
733 if( rule->m_Condition )
734 data->SetRuleCondition( rule->m_Condition->GetExpression() );
736 rules.push_back( data );
743 const std::vector<std::shared_ptr<DRC_RE_BASE_CONSTRAINT_DATA>>& aRules,
744 const BOARD* aBoard )
746 wxString content = wxT(
"(version 2)\n" );
748 for(
const auto& data : aRules )
755 ctx.
comment = data->GetComment();
759 std::vector<PCB_LAYER_ID> layers = data->GetLayers();
761 if( !layers.empty() && aBoard )
763 wxString layerStr =
"(layer";
766 layerStr +=
" \"" + aBoard->
GetLayerName( layer ) +
"\"";
772 content += data->GenerateRule( ctx ) + wxT(
"\n" );
775 std::string
utf8 = std::string( content.mb_str( wxConvUTF8 ) );
785 switch( aConstraintType )
847 switch( aConstraintType )
851 default:
return aIsTop ?
F_Cu :
B_Cu;
859 switch( aConstraintType )
863 return wxString::Format( wxS(
"(condition \"A.Layer == '%s' && B.Layer == '%s'\")" ),
865 aIsTop ? wxS(
"F.Mask" ) : wxS(
"B.Mask" ) );
873 return wxEmptyString;
878std::shared_ptr<DRC_RE_NUMERIC_INPUT_CONSTRAINT_DATA>
885 case COURTYARD_CLEARANCE:
return std::make_shared<DRC_RE_COURTYARD_CLEARANCE_CONSTRAINT_DATA>();
886 case PHYSICAL_CLEARANCE:
return std::make_shared<DRC_RE_PHYSICAL_CLEARANCE_CONSTRAINT_DATA>();
887 case CREEPAGE_DISTANCE:
return std::make_shared<DRC_RE_CREEPAGE_DISTANCE_CONSTRAINT_DATA>();
888 case HOLE_SIZE:
return std::make_shared<DRC_RE_HOLE_SIZE_CONSTRAINT_DATA>();
890 case MAXIMUM_VIA_COUNT:
return std::make_shared<DRC_RE_MAXIMUM_VIA_COUNT_CONSTRAINT_DATA>();
892 case MINIMUM_CLEARANCE:
return std::make_shared<DRC_RE_MINIMUM_CLEARANCE_CONSTRAINT_DATA>();
896 case MICROVIA_STACK_DEPTH:
return std::make_shared<DRC_RE_MICROVIA_STACK_DEPTH_CONSTRAINT_DATA>();
897 case HOLE_ASPECT_RATIO:
return std::make_shared<DRC_RE_HOLE_ASPECT_RATIO_CONSTRAINT_DATA>();
898 case MINIMUM_DRILL_SIZE:
return std::make_shared<DRC_RE_MINIMUM_DRILL_SIZE_CONSTRAINT_DATA>();
899 case MINIMUM_VIA_DIAMETER:
return std::make_shared<DRC_RE_MINIMUM_VIA_DIAMETER_CONSTRAINT_DATA>();
902 case SOLDERMASK_EXPANSION:
return std::make_shared<DRC_RE_SOLDERMASK_EXPANSION_CONSTRAINT_DATA>();
904 default:
return std::make_shared<DRC_RE_NUMERIC_INPUT_CONSTRAINT_DATA>();
909std::shared_ptr<DRC_RE_NUMERIC_INPUT_CONSTRAINT_DATA>
917 case COURTYARD_CLEARANCE:
return std::make_shared<DRC_RE_COURTYARD_CLEARANCE_CONSTRAINT_DATA>( aBase );
918 case PHYSICAL_CLEARANCE:
return std::make_shared<DRC_RE_PHYSICAL_CLEARANCE_CONSTRAINT_DATA>( aBase );
919 case CREEPAGE_DISTANCE:
return std::make_shared<DRC_RE_CREEPAGE_DISTANCE_CONSTRAINT_DATA>( aBase );
920 case HOLE_SIZE:
return std::make_shared<DRC_RE_HOLE_SIZE_CONSTRAINT_DATA>( aBase );
921 case HOLE_TO_HOLE_DISTANCE:
return std::make_shared<DRC_RE_HOLE_TO_HOLE_DISTANCE_CONSTRAINT_DATA>( aBase );
922 case MAXIMUM_VIA_COUNT:
return std::make_shared<DRC_RE_MAXIMUM_VIA_COUNT_CONSTRAINT_DATA>( aBase );
923 case MINIMUM_ANNULAR_WIDTH:
return std::make_shared<DRC_RE_MINIMUM_ANNULAR_WIDTH_CONSTRAINT_DATA>( aBase );
924 case MINIMUM_CLEARANCE:
return std::make_shared<DRC_RE_MINIMUM_CLEARANCE_CONSTRAINT_DATA>( aBase );
928 case MICROVIA_STACK_DEPTH:
return std::make_shared<DRC_RE_MICROVIA_STACK_DEPTH_CONSTRAINT_DATA>( aBase );
929 case HOLE_ASPECT_RATIO:
return std::make_shared<DRC_RE_HOLE_ASPECT_RATIO_CONSTRAINT_DATA>( aBase );
930 case MINIMUM_DRILL_SIZE:
return std::make_shared<DRC_RE_MINIMUM_DRILL_SIZE_CONSTRAINT_DATA>( aBase );
931 case MINIMUM_VIA_DIAMETER:
return std::make_shared<DRC_RE_MINIMUM_VIA_DIAMETER_CONSTRAINT_DATA>( aBase );
932 case SILK_TO_SILK_CLEARANCE:
return std::make_shared<DRC_RE_SILK_TO_SILK_CLEARANCE_CONSTRAINT_DATA>( aBase );
934 case SOLDERMASK_EXPANSION:
return std::make_shared<DRC_RE_SOLDERMASK_EXPANSION_CONSTRAINT_DATA>( aBase );
935 case SOLDERPASTE_EXPANSION:
return std::make_shared<DRC_RE_SOLDERPASTE_EXPANSION_CONSTRAINT_DATA>( aBase );
936 default:
return std::make_shared<DRC_RE_NUMERIC_INPUT_CONSTRAINT_DATA>( aBase );
941std::optional<DRC_RULE_EDITOR_UTILS::SELECTOR_CONDITION>
945 static wxRegEx netRe( wxT(
"^NetName\\s*==\\s*'([^']*)'\\s*$" ) );
946 static wxRegEx netclassRe1( wxT(
"^hasNetclass\\('([^']*)'\\)\\s*$" ) );
947 static wxRegEx netclassRe2( wxT(
"^NetClass\\s*==\\s*'([^']*)'\\s*$" ) );
948 static wxRegEx intersectsRe( wxT(
"^intersectsArea\\('([^']*)'\\)\\s*$" ) );
949 static wxRegEx enclosedRe( wxT(
"^enclosedByArea\\('([^']*)'\\)\\s*$" ) );
951 if( netRe.Matches( aExpr ) )
954 if( netclassRe1.Matches( aExpr ) )
957 if( netclassRe2.Matches( aExpr ) )
960 if( intersectsRe.Matches( aExpr ) )
963 if( enclosedRe.Matches( aExpr ) )
970std::shared_ptr<DRC_RE_BASE_CONSTRAINT_DATA>
976 case VIA_STYLE:
return std::make_shared<DRC_RE_VIA_STYLE_CONSTRAINT_DATA>( aBase );
978 return std::make_shared<DRC_RE_MINIMUM_TEXT_HEIGHT_THICKNESS_CONSTRAINT_DATA>( aBase );
979 case ROUTING_DIFF_PAIR:
return std::make_shared<DRC_RE_ROUTING_DIFF_PAIR_CONSTRAINT_DATA>( aBase );
980 case ROUTING_WIDTH:
return std::make_shared<DRC_RE_ROUTING_WIDTH_CONSTRAINT_DATA>( aBase );
981 case PERMITTED_LAYERS:
return std::make_shared<DRC_RE_PERMITTED_LAYERS_CONSTRAINT_DATA>( aBase );
982 case ALLOWED_ORIENTATION:
return std::make_shared<DRC_RE_ALLOWED_ORIENTATION_CONSTRAINT_DATA>( aBase );
983 case CUSTOM_RULE:
return std::make_shared<DRC_RE_CUSTOM_RULE_CONSTRAINT_DATA>( aBase );
984 case ABSOLUTE_LENGTH:
return std::make_shared<DRC_RE_ABSOLUTE_LENGTH_TWO_CONSTRAINT_DATA>( aBase );
986 case VIAS_UNDER_SMD:
return std::make_shared<DRC_RE_VIAS_UNDER_SMD_CONSTRAINT_DATA>( aBase );
994 return std::make_shared<DRC_RE_BOOL_INPUT_CONSTRAINT_DATA>( aBase );
996 wxLogWarning(
"No factory found for constraint type: %d", aType );
997 return std::make_shared<DRC_RE_BASE_CONSTRAINT_DATA>( aBase );
Information pertinent to a Pcbnew printed circuit board.
const wxString GetLayerName(PCB_LAYER_ID aLayer) const
Return the name of a aLayer.
void Parse(std::vector< std::shared_ptr< DRC_RULE > > &aRules, REPORTER *aReporter)
static bool IsNumericInputType(const DRC_RULE_EDITOR_CONSTRAINT_NAME &aConstraintType)
static wxString ConstraintToKicadDrc(DRC_RULE_EDITOR_CONSTRAINT_NAME aType)
Convert a constraint type into the keyword used in a .kicad_drc file.
static bool ValidateNumericValue(double aValue, bool aCanBeZero, const wxString &aLabel, VALIDATION_RESULT *aResult)
Validates a numeric value.
static bool ValidateAtLeastOneSelected(const std::vector< bool > &aSelected, const wxString &aLabel, VALIDATION_RESULT *aResult)
Validates that at least one option is selected.
static bool ValidateSelection(int aSelectionIndex, const wxString &aLabel, VALIDATION_RESULT *aResult)
Validates that a selection has been made (index >= 0).
static std::shared_ptr< DRC_RE_BASE_CONSTRAINT_DATA > CreateConstraintData(DRC_RULE_EDITOR_CONSTRAINT_NAME aType, const DRC_RE_BASE_CONSTRAINT_DATA &aBase)
Create the data object that holds a rule of the given constraint type, taking the identity fields fro...
static wxString GetConstraintCode(DRC_RULE_EDITOR_CONSTRAINT_NAME aConstraintType)
Translate a rule tree node type into the keyword used by the rules file for that constraint.
static bool ValidateNumericCtrl(wxTextCtrl *aTextCtrl, const wxString &aLabel, bool aCanBeZero, int *aErrorCount, wxString *aValidationMessage)
Validates a numeric input control, checking if the value is valid, non-empty, and greater than zero.
static bool ValidateMinMax(double aMin, double aMax, const wxString &aMinLabel, const wxString &aMaxLabel, VALIDATION_RESULT *aResult)
Validates that min <= max.
static bool ValidateMinPreferredMaxCtrl(wxTextCtrl *aMinTextCtrl, wxTextCtrl *aPreferredTextCtrl, wxTextCtrl *aMaxTextCtrl, const wxString &aMinLabel, const wxString &aPreferredLabel, const wxString &aMaxLabel, int *aErrorCount, wxString *aValidationMessage)
Validates the minimum, preferred, and maximum value controls, ensuring that:
static wxString FormatErrorMessage(int aErrorCount, const wxString &aErrorMessage)
static std::optional< DRC_RULE_EDITOR_CONSTRAINT_NAME > GetConstraintTypeFromCode(const wxString &aCode)
Resolve a constraint keyword from a rules file into the corresponding rule tree enumeration value.
static bool ValidateComboCtrl(wxComboBox *aComboBox, const wxString &aLabel, int *aErrorCount, wxString *aValidationMessage)
Validates a combo box control, ensuring that a selection has been made.
static bool SaveRules(const wxString &aFilename, const std::vector< std::shared_ptr< DRC_RE_BASE_CONSTRAINT_DATA > > &aRules, const BOARD *aBoard)
static void RegisterRuleConverter(RuleConverter aConverter)
static wxString TranslateTopBottomLayer(DRC_RULE_EDITOR_CONSTRAINT_NAME aConstraintType, bool aIsTop)
Translate a top/bottom selection to the appropriate layer clause or condition.
static bool ValidateCheckBoxCtrls(const std::vector< wxCheckBox * > &aCheckboxes, const wxString &aLabel, int *aErrorCount, wxString *aValidationMessage)
Validates a list of checkboxes, ensuring that at least one option is selected.
static bool ValidateNumericString(const wxString &aValueStr, bool aCanBeZero, bool aIntegerOnly, const wxString &aLabel, VALIDATION_RESULT *aResult)
Validates that a string represents a valid numeric value.
static bool ValidateMinMaxCtrl(wxTextCtrl *aMinTextCtrl, wxTextCtrl *aMaxTextCtrl, const wxString &aMinLabel, const wxString &aMaxLabel, int *aErrorCount, wxString *aValidationMessage)
Validates the minimum and maximum value controls, ensuring that the minimum value is not greater than...
std::function< std::shared_ptr< DRC_RE_BASE_CONSTRAINT_DATA >(const std::shared_ptr< DRC_RULE > &)> RuleConverter
static std::optional< SELECTOR_CONDITION > ParseSelectorCondition(const wxString &aExpr)
Match a condition that a net, netclass or area selector can show.
static std::shared_ptr< DRC_RE_NUMERIC_INPUT_CONSTRAINT_DATA > CreateNumericConstraintData(DRC_RULE_EDITOR_CONSTRAINT_NAME aType)
static DRC_LAYER_CATEGORY GetLayerCategoryForConstraint(DRC_RULE_EDITOR_CONSTRAINT_NAME aConstraintType)
Get the layer category for a constraint type.
static PCB_LAYER_ID TopBottomLayerId(DRC_RULE_EDITOR_CONSTRAINT_NAME aConstraintType, bool aIsTop)
The layer a side of the board means for a constraint, which is not copper for every one.
static bool ValidateMinPreferredMax(double aMin, double aPreferred, double aMax, const wxString &aMinLabel, const wxString &aPrefLabel, const wxString &aMaxLabel, VALIDATION_RESULT *aResult)
Validates that min <= preferred <= max.
static bool ValidateIntegerCtrl(wxTextCtrl *aTextCtrl, const wxString &aLabel, bool aCanBeZero, int *aErrorCount, wxString *aValidationMessage)
Validates an integer input control, ensuring the value is a valid integer, non-empty,...
static bool IsBoolInputType(const DRC_RULE_EDITOR_CONSTRAINT_NAME &aConstraintType)
static std::vector< std::shared_ptr< DRC_RE_BASE_CONSTRAINT_DATA > > ParseRules(const wxString &aRules)
Hold an error message and may be used when throwing exceptions containing meaningful error messages.
static wxString Name(PCB_LAYER_ID aLayerId)
Return the fixed name association with aLayerId.
VALIDATION_STATE GetValidationState() const
VALIDATION_STATE GetValidationState() const
VALIDATION_STATE GetValidationState() const
@ PreferredGreaterThanMax
@ MinGreaterThanPreferred
VALIDATION_STATE GetValidationState() const
VALIDATION_STATE GetValidationState() const
std::string utf8(const wxString &aText)
@ ANNULAR_WIDTH_CONSTRAINT
@ BRIDGED_MASK_CONSTRAINT
@ COURTYARD_CLEARANCE_CONSTRAINT
@ VIA_DIAMETER_CONSTRAINT
@ ZONE_CONNECTION_CONSTRAINT
@ DIFF_PAIR_GAP_CONSTRAINT
@ VIA_DANGLING_CONSTRAINT
@ SOLDER_MASK_SLIVER_CONSTRAINT
@ SILK_CLEARANCE_CONSTRAINT
@ EDGE_CLEARANCE_CONSTRAINT
@ MIN_RESOLVED_SPOKES_CONSTRAINT
@ TRACK_SEGMENT_LENGTH_CONSTRAINT
@ HOLE_ASPECT_RATIO_CONSTRAINT
@ PHYSICAL_HOLE_CLEARANCE_CONSTRAINT
@ THERMAL_SPOKE_WIDTH_CONSTRAINT
@ CONNECTION_WIDTH_CONSTRAINT
@ THERMAL_RELIEF_GAP_CONSTRAINT
@ MAX_UNCOUPLED_CONSTRAINT
@ MICROVIA_STACK_DEPTH_CONSTRAINT
@ HOLE_CLEARANCE_CONSTRAINT
@ SOLDER_PASTE_ABS_MARGIN_CONSTRAINT
@ SOLDER_MASK_EXPANSION_CONSTRAINT
@ PHYSICAL_CLEARANCE_CONSTRAINT
@ SOLDER_PASTE_REL_MARGIN_CONSTRAINT
@ HOLE_TO_HOLE_CONSTRAINT
DRC_RULE_EDITOR_CONSTRAINT_NAME
@ SILK_TO_SOLDERMASK_CLEARANCE
@ MINIMUM_CONNECTION_WIDTH
@ MINIMUM_THERMAL_RELIEF_SPOKE_COUNT
@ MINIMUM_TEXT_HEIGHT_AND_THICKNESS
@ COPPER_TO_HOLE_CLEARANCE
@ MATCHED_LENGTH_DIFF_PAIR
@ COPPER_TO_EDGE_CLEARANCE
@ MINIMUM_SOLDERMASK_SLIVER
DRC_LAYER_CATEGORY
Layer categories for filtering the layer selector dropdown.
@ NO_LAYER_SELECTOR
Hide layer selector entirely.
@ TOP_BOTTOM_ANY
Simplified top/bottom/any selector with custom translation.
@ SOLDERMASK_ONLY
F_Mask, B_Mask.
@ GENERAL_ANY_LAYER
All layers + inner/outer synthetic.
@ SOLDERPASTE_ONLY
F_Paste, B_Paste.
@ COPPER_ONLY
Copper layers + inner/outer synthetic.
@ SILKSCREEN_ONLY
F_SilkS, B_SilkS.
static wxString GetConstraintCodeFromType(DRC_CONSTRAINT_T aType)
std::unordered_map< DRC_RULE_EDITOR_CONSTRAINT_NAME, const char * > CODE_MAP
static void RegisterDefaultConverters()
static const CODE_MAP sCodeMap
static const REVERSE_CODE_MAP sCodeReverse
std::unordered_map< wxString, DRC_RULE_EDITOR_CONSTRAINT_NAME, wxStringHash, wxStringEqual > REVERSE_CODE_MAP
static std::vector< DRC_RULE_EDITOR_UTILS::RuleConverter > & GetRuleConverters()
PCB_LAYER_ID
A quick note on layer IDs:
wxString conditionExpression
Result of a validation operation.
void AddError(const wxString &aError)
JSON_SCHEMA_VALIDATOR validator(schema)