Via rules - how to

I’m trying to add a via rule to custom rules. (I have the gui set rules to 0 but custom rules always override others so that’s fine)
Now, here is the problem :

(rule "override rule vias"
(condition "A.Type =='via'")
(constraint via_diameter (min 0.7mm)  (max 2.0mm))
(constraint hole_size(min 0.3mm)  (max 1.6mm)))

In BoardSetup-DesignRules-Predefined-sizes
If I set a via size that is 0.5mm dia / 0.2mm hole,
then if I setelect this via in the tool bar , and then place a via , it permits this.
The rule should prevent me from placing it.
–If it only picks it up at forced DRC time, then I will have a mess to clear up later (productivity issue) .
-g

It’s the same behavior as when you set up the constraints in the constraint dialog. Why would a custom rule be different?

Well, the custom rules override the dialogs.
I might have 10 rules about different vias for different netclasses
If I select a via in the via drop-down from choices, then,
if I attempt to place a via and make it part of a net that has a rule that excludes it , then the tool ideally should not place, throw an error or something. It needs to stop me choosing a via that violates the rules.
A manual DRC does flag the violation, so the rules do work. But it results in cleanup work.
Just like when the tool in the yellow bar at the top informs you it could not place a via due to a location violation .

Yes, they override the dialogs… when the DRC checker runs.

Does use netlcass sizes not work in this case?

I could use netclass size, but netclass size only permits one size of via, (or am I misunderstanding available functionality ?) where usually you might want to have two go-to vias , one when geometry is relaxed, and another for when things get tight.
so I would use. so the netclass via dialog is not suitable for my case.
hence

(rule "rule via for netclass XYZ"
(condition "A.Type =='via' && A.Netclass == 'XYZ' " )
(constraint via_diameter (min 0.7mm) (opt= 0.8) )
(constraint hole_size(min 0.3mm) (opt=0.4) ) )

Usually I would only use Netclasses and via assignment when I have specific requirements like back drill etc. it depends how many nets and netclasses I might have.

I think the conclusion here is I would like some of the batch DRC checks to be selectable as online DRC.

if I attempt to place a via and make it part of a net that has a rule that excludes it , then the tool ideally should not place, throw an error or something. It needs to stop me choosing a via that violates the rules.

The rule system is currently not 100% coupled to the router engine.
See for instance these discussions / gitlab issues:

Thanks for the link to the post.
Yes, Seneral and I are on the same planet it seems .
Need online DRC selectable.
You can’t put everything in the Online mode, it slows the tool down too much.
In Altium for reference, this is how it is done : Rules have a category assigned to them :
This is the Batch or Online rule assignment dialog.
image
etc
image
image
image

this is not new stuff, been there since 1991. old.
this is how rules are done, each line is drilled down into its own dialog page.

Then make sure you up-vote the associated issue on Gitlab and add any additional context to help the developers track the need.

1 Like

@glenenglish @baldengineer Actually, I did some major fixes for this already, but they haven’t been merged. I’ll update to the newest commit today (if I remember, else ping me later this week).
Though anecdotally I did face a crash using the new code, though I couldn’t pin it down. But the half hour or so it worked, it was a sweet relief from all the pain the routing gave me before with complex custom rules.

wonder what the crash was.

Yep, have screenshots of it there during debugging, but couldn’t figure it out since there were no tools (as in, no ids or other ways to have some code identify the case and break, it’s just one call into that subtree of thousands per frame).

mmmm
I’ve read the github discussion, you’ve been in-deep.

Altium have tried to fix this very issue (pin-diff pair initial fanout) and clean it up for years and years, and it still isnt perfect. It is a tough nut to crack. I guess u see my push for the router / placement engine to have selectable things it cares about in real time.

I’m not actually a electrical engineer by trade, so no, I don’t know what would improve it - all I did was fix the router to respect DRC rules. For me, that makes fanout already possible with my current build. Just updated my repo, so if you want, I invite you to build it yourself and see if it works for you:

Any further recommendations, please do tell, I’m not certain what would be needed (nor can I guarantee I’ll find time to implement it for that matter)

For reference, 6 layers with tons of custom rules, fanout:

1 Like

which KICad version is that ?