Need some guinea pigs for a rule-based DRC <<PROTOTYPE>>

A related question, even though it’s not directly about this new prototype.

If I have Copper edge clearance set to 0 in Board Settings -> Design Rules -> Constraints, I can place a footprint pad very near to the edge. However, I can’t place the pad on the edge so that it overlaps the edge line middle line.

Is this on purpose? If the new DRC rule system works in a similar way, i.e. zero means “can be next to, but not overlap”, how do I allow placing a pad on the line, which is the same as “ignore copper-to-edge altogether”?

I’m not sure what you’re trying to do here. You’ve told the DRC engine that tracks inside a keepout can have 0 clearance with the keepout (that is, they can touch). Since there’s no default clearance with a keepout they could anyway.

If you’re trying to ban the track from the keepout you need a “disallow” constraint, not a “clearance” constraint.

All that aside, it shouldn’t be giving blank errors. I’ll look in to that…

That wasn’t a ready to be used rule yet, I’m just trying to use the keepout as a local area (as has been instructed). Actually the blank error was the reason I posted, so that I could go on debugging.

Wait a second. How’s that compared to the “BGA neckdown” rule in the Syntax help? There’s condition “A.insideCourtyard” there. Then constraint “clearance ()()”. But that clearance isn’t between an item inside the courtyard and the courtyard area.

Oops; you’re right. I read your rule as A && B, but you’re using A for both tests.

So that’s saying if A appears inside the keepout then it can touch anything.

If it’s of interest, I’m trying to find out how to solve the problem of castellation and other footprints which are on edges (you probably remember my comment in https://gitlab.com/kicad/code/kicad/-/issues/1790#note_400349897).

It came to my mind that footprints can have named keepouts and keepouts can be used as local rule areas. There can also be many keepouts with the same name. A natural conclusion:

  • I can add a named keepout to a castellated footprint
  • I can place many such footprints into a board
  • I can define a rule for local areas with A.insideArea('keepout_inside_castellated_footprint')
  • The rule can say that edge cut/copper (and THT hole) clearance is ignored
  • That condition pertains to all those footprints.

And the problem would be solved without resorting to board-specific keepout areas.

@eelik Please hold on a bit with testing. We are not done yet with the DRC redesign, a lot of stuff will change…

Tom

The clearance constraint is only for copper (conducting) elements (traces/vias/zones). For checking keepout violations, there’s the disallow constraint:

(rule "keepout"
    (condition "A.insideArea('fpko')")
    (constraint disallow track via)
)

Once again, this is not fully implemented yet, so don’t expect it will work as advertised until we officially announce the new DRC…

T.

So, what you ask is what you get… :slight_smile: I’m not trying to make a design, or not even to test the system for errors, I’m trying to find out what I should be capable of and to give feedback about possible use cases.

2 Likes

Don’t worry @eelik, you won’t be able to please both of us. Tom’s development style and my development style are at opposing ends of the feedback axis. :wink:

Most of the heavy lifting at present is being done by Tom, so favouring his approach right now probably makes most sense…

OK, thanks. All good as long as things to consider are kept in storage for later and aren’t forgotten.

I want a clearance inside the Area of 0.2mm only on the top layer. Any ideas how to formulate that condition?

I used the filled zone for that…

(rule HVSVN-GDVR
(layer outer)
(constraint clearance (min 0.2mm))
(condition “A.insideArea(‘tl’) && B.onLayer(‘TOP’)”)
)

I still get drc errors.
grafik

@JeffYoung @eelik @twl Ideas?

You probably don’t want to specify the layer info in the condition. Just use the outer layer clause:

(layer top) (or whatever your top layer name is).

(Even given that, it seems like it should have worked as you had it written…)

DRC and zone filling have now been moved over the the new rule-based engine. So the rule syntax can now be considered semi-frozen.

I’ve also added something that will help debugging your rules. See Inspect > Clearance Resolution… (You’ll need to select the two elements between which you want to inspect the clearance first.)

1 Like

Hi everyone,
I’m trying to control the clearance between zone fills/tracks to the board edge and mounting holes (I need bigger clearance for mounting holes). Any idea how should I do that on the latest nightly?

Use Board Setup board edge clearance for non-mounting holes.

Write a DRC rule for mounting holes. You’ll probably want to detect them with a condition along the lines of:

A.Pad_Type == 'NPTH, mechanical'

Only trouble is, we forgot to expose Pad_Type so you’ll have to wait for the next nightly…

Only trouble is, we forgot to expose Pad_Type so you’ll have to wait for the next nightly…

It’s alright, I’ managed to get KiCad to build :slight_smile:

What about Zone to Board Edge clearance? Is it possible to define via the new DRC engine yet?

A.Type == 'Zone' && B.onLayer('Edge.Cuts')

Awesome, makes sense! Still trying to get my head around how the DRC system works.