1
+ # Extracted from https://gist.github.com/darkxst/f713268e5469645425eed40115fb8b49
2
+
3
+ (version 1)
4
+
5
+ # 2-layer, 1oz copper
6
+ (rule "Minimum Trace Width (outer layer)"
7
+ (constraint track_width (min 5mil))
8
+ (layer outer)
9
+ (condition "A.Type == 'track'"))
10
+
11
+ (rule "Minimum Trace Spacing (outer layer)"
12
+ (constraint clearance (min 5mil))
13
+ (layer outer)
14
+ (condition "A.Type == 'track' && B.Type == A.Type"))
15
+
16
+ # 4-layer
17
+ (rule "Minimum Trace Width and Spacing (inner layer)"
18
+ (constraint track_width (min 3.5mil))
19
+ (layer inner)
20
+ (condition "A.Type == 'track'"))
21
+
22
+ (rule "Minimum Trace Spacing (inner layer)"
23
+ (constraint clearance (min 3.5mil))
24
+ (layer inner)
25
+ (condition "A.Type == 'track' && B.Type == A.Type"))
26
+
27
+ # silkscreen (Kicad 7 only)
28
+ (rule "Minimum Text"
29
+ (constraint text_thickness (min 0.15mm))
30
+ (constraint text_height (min 1mm))
31
+ (layer "?.Silkscreen"))
32
+
33
+ (rule "Pad to Silkscreen"
34
+ (constraint silk_clearance (min 0.15mm))
35
+ (layer outer)
36
+ (condition "A.Type == 'pad' && (B.Type == 'text' || B.Type == 'graphic')"))
37
+
38
+ # edge clearance
39
+ (rule "Trace to Outline"
40
+ (constraint edge_clearance (min 0.3mm))
41
+ (condition "A.Type == 'track'"))
42
+
43
+ # This would override board outline and milled areas
44
+ #(rule "Trace to V-Cut"
45
+ # (constraint clearance (min 0.4mm))
46
+ # (condition "A.Type == 'track' && B.Layer == 'Edge.Cuts'"))
47
+
48
+ # drill/hole size
49
+ (rule "drill hole size (mechanical)"
50
+ (constraint hole_size (min 0.2mm) (max 6.3mm)))
51
+
52
+ (rule "Minimum Via Hole Size"
53
+ (constraint hole_size (min 0.2mm))
54
+ (condition "A.Type == 'via'"))
55
+
56
+ (rule "Minimum Via Diameter"
57
+ (constraint via_diameter (min 0.45mm))
58
+ (condition "A.Type == 'via'"))
59
+
60
+ (rule "PTH Hole Size"
61
+ (constraint hole_size (min 0.2mm) (max 6.35mm))
62
+ (condition "A.isPlated()"))
63
+
64
+ (rule "Minimum Non-plated Hole Size"
65
+ (constraint hole_size (min 0.5mm))
66
+ (condition "A.Type == 'pad' && !A.isPlated()"))
67
+
68
+ (rule "Minimum Castellated Hole Size"
69
+ (constraint hole_size (min 0.6mm))
70
+ (condition "A.Type == 'pad' && A.Fabrication_Property == 'Castellated pad'"))
71
+
72
+ # clearance
73
+ (rule "hole to hole clearance (different nets)"
74
+ (constraint hole_to_hole (min 0.5mm))
75
+ (condition "A.Net != B.Net"))
76
+
77
+ (rule "via to track clearance"
78
+ (constraint hole_clearance (min 0.254mm))
79
+ (condition "A.Type == 'via' && B.Type == 'track'"))
80
+
81
+ (rule "via to via clearance (same nets)"
82
+ (constraint hole_to_hole (min 0.254mm))
83
+ (condition "A.Type == 'via' && B.Type == A.Type && A.Net == B.Net"))
84
+
85
+ (rule "pad to pad clearance (with hole, different nets)"
86
+ (constraint hole_to_hole (min 0.5mm))
87
+ (condition "A.Type == 'pad' && B.Type == A.Type && A.Net != B.Net"))
88
+
89
+ (rule "pad to pad clearance (without hole, different nets)"
90
+ (constraint clearance (min 0.127mm))
91
+ (condition "A.Type == 'pad' && B.Type == A.Type && A.Net != B.Net"))
92
+
93
+ (rule "NPTH to Track clearance)"
94
+ (constraint hole_clearance (min 0.254mm))
95
+ (condition "A.Pad_Type == 'NPTH, mechanical' && B.Type == 'track'"))
96
+
97
+ (rule "PTH to Track clearance)"
98
+ (constraint hole_clearance (min 0.33mm))
99
+ (condition "A.isPlated() && B.Type == 'track'"))
100
+
101
+ (rule "Pad to Track clearance)"
102
+ (constraint clearance (min 0.2mm))
103
+ (condition "A.isPlated() && B.Type == 'track'"))
0 commit comments