I need to exclude a few tracks from the solder mask.
After selecting the solder mask, I drew rule areas around the tracks and set them as keepout zone fills.
Although the solder mask is correct in the Gerber viewer, is it normal that the 3D viewer still renders the tracks with the solder mask over them ?
I guess this means having bare copper such as for example guard rings.
I am not good with custom rules. I am quite impressed that you can set a rule to only modify the solder mask layer.
The Gerber output is always the reference for what you send to the fab. But both the canvas in the PCB editor and the 3D viewer should be correct. This is the first time I’ve read about using rules to modify the solder mask, and it is quite possible you have exposed some bugs in KiCad in this way.
Both for further analysis and a (possible) bug report it is useful if you create & post a simple example project that shows your technique (with custom rule) and the bug. The schematic / PCB can be very simple (just some connected resistors for example).
Solder mask is negative layer - in places where you add something at this layer you then don’t have solder mask at PCB. To not have solder mask at some tracks I would try to draw at solder mask layer graphic lines at those tracks. But I have never tried it in KiCad.
So my understanding would be that if you add keep-out zone fill at that layer than you ensure no fill is made so (by negation) mask should be in that area what is not what you want, I think.
I am surprised that gerbers are as you expect, as I would rather expect like you say it is in 3D viewer.
I made a small pcb project to show the issue.
With the Gerber viewer, the files corresponding to the copper layer and solder mask clearly show the tracks around the square pad not being covered by the solder mask.
However, the 3D viewer under PCBNew applies the solder mask over the tracks.
So it looks like a bug to me.
As Piotr already mentioned the solder mask is a “negative” layer, and this may be the cause of the bug. Creating “Rule Areas” to make cutouts on a solder mask layer is also unusual, which can explain this bug was not discovered earlier. A more common way is to simply draw graphical lines on the solder mask layer.
Yes. Solder mask is a negative layer, and any graphic items you draw on them will result in the solder mask being removed in those area’s. It’s simple to test and verify. Just draw some graphics on a solder mask layer and observe the result. (Both in the 3D viewer and Gerbers).
For your way of using rule area’s on the mask layer. I think it’s a bug worth reporting, but I would like someone else chiming in here and giving an opinion about that first.
Please open the issue yourself (you have to create a gitlab account first). Use pcb-editor–> Help → Report bug and try to follow the comments in the opened gitlab issue. I monitor both places (gitlab and this forum), so I’m able to confirm the issue.
The discrepancy between gerber output and 3D-viewer is clearly a bug. (Albeit in my opinion the gerber output is false - a rule area alone should not remove the soldermask).
Do the graphical lines act as solder mask exclusion areas?
Yes. And therefore the normal solution for a “solder mask free area” is to simply draw graphical items (lines, filled rectangles/polygones) or use a filled zone (not a rule area) on the mask layer.
To cure your project with the already existing rule areas use the context menu:
convert to a polygone: select your rule area → RMB-click–>context menu → create polygon from selection. Make sure you set the “Filled” flag for the polygon.
or convert to a zone: select your rule area → RMB-click–>context menu → create polygon from selection. Make sure you later set the “minimal width” parameter for the zone to some small (0,01mm) value and run the “fill all polygones” command.
Also just try to draw some simple graphic lines (width == 1mm) on the mask layer - just to get a feeling.
I replaced the rule areas / polygons by simple lines on the solder Mask. Very easy indeed !
It would be even easiler if we could select tracks, right-click and “Copy to Solder Mask”.