Design rules

Represents kicad design rules.

class edea.kicad.design_rules.ConstraintArgType(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: StrEnum

Different types of arguments used in PCB design constraints.

annular_width = 'annular_width'

Width of the annular ring in a plated through-hole.

assertion = 'assertion'

Custom assertion statement within a constraint.

clearance = 'clearance'

Minimum distance between two objects on the PCB layout.

connection_width = 'connection_width'

Width of a connection element in the design.

courtyard_clearance = 'courtyard_clearance'

Minimum distance between an object and its courtyard.

diff_pair_gap = 'diff_pair_gap'

Spacing between two traces in a differential pair.

diff_pair_uncoupled = 'diff_pair_uncoupled'

Diff pair is not routed together.

disallow = 'disallow'

Constraint that disallows a specific action or configuration.

edge_clearance = 'edge_clearance'

Minimum distance between an object and the PCB edge.

hole_clearance = 'hole_clearance'

Minimum distance between an object and a hole.

hole_size = 'hole_size'

Diameter of a drilled hole.

hole_to_hole = 'hole_to_hole'

Distance between two drilled holes.

length = 'length'

Length of a trace or other geometric element.

min_resolved_spokes = 'min_resolved_spokes'

Minimum number of connected spokes in a thermal relief pattern.

physical_clearance = 'physical_clearance'

Physical clearance between objects in the manufactured PCB.

physical_hole_clearance = 'physical_hole_clearance'

Physical clearance between an object and a drilled hole in the manufactured PCB.

silk_clearance = 'silk_clearance'

Minimum distance between an object and the silkscreen layer.

text_height = 'text_height'

Height of text elements on the PCB.

text_thickness = 'text_thickness'

Thickness of text stroke on the PCB.

thermal_relief_gap = 'thermal_relief_gap'

Gap between a trace and the edge of a thermal relief pattern.

thermal_spoke_width = 'thermal_spoke_width'

Width of spokes in a thermal relief pattern.

track_width = 'track_width'

Width of a conductive trace on the PCB.

via_count = 'via_count'

Number of vias used in a connection.

via_diameter = 'via_diameter'

Diameter of a via (plated through-hole).

zone_connection = 'zone_connection'

Connection between a zone and another object on the PCB.

class edea.kicad.design_rules.Rule(name: str, constraint: tuple[ConstraintArgType, tuple[str, ...] | str] | tuple[ConstraintArgType, tuple[str, ...] | str, tuple[str, ...] | str], layer: str | None = None, severity: Severity | None = None, condition: str | None = '')

Bases: KicadExpr

A design rule for a KiCad PCB layout.

Parameters:
  • name – The name of the rule.

  • constraint – The design rule constraint.

  • layer – The PCB layer where the rule applies.

  • severity – The severity level of the rule violation.

  • condition – An optional KiCad expression representing a condition under which the rule applies.

name: str
constraint: tuple[ConstraintArgType, tuple[str, ...] | str] | tuple[ConstraintArgType, tuple[str, ...] | str, tuple[str, ...] | str]
layer: str | None = None
severity: Severity | None = None
condition: str | None = ''
kicad_expr_tag_name: ClassVar[Literal['rule']] = 'rule'
class edea.kicad.design_rules.DesignRuleSet(version: ~typing.Literal['1'] = '1', rules: list[~edea.kicad.design_rules.Rule] = <factory>)

Bases: KicadExpr

A collection of design rules for a KiCad PCB layout.

Parameters:
  • version – supported version of kicad_dru file.

  • rules – A list of Rule objects defining the individual design rules for the PCB layout.

version: Literal['1'] = '1'
rules: list[Rule]
kicad_expr_tag_name: ClassVar[Literal['design_rules']] = 'design_rules'
noramlize()

Remove duplicate rules.

Returns:

The ‘DesignRules’ object itself after removing duplicates.

extend(other: DesignRuleSet)

Merge another set of design rules into the current one.

Parameters:

other – Another set of design rules.

Returns:

The extended design rules object.

Raises:

TypeError – : If the provided argument is not a ‘DesignRules’ instance.