I have a few questions about Custom Rules sytax. I’ve read everything in this thread when the rule syntax was still in the development and I’ve read the documentation but there are still a few things I’d like to ask.
1:
I’ve found these custom rules when searching for .kicad_dru
file for using with JLCPCB where I saw this rule:
# silkscreen
(rule "Minimum line width"
(constraint track_width (min 6mil))
(layer "F.Silkscreen") (layer "B.Silkscreen"))
The intention was to check for the silkscreen line thickness but there are 2 reasons why this rule can’t work:
-
track_width
constraint type can not be used to check the line thickness andthickness
constraint type doesn’t exit -
layer
can not be specified more than once in the same rule (only the last layer specified is in effect)
Or is there a way to specfy layer more than once without wildards?
This is how I tested if layer
can be specified more than once. I created the rule:
(rule "Test"
(constraint track_width (min 100 mil))
(layer "F.Cu")
(layer "B.Cu"))
and the result was only errors on B.Cu
layer were reported by DRC.
When I used a wildcard:
(rule "Test"
(constraint track_width (min 100 mil))
(layer "?.Cu"))
then the rule worked as expected.
I tried:
(rule "Test"
(constraint track_width (min 100 mil))
(layer "F.Cu") || (layer "B.Cu"))
and
(rule "Test"
(constraint track_width (min 100 mil))
(layer "F.Cu" || "B.Cu"))
but both was a syntax error.
2:
There are separate parameters for Min. Via hole size, Min. Via diameter and PTH hole Size at JLCPCB.
Is there a difference between Via hole
and PTH hole
?
The rules for these in the document I linked are:
(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()"))
but that doesn’t seem right. The constraint for Minimum Via Diameter should probably be via_diameter
instead of length
.
And wouldn’t the condition (condition "A.isPlated()")
be true
for VIA too - resulting in conditions (condition "A.Type == 'via'"))
to never be triggered?
BTW, I am not sure from where is number 0.7 mm in PTH Size rule - maybe author calculated it as 0.2*PI
and rounded it to 0.7 to calculate the length of the annular ring by using a diameter?
3:
Is there a way to check the silkscreen miminum line width using custom rules?
I could write:
(rule "Minimum silkscreen line width"
(condition "A.Type == 'Graphic' && A.Thickness < 5 mil"))
but then there should be some constraint which would always trigger the violation in case the condition is true.
4.
Are there any examples of using AB.
object in custom rules? That would be useful.
Of course, it would be nice if someone could posto or link to a complete and correct custom rules for 2 layer PCB production with JLCPCB.