Keepout area custom Rule allow specific parts/pads/tracks

Hello,

I found the feature of custom DRC rules and so I tried it out in a simple example (see schematic and layout below). The idea is to create a keepout area around the oscillator circuit and only the capacitors C1 and C2 and the crystal Y1 are allowed in this area. The keepout zone is on all areas so the capacitor C3 is not allowed in this area. Furthermore all signals GND_C, OSCIN and OSCOUT are allowed.

The idea (i don’t like it) is to create a keepout zone called “RestrictedAreaCrystal” around the circuit but don’t set any restrictions:
grafik

Then I create custom DRC rules:

To allow vias inside of this area the custom rule is:

# only vias of the net "GND_C" are allowed in this area
(rule "keepout crystal area via"
   (constraint disallow via)
   (condition "A.insideArea('RestrictedAreaCrystal') && A.NetName != '/GND_C'")
)

To use it for vias, pads and tracks too:

(rule "keepout crystal area track pad"
   (constraint disallow track pad via)
   (condition "A.insideArea('RestrictedAreaCrystal') && (A.NetName != '/GND_C' && A.NetName != '/OSCIN' && A.NetName != '/OSCOUT')"))

Schematic:

Layout:

One thing I don’t like on this approach is, that I uncheck all disallowances from the keepout area menu.

What is the best approach solving this problem

  1. Creating such rules and allowing everything from the keepout area menu
  2. Excluding the errors once they occur
  3. Something else

KicadCustomKeepOut.zip (24.0 KB)

I think this OR logic doesn’t work…

Thanks @eelik for your response. Why it would not work?

It’s always true, so it disallows via/pad/track always. To simplify


x != 1 OR x != 2

is always true, with any value of x.

Ah yes sorry it must be && I forgott about the negation. I updated it in the description Thanks!
But I still don’t like this, because at first I allow everything in the keepout area which might be error prone. Is there an other way to do that?

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