How to use the "Min_Width" Zone Property in Custom Rules?

Although it appears to have been renamed in the code to Minimum_Width, and the docs call it Min_Width. How can I make use of this? It looks like this can’t be used as a constraint, but only as a condition, which doesn’t really make sense to me.

My end goal is to have some DRC to check minimum zone width. Say I have net classes for checking all my minimum track thicknesses, and one track is too thin. If I replace it with a zone with the same dimensions, the DRC error will disappear, but the problem remains. Any way to check zones for minimum dimensions?

Looking at the Copper Zone Properties, I see “Minimum width” is actually a property of the zone. I can now understand how the custom rule can be used to find zones with particular minimum widths, but how can I enforce a minimum width on zones belonging to a particular net class (e.g. a 3A power trace one).

Sometimes PCB tracks tend to cut off a section of a copper zone, or split a copper zone in two. Especially with the Push n Shove function of the Interactive router. A very easy way to prevent such cuts from happening is to draw a copper track through the zone between two pads (or a via, whatever) belonging to that zone. That track (with it’s own width) may get shoved around, but it will maintain the connection. Simple and effective and no custom rules needed at all.

Some zone properties can be set from a Custom DRC rule[1]. However, min_width is not one of them.

[1] zone_connection, thermal_relief_gap and thermal_spoke_width off the top of my head.

@JeffYoung Can you point me to the code or docs that would show those? I see Thermal_Relief_Gap in the docs, but not the others. Do you have an example of how one would implement Thermal_Relief_Gap to make a custom DRC rule? According to the 7.0 docs, Thermal_Relief_Gap is from the list of properties that can be used as a condition but not as a constraint (unless I’m misunderstanding something). So even if I can get a custom rule to filter to zones with a Thermal_Relief_Gap < 1mm how can I use that to generate an error? According to the docs:

Each rule must have a name and one or more constraint clause.

For example:

(rule "Max thermal_spoke_width"
	(condition "A.Thermal_Spoke_Width < 1mm")
	(constraint {what_would_I_put_here?})

@paulvdh I’m not sure I understand how your solution would help with my issue. I’m not worried about things becoming disconnected or the cuts you mention. I’ve actually never even seen that happen. I’m worried about zones being too thin in some places to properly handle high current nets. There is an easy way to check for minimum trace widths for such a purpose, but I’m struggling to find a way to check this when zones are used in place of thicker traces.

If I wanted to get this via the python api, would anyone be able to recommend which of these to use?

Or something else within the Zone class? Guessing there are some python libraries out there that can do this calculation given an array of points, but the disconnect between the python and cpp code has me quite confused. The return types listed in these functions are cpp, but no links to the cpp code that defines those types. Any good reference for bridging that gap other than grepping the whole code base and searching around? For example, where can I find the definition of the SHAPE_POLY_SET type returned from Outline?

I am confused about your confusion. I’ll write down the same thing in another way, maybe it helps.

Assume your current needs a minimum track width of 3mm between point A and point B.
Then draw a 3mm wide track between point A and point B. Simple as that.
Then you can (optionally) also smear a copper zone over it to lower it’s impedance, but the hard connection with the drawn track will always ensure a minimum width of 3mm.

Got to Board Setup > Design Rules > Custom Rules and click on “Syntax Help”. You’ll find “thermal_relief_gap” (and others) under the “Constraint Types” list.

But I mis-read your original post. You’re looking for a way to check min_width, not set it, correct? If so, you can write a rule with an “assertion” constraint:

(rule absolute_min_zone_width
   (constraint assertion "A.Minimum_Width >= x.xmm")
   (condition "A.Type == 'Zone'"))

Thanks @paulvdh, yes your rephrasing did help me understand what you were proposing better. I’ll try to make a habit of that next time.

@JeffYoung awesome! Assertions allow for a plethora of custom constrains then; glad to know that. Thanks. Looks like there are quite a few more constraints than listed in the docs atm. Can you point me to the cpp code that defines these in case I have questions before the docs get updated?

Also, it appears I misunderstood the Zone->Minimum width parameter. Looking at a few other forums and testing some values it looks like this is better coined the “Minimum fill width” meaning it will avoid filling areas less than this dimension across to avoid sharp corners (maybe an RF thing?). Did I get that right? I was looking more for a corollary to the Track minimum width constraint.

Yes. (Though I think it’s more to prevent copper peeling than RF concerns.)

1 Like

(In general, the syntax help is kept up-to-date more than the docs: pcbnew/dialogs/panel_setup_rules_help.md · master · KiCad / KiCad Source Code / kicad · GitLab)

1 Like

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