Custom rule hole-to-hole not working as expected

Hi,

I have just started exploring the possibilities of custom design rules in pcbnew.
I ultimately have different constraints for different nets, so I need custom rules, but somehow it doesn’t work as expected. I’m using KiCAD7 btw.

Here is the rule I am playing with:

(version 1)
(rule “Cust Distance between holes”
(constraint hole_to_hole (min 1.5mm))
(condition “((A.Type == ‘Via’)||(A.Type == ‘Hole’)) && ((B.Type == ‘Via’)||(B.Type == ‘Hole’))”))

So, I want to catch all hole distances that are below 1.5mm for now.
My test layout consists of an inline thru hole transistor with 1.27mm hole to hole distance and 2 vias which are also 1.2mm apart from each other and from the transistor holes.
So, the custom rule should flag all holes, but for some obscure reason it only flags the vias.

What am I doing wrong? How can I detect the hole-to-hole violations to the thru hole component holes and between these?
Btw, setting hole-to-hole clearance in constraints to 1.5mm I detect all violations all right.

If you just want to catch all hole-to-hole violations you don’t need the condition at all. The constraint automatically checks all holes. There’s no type “Hole”. Your condition is effectually A.Type == 'Via' && B.Type == 'Via'. It finds Via/Via holes, not Via/Pad holes.

Great, thanks, removing the condition I can detect all violations.

There’s no type “Hole”

There is, see Custom rules syntax help:
Item Types:
buried_via
graphic
hole
micro_via
pad
text
track
via
zone

Now, I wonder what type “hole” stands for!

image

PCB Editor | 8.0 | English | Documentation | KiCad :

One of “Bitmap”, “Dimension”, “Field”, “Footprint”, “Graphic”, “Group”, “Leader”, “Pad”, “Target”, “Text”, “Text Box”, “Track”, “Via”, or “Zone”.

I believe the list you’re quoting is the tokens allowed in a disallow constraint. This is not the same as the types of objects for an A.Type condition. (I recognize this is somewhat confusing).

Note that the syntax help is intended as a quick reference and isn’t perfect. The documentation eelik linked has more detail, and you can also lean pretty hard on the autocomplete as eelik indicated.

Autocomplete lists are in pcbnew/dialogs/panel_setup_rules.cpp. There’s a bug either in the Type list or in the Pcbnew documentation: the autocomplete list doesn’t have “Field”.

Good catch. I vaguely remember some shuffling of what object type various text objects had late in v8 development, but I can’t find the commits to back that up, so maybe I’m remembering wrong.

In any case, a quick DRC experiment confirms that a field is type Text, as does my read of pcbnew/pcb_field.cpp. I will update the docs.

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.