How to: Custom Rule for "Courtyard overlap"

Hello,
I want to exclude a DRC error for 2 components as their courtyards overlap.
So I tried this custom rule:

(version 1)
(rule "Courtyardlydardly"
	#ignore courtyard overlap
	(severity exclusion)
	#(layer outer)
	(condition "A.intersectsCourtyard('C212') && B.intersectsCourtyard('C211')")
)

But of course this doesn’t work as you’re reading this right now :grinning:

If it’s just for those specific two footprints, you can just right click on the DRC message and then select “Exclude this Violation”. No need for rules at all. KiCad maintains a list of these excluded violations, so you can revisit or modify them later.

Below a screenshot form ERC, which uses the same mechanism as DRC.

Yes, I know that, but I want to learn setting up custom rules and this is my first try on it. So I need debugging help please :sweat_smile:

Debugging? Do you want to know what your rule does? Try changing the severity clause to

(constraint clearance (min 100mm))

, do the DRC check and you will soon understand why it doesn’t work. :smiley:

This should do what you want:

(severity exclusion)
(constraint courtyard_clearance)
(condition "A.Reference == 'C212' && B.Reference == 'C211'")
1 Like