Net Class Track_Width based on layer

Hello,

I am trying to set a net class trace width based on layer. I thought it would be possible with the custom rules feature that was added , but it looks like it just does a check when you run the DRC check, it doesn’t automatically use the trace widths you set in there.

Does anyone know of a way to do this, so that soon as you jump layers the track width will auto update to the proper width. Reason for this is if you are routing a 50 ohm signal and need to jump layers the width will change on an inner layer and manually doing this is very error prone. ( Now i can atleast double check i did it) but would be nice to do on its own.

Previous post about this: Net class assign in different layer

What i am doing with my custom rules, maybe i am doing it wrong but the instructions say " Checks the width of track and arc segments. An error will be generated for each segment that has a width below the min value (if specified) or above the max value (if specified)."

(version 1)
(rule "top 50Ω"
(layer F1.Cu)
(condition "A.NetClass == '50ohm'")
(constraint track_width (min 5mil) (max 5mil)))

(rule "layer4 50Ω"
(layer Layer4.Cu)
(condition "A.NetClass == '50ohm'")
(constraint track_width (min 4.9mil) (max 4.9mil)))

(rule "layer6 50Ω"
(layer Layer6.Cu)
(condition "A.NetClass == '50ohm'")
(constraint track_width (min 4.5mil) (max 4.5mil)))

(rule "layer7 50Ω"
(layer Layer7.Cu)
(condition "A.NetClass == '50ohm'")
(constraint track_width (min 4.5mil) (max 4.5mil)))

bumping this… anyone have a trick on this?

I am currently going through like 200 errors in the DRC related to this

I am also interested of knowing this.

Perhaps this will help (done in v7.07)

A couple of ways to do it, including Python Console (not shown) and Plugin…

ADDED: I had previously set the Net-Class widths (screenshot)

Try setting an opt val for the constraint instead of just a min and max

i would like to use net class routing. And the width auto change for each layer, but keep it all in same net class.

So one net class, different widths defined for each layer.

It looks like you are just setting new widths for all nets on a layer.

the DRC rule sees the issues. Would love for the router to used the defined widths instead of having to catch any i missed in the DRC check.

Does the router still not work after you add the opt value?

In more that 50 yrs of Engineering, I still find it disappointing to see so many folks asking others, “Can I do this?” and “What if I want this?” and… well, you get the point.

Did you even try different Tools in Kicad? Did you try @craftyjon suggestion re ‘opt’ value?

I’ll finish my posting on this topic with the video - All Tracks are on the Same Net. Width change is based on Selection of Width but, I could have based it on Net and it would still be in correct layer…

Note: There are few moments of ‘Delay’ while the computer/Kicad does it thing…

ADDED: I don’t use DRC so can’t be too helpful about it but, in the Design Rules, Custom Panel, click the ‘Syntax Help’ (top right corner) to get Info and Examples. You may find what you want to do isn’t too difficult…

Crafty, it does not it still follows the net class rules.

The suggestion black coffee made is for post editing traces that are all routed, yet not sure what plugin he is using to do it but it looks like it will grab every trace on the layer and modify it. That’s a big hammer that will break things if you have power traces and other controlled impedance traces. ( He probably knows that since he’s been an engineer longer than i I’ve been alive).

Changed my DRC rules to this:

version 1)
(rule "top 50Ω"
(layer F1.Cu)
(condition "A.NetClass == '50ohm'")
(constraint track_width (min 5mil) (opt 5mil) (max 5mil)))

(rule "layer4 50Ω"
(layer Layer4.Cu)
(condition "A.NetClass == '50ohm'")
(constraint track_width (min 4.9mil) (opt 4.9mil) (max 4.9mil)))

(rule "layer6 50Ω"
(layer Layer6.Cu)
(condition "A.NetClass == '50ohm'")
(constraint track_width (min 4.5mil) (opt 4.5mil) (max 4.5mil)))

(rule "layer7 50Ω"
(layer Layer7.Cu)
(condition "A.NetClass == '50ohm'")
(constraint track_width (min 4.5mil)(opt 4.5mil) (max 4.5mil)))

Re: Individual or All tracks - you can select the one’s you want…

The Plugin is homemade and uses the ‘Simple Plugin’ structure per documentation.

New Plugins, in practice, should be per the New Plugin approach (not as simple… requires Meta file and other… Good news is, the older approach still works and that’s the one I use.

Thus, need only place the (your_code_file).py and (your_icon).png files into the Kicad’s Scripting>Plugins folder and Kicad will populate the menu with it (may need to click a Check box in PCB setup).

That said, and assuming a User just wants to use it without ‘Learning’ anything, well, the files are attached. Video shows selecting a single track (could select multiple, if wanted).

The .py code is hard-coded for changing track to 1.0mm but, you can change/edit that. And/or do some coding to prompt user for Input…
(Right-Click the png-icon image to Save it…)

my_trackWidth_1mm_plugin.py (1007 Bytes)
k_1mm

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