Skip to content

Instantly share code, notes, and snippets.

@sethfischer
Forked from darkxst/rules.txt
Created April 2, 2024 07:05
Show Gist options
  • Select an option

  • Save sethfischer/ca4ad368097fd965f45e7bf84c99179d to your computer and use it in GitHub Desktop.

Select an option

Save sethfischer/ca4ad368097fd965f45e7bf84c99179d to your computer and use it in GitHub Desktop.

Revisions

  1. @darkxst darkxst revised this gist Oct 19, 2023. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion rules.txt
    Original file line number Diff line number Diff line change
    @@ -36,7 +36,7 @@

    # edge clearance
    (rule "Trace to Outline"
    (constraint edge_clearance (min 0.2mm))
    (constraint edge_clearance (min 0.3mm))
    (condition "A.Type == 'track'"))

    # This would override board outline and milled areas
  2. @darkxst darkxst revised this gist Mar 4, 2023. 1 changed file with 11 additions and 3 deletions.
    14 changes: 11 additions & 3 deletions rules.txt
    Original file line number Diff line number Diff line change
    @@ -2,19 +2,27 @@
    #Kicad 7

    # 2-layer, 1oz copper
    (rule "Minimum Trace Width and Spacing (outer layer)"
    (rule "Minimum Trace Width (outer layer)"
    (constraint track_width (min 5mil))
    (constraint clearance (min 5mil))
    (layer outer)
    (condition "A.Type == 'track'"))

    (rule "Minimum Trace Spacing (outer layer)"
    (constraint clearance (min 5mil))
    (layer outer)
    (condition "A.Type == 'track' && B.Type == A.Type"))

    # 4-layer
    (rule "Minimum Trace Width and Spacing (inner layer)"
    (constraint track_width (min 3.5mil))
    (constraint clearance (min 3.5mil))
    (layer inner)
    (condition "A.Type == 'track'"))

    (rule "Minimum Trace Spacing (inner layer)"
    (constraint clearance (min 3.5mil))
    (layer inner)
    (condition "A.Type == 'track' && B.Type == A.Type"))

    # silkscreen (Kicad 7 only)
    (rule "Minimum Text"
    (constraint text_thickness (min 0.15mm))
  3. @darkxst darkxst revised this gist Feb 17, 2023. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion rules.txt
    Original file line number Diff line number Diff line change
    @@ -38,7 +38,7 @@

    # drill/hole size
    (rule "drill hole size (mechanical)"
    (constraint hole_size (min 0.2mm) (max 6.3mm))
    (constraint hole_size (min 0.2mm) (max 6.3mm)))

    (rule "Minimum Via Hole Size"
    (constraint hole_size (min 0.2mm))
  4. @darkxst darkxst revised this gist Feb 17, 2023. 1 changed file with 1 addition and 2 deletions.
    3 changes: 1 addition & 2 deletions rules.txt
    Original file line number Diff line number Diff line change
    @@ -39,14 +39,13 @@
    # drill/hole size
    (rule "drill hole size (mechanical)"
    (constraint hole_size (min 0.2mm) (max 6.3mm))
    (condition "A.Type == 'hole'"))

    (rule "Minimum Via Hole Size"
    (constraint hole_size (min 0.2mm))
    (condition "A.Type == 'via'"))

    (rule "Minimum Via Diameter"
    (constraint length (min 0.4mm))
    (constraint via_diameter (min 0.45mm))
    (condition "A.Type == 'via'"))

    (rule "PTH Hole Size"
  5. @darkxst darkxst revised this gist Feb 17, 2023. 1 changed file with 4 additions and 4 deletions.
    8 changes: 4 additions & 4 deletions rules.txt
    Original file line number Diff line number Diff line change
    @@ -38,23 +38,23 @@

    # drill/hole size
    (rule "drill hole size (mechanical)"
    (constraint hole (min 0.2mm) (max 6.3mm))
    (constraint hole_size (min 0.2mm) (max 6.3mm))
    (condition "A.Type == 'hole'"))

    (rule "Minimum Via Hole Size"
    (constraint hole (min 0.2mm))
    (constraint hole_size (min 0.2mm))
    (condition "A.Type == 'via'"))

    (rule "Minimum Via Diameter"
    (constraint length (min 0.4mm))
    (condition "A.Type == 'via'"))

    (rule "PTH Hole Size"
    (constraint hole (min 0.2mm) (max 6.35mm))
    (constraint hole_size (min 0.2mm) (max 6.35mm))
    (condition "A.isPlated()"))

    (rule "Minimum Non-plated Hole Size"
    (constraint hole (min 0.5mm))
    (constraint hole_size (min 0.5mm))
    (condition "A.Type == 'pad' && !A.isPlated()"))

    (rule "Minimum Castellated Hole Size"
  6. @darkxst darkxst revised this gist Feb 17, 2023. No changes.
  7. @darkxst darkxst revised this gist Feb 17, 2023. 1 changed file with 29 additions and 21 deletions.
    50 changes: 29 additions & 21 deletions rules.txt
    Original file line number Diff line number Diff line change
    @@ -1,25 +1,28 @@
    (version 1)
    #Kicad 7

    # 4-layer, 1oz copper
    (rule "Minimum Trace Width and Spacing (inner layer)"
    # 2-layer, 1oz copper
    (rule "Minimum Trace Width and Spacing (outer layer)"
    (constraint track_width (min 5mil))
    (constraint clearance (min 5mil))
    (layer inner)
    (layer outer)
    (condition "A.Type == 'track'"))

    (rule "Minimum Trace Width and Spacing (outer layer)"
    # 4-layer
    (rule "Minimum Trace Width and Spacing (inner layer)"
    (constraint track_width (min 3.5mil))
    (constraint clearance (min 3.5mil))
    (layer outer)
    (layer inner)
    (condition "A.Type == 'track'"))

    # silkscreen
    (rule "Minimum line width"
    (constraint track_width (min 6mil))
    (layer "F.Silkscreen") (layer "B.Silkscreen"))
    # silkscreen (Kicad 7 only)
    (rule "Minimum Text"
    (constraint text_thickness (min 0.15mm))
    (constraint text_height (min 1mm))
    (layer "?.Silkscreen"))

    (rule "Pad to Silkscreen"
    (constraint clearance (min 0.15mm))
    (constraint silk_clearance (min 0.15mm))
    (layer outer)
    (condition "A.Type == 'pad' && (B.Type == 'text' || B.Type == 'graphic')"))

    @@ -28,9 +31,10 @@
    (constraint edge_clearance (min 0.2mm))
    (condition "A.Type == 'track'"))

    (rule "Trace to V-Cut"
    (constraint clearance (min 0.4mm))
    (condition "A.Type == 'track' && B.Layer == 'Edge.Cuts'"))
    # This would override board outline and milled areas
    #(rule "Trace to V-Cut"
    # (constraint clearance (min 0.4mm))
    # (condition "A.Type == 'track' && B.Layer == 'Edge.Cuts'"))

    # drill/hole size
    (rule "drill hole size (mechanical)"
    @@ -49,26 +53,30 @@
    (constraint hole (min 0.2mm) (max 6.35mm))
    (condition "A.isPlated()"))

    (rule "PTH Size"
    (constraint length (min 0.7mm) (max 6.35mm))
    (condition "A.isPlated()"))

    (rule "Minimum Non-plated Hole Size"
    (constraint hole (min 0.5mm))
    (condition "A.Type == 'pad' && !A.isPlated()"))

    (rule "Minimum Castellated Hole Size"
    (constraint hole_size (min 0.6mm))
    (condition "A.Type == 'pad' && A.Fabrication_Property == 'Castellated pad'"))

    # clearance
    (rule "hole to hole clearance (different nets)"
    (constraint hole_to_hole (min 0.5mm))
    (condition "A.Net != B.Net"))

    (rule "via to track clearance"
    (constraint hole_clearance (min 0.254mm))
    (condition "A.Type == 'via' && B.Type == 'track'"))

    (rule "via to via clearance (same nets)"
    (constraint hole_clearance (min 0.254mm))
    (condition "A.Type == 'via' && B.Type == 'via' && A.Net == B.Net"))
    (constraint hole_to_hole (min 0.254mm))
    (condition "A.Type == 'via' && B.Type == A.Type && A.Net == B.Net"))

    (rule "pad to pad clearance (with hole, different nets)"
    (constraint hole_clearance (min 0.5mm))
    (condition "A.Type == 'through-hole' && B.Type == A.Type && A.Net != B.Net"))
    (constraint hole_to_hole (min 0.5mm))
    (condition "A.Type == 'pad' && B.Type == A.Type && A.Net != B.Net"))

    (rule "pad to pad clearance (without hole, different nets)"
    (constraint clearance (min 0.127mm))
  8. @denniskupec denniskupec created this gist Jun 5, 2021.
    87 changes: 87 additions & 0 deletions rules.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,87 @@
    (version 1)

    # 4-layer, 1oz copper
    (rule "Minimum Trace Width and Spacing (inner layer)"
    (constraint track_width (min 5mil))
    (constraint clearance (min 5mil))
    (layer inner)
    (condition "A.Type == 'track'"))

    (rule "Minimum Trace Width and Spacing (outer layer)"
    (constraint track_width (min 3.5mil))
    (constraint clearance (min 3.5mil))
    (layer outer)
    (condition "A.Type == 'track'"))

    # silkscreen
    (rule "Minimum line width"
    (constraint track_width (min 6mil))
    (layer "F.Silkscreen") (layer "B.Silkscreen"))

    (rule "Pad to Silkscreen"
    (constraint clearance (min 0.15mm))
    (layer outer)
    (condition "A.Type == 'pad' && (B.Type == 'text' || B.Type == 'graphic')"))

    # edge clearance
    (rule "Trace to Outline"
    (constraint edge_clearance (min 0.2mm))
    (condition "A.Type == 'track'"))

    (rule "Trace to V-Cut"
    (constraint clearance (min 0.4mm))
    (condition "A.Type == 'track' && B.Layer == 'Edge.Cuts'"))

    # drill/hole size
    (rule "drill hole size (mechanical)"
    (constraint hole (min 0.2mm) (max 6.3mm))
    (condition "A.Type == 'hole'"))

    (rule "Minimum Via Hole Size"
    (constraint hole (min 0.2mm))
    (condition "A.Type == 'via'"))

    (rule "Minimum Via Diameter"
    (constraint length (min 0.4mm))
    (condition "A.Type == 'via'"))

    (rule "PTH Hole Size"
    (constraint hole (min 0.2mm) (max 6.35mm))
    (condition "A.isPlated()"))

    (rule "PTH Size"
    (constraint length (min 0.7mm) (max 6.35mm))
    (condition "A.isPlated()"))

    (rule "Minimum Non-plated Hole Size"
    (constraint hole (min 0.5mm))
    (condition "A.Type == 'pad' && !A.isPlated()"))

    # clearance
    (rule "via to track clearance"
    (constraint hole_clearance (min 0.254mm))
    (condition "A.Type == 'via' && B.Type == 'track'"))

    (rule "via to via clearance (same nets)"
    (constraint hole_clearance (min 0.254mm))
    (condition "A.Type == 'via' && B.Type == 'via' && A.Net == B.Net"))

    (rule "pad to pad clearance (with hole, different nets)"
    (constraint hole_clearance (min 0.5mm))
    (condition "A.Type == 'through-hole' && B.Type == A.Type && A.Net != B.Net"))

    (rule "pad to pad clearance (without hole, different nets)"
    (constraint clearance (min 0.127mm))
    (condition "A.Type == 'pad' && B.Type == A.Type && A.Net != B.Net"))

    (rule "NPTH to Track clearance)"
    (constraint hole_clearance (min 0.254mm))
    (condition "A.Pad_Type == 'NPTH, mechanical' && B.Type == 'track'"))

    (rule "PTH to Track clearance)"
    (constraint hole_clearance (min 0.33mm))
    (condition "A.isPlated() && B.Type == 'track'"))

    (rule "Pad to Track clearance)"
    (constraint clearance (min 0.2mm))
    (condition "A.isPlated() && B.Type == 'track'"))