Drc#
- class pyedb.workflows.drc.drc.Drc(edb: pyedb.Edb)#
High-performance DRC engine for PyEDB.
This class provides a multi-threaded design rule checker that runs inside an open PyEDB session. It uses R-tree spatial indexing for efficient geometry queries and parallelizes all rule checks using ThreadPoolExecutor.
- Parameters:
- edb
pyedb.Edb Active EDB session that must already be open.
- edb
- Attributes:
- edb
pyedb.Edb Reference to the EDB instance.
- violations
listofdict List of violation dictionaries populated by
check().- idx_primitives
rtree.index.Index R-tree spatial index for primitive geometries.
- idx_vias
rtree.index.Index R-tree spatial index for via locations.
- idx_components
rtree.index.Index R-tree spatial index for component bounding boxes.
- edb
Examples
Basic DRC workflow:
>>> import pyedb >>> from pyedb.workflows.drc.drc import Drc, Rules >>> edb = pyedb.Edb("my_board.aedb") >>> rules = Rules.parse_file("rules.json") >>> drc = Drc(edb) >>> violations = drc.check(rules) >>> print(f"Found {len(violations)} violations")
Export to IPC-356A format:
>>> drc.to_ipc356a("review.ipc")
Overview#
Run all rules and return a list of violations. |
|
Write a complete IPC-D-356A netlist with DRC annotations. |
Import detail#
from pyedb.workflows.drc.drc import Drc
Attribute detail#
- Drc.edb#
Method detail#
- Drc.check(rules: Rules) list[dict[str, Any]]#
Run all rules and return a list of violations.
This method dispatches each rule to its appropriate handler and collects all violations. Successive calls overwrite previous results.
- Parameters:
- rules
Rules Validated rule container with design constraints.
- rules
- Returns:
Examples
>>> rules = Rules().add_min_line_width("trace", "3.5mil") >>> drc = Drc(edb) >>> violations = drc.check(rules) >>> for v in violations: ... print(f"{v['rule']}: {v}")
- Drc.to_ipc356a(file_path: str) None#
Write a complete IPC-D-356A netlist with DRC annotations.
This method exports the full netlist in IPC-D-356A format with all detected violations appended as comment lines. The file can be imported by CAM tools (Valor, Genesis, etc.) for fabrication review.
- Parameters:
- file_path
str Output file path. Overwrites existing files without warning.
- file_path
Notes
File format follows IPC-D-356A specification
Violations are appended as comment lines starting with
CIncludes netlist information (nets, primitives, padstack instances)
Compatible with major CAM software packages
Examples
>>> drc = Drc(edb) >>> violations = drc.check(rules) >>> drc.to_ipc356a("fab_review.ipc")
Export with violations:
>>> rules = Rules().add_min_line_width("trace", "3mil") >>> drc = Drc(edb) >>> drc.check(rules) >>> drc.to_ipc356a("review_with_violations.ipc")