Rules#
- class pyedb.workflows.drc.drc.Rules(*, min_line_width: List[MinLineWidth] = [], min_clearance: List[MinClearance] = [], min_annular_ring: List[MinAnnularRing] = [], diff_pair_length_match: List[DiffPairLengthMatch] = [], back_drill_stub_length: List[BackDrillStubLength] = [], copper_balance: List[CopperBalance] = [])#
Centralised, serialisable container for all design-rule categories supported by the PyEDB DRC engine.
The class is a thin
pydanticmodel that provides:JSON/YAML round-trip via
parse_file,parse_obj,model_dump,model_dump_json.Type-safe, API to incrementally build rule decks without manipulating raw dictionaries.
Examples
>>> from pyedb.workflows.drc.drc import Rules >>> >>> rules = ( ... Rules() ... .add_min_line_width("pwr", "15 mil") ... .add_min_clearance("clk2data", "4 mil", "CLK*", "DATA*") ... .add_min_annular_ring("via5", "5 mil") ... .add_diff_pair_length_match("usb", tolerance="0.1 mm", pairs=[("USB_P", "USB_N")]) ... .add_copper_balance("top_bal", max_percent=10, layers=["TOP"]) ... ) >>> rules.model_dump_json(indent=2) >>> rules.write_json("my_rules.json")
- Attributes:
- min_line_width
List[MinLineWidth] Minimum acceptable trace width per layer or globally.
- min_clearance
List[MinClearance] Spacing requirements between nets (wild-cards allowed).
- min_annular_ring
List[MinAnnularRing] Minimum annular ring for drilled holes.
- diff_pair_length_match
List[DiffPairLengthMatch] Length-matching constraints for differential pairs.
- back_drill_stub_length
List[BackDrillStubLength] Maximum allowed back-drill stub length.
- copper_balance
List[CopperBalance] Copper-density balance limits per layer or zone.
- min_line_width
Methods
Rules.add_back_drill_stub_length(name, value)Append a maximum-allowed back-drill stub-length rule.
Rules.add_copper_balance(name, max_percent, ...)Append a copper-density balance rule.
Rules.add_diff_pair_length_match(name, ...)Append a length-matching rule for differential pairs.
Rules.add_min_annular_ring(name, value)Append a minimum-annular-ring rule for drilled holes.
Rules.add_min_clearance(name, value, net1, net2)Append a minimum-clearance rule between two nets (wild-cards allowed).
Rules.add_min_line_width(name, value[, layers])Append a minimum-line-width rule.
Rules.construct([_fields_set])Rules.copy(*[, include, exclude, update, deep])Returns a copy of the model.
Rules.dict(*[, include, exclude, by_alias, ...])Rules.from_dict(data)Alias for
model_validate.Rules.from_orm(obj)Rules.json(*[, include, exclude, by_alias, ...])Rules.model_construct([_fields_set])Creates a new instance of the Model class with validated data.
Rules.model_copy(*[, update, deep])!!! abstract "Usage Documentation"
Rules.model_dump(*[, mode, include, ...])!!! abstract "Usage Documentation"
Rules.model_dump_json(*[, indent, ...])!!! abstract "Usage Documentation"
Rules.model_json_schema([by_alias, ...])Generates a JSON schema for a model class.
Rules.model_parametrized_name(params)Compute the class name for parametrizations of generic classes.
Rules.model_post_init(context, /)Override this method to perform additional initialization after __init__ and model_construct.
Rules.model_rebuild(*[, force, ...])Try to rebuild the pydantic-core schema for the model.
Rules.model_validate(obj, *[, strict, ...])Validate a pydantic model instance.
Rules.model_validate_json(json_data, *[, ...])!!! abstract "Usage Documentation"
Rules.model_validate_strings(obj, *[, ...])Validate the given object with string data against the Pydantic model.
Rules.parse_file(path, *[, content_type, ...])Rules.parse_obj(obj)Rules.parse_raw(b, *[, content_type, ...])Rules.schema([by_alias, ref_template])Rules.schema_json(*[, by_alias, ref_template])Alias for
model_dump.Rules.update_forward_refs(**localns)Rules.validate(value)Attributes
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].