Kicad 9 Custom Rules with Netclass

Hi, I want to do a rule for width of controlled impedance track, where on the outer layers I need 0,25mm and inner layers 0,1mm.

How does work the priority order of the custom rules? I’m using Kicad 9, and wrote like this below but it’s not working.
I realized that I need to always specify the Default Netclasse together.
I tried also on the 60R_inner below to add && A.existsOnLayer(‘In2.Cu’) on the first condition but it also did not change the width.


(version 1)
(rule 60R_inner
(condition "(A.hasNetclass('60R') && A.hasNetclass('Default'))")
(constraint physical_clearance (min 0.2mm))
(constraint track_width (min 0.1mm) (max 0.1mm) (opt 0.1mm))
)
(rule 60R_outer
(layer outer)
(condition "(A.hasNetclass('60R') && A.hasNetclass('Default'))")
(constraint physical_clearance (min 0.2mm))
(constraint track_width (min 0.25mm) (max 0.25mm) (opt 0.25mm))
)

‘physical_clearance’ is used for same-net clearance. ‘clearance’ is the normal most basic copper constraint.

Ok, I will fix that.
Regarding the track width and priority, you have any knowledge?

This should only be true if you want the rule to apply to nets in both netclass 60R and Default. If all the nets are in both netclasses, you can just specify 60R.

1 Like

No matter the order I write the rule, it’s applying the outer width first and keeping it.
Could be that this point of priority was forgotten? Should I open a ticket on git for it?

(version 1)

Clearance for 60R nets

(rule 60R_clearance
(condition “A.hasNetclass(‘60R’)”)
(constraint clearance (min 0.2mm)))

(rule 60R_outer
(layer outer)
(condition “(A.hasNetclass(‘60R’))”)
(constraint track_width (min 0.25mm) (max 0.25mm) (opt 0.25mm)))

(rule 60R_inner
(condition “(A.hasNetclass(‘60R’) && A.existsOnLayer(‘In2.Cu’))”)
(constraint track_width (min 0.1mm) (max 0.1mm) (opt 0.1mm)))

Does DRC catch that incorrect width when run? Also, while routing, do you have the little button in the top left selected for “continue track width” (not sure the exact name, away from KiCad at the moment).

Hi, you solve the mystery.
I did not check this button here:
image

Now is working for outer layers one width, and inner layers other.
The order you write does not matter on my case, but I would prefer to have a priority order like Altium.

Thank you very much!