Mask Layer - Copper Layer

Save above code to a file named,copy the file to KICAD plugin folder, run python console in pcbnew tools bar,type:

1 Like (863 Bytes)

download and copy this file to your KiCAD plugin foler.

e.g:C:\Program Files\KiCad\share\kicad\scripting\plugins

1 Like

Nice trick!

just for reference:

import et


I’m also trying to do this, have exposed copper tracks and black solder mask around that. I get an error when trying to run the script, maybe because I’m on a mac (?).

import pcbnew

def AddMask():
"""Copy track to mask layer"""

pcb = pcbnew.GetBoard()
count = 0
for track in pcb.GetTracks():
    #Set mask layer
    if type(track) == pcbnew.TRACK:
        if track.GetLayer() == pcbnew.F_Cu:
            maskLayer = pcbnew.F_Mask
            if(track.GetLayer() == pcbnew.B_Cu):
                maskLayer = pcbnew.B_Mask

        trackMask = pcbnew.DRAWSEGMENT(aParent=None, idtype=5)
        count = count + 1

print('{0} track masks added'.format(count))

Is what I get. I could try doing it on a PC.

could also, I guess, do it manually, but I don’t understand how. Say I put a solder mask over the entire board. Is there a way to “delete” where the mask should be, by drawing lines on int? If so, on what layer? I’ve seen references to such a way of doing this while looking around, but they seem to indicate drawing a solder mask onto the solder mask, which doesn’t make any sense to me.

Any ideas?

(oh, and I can’t see the solder mask in 3d viewer, which isn’t helping).


What is the point of solder mask if it isn’t going to cover the copper? If it is the appearance you’re after then simply have your board made with black FR4 and clear/transparent solder mask.

The point is to use copper tracks as touch points, for a synthesizer. Basically creating circuits with the fingers, like circuit bending. An example: (that board obviously doesn’t have a solder mask).

But maybe black FR4 and no mask is the solution.

But, if there is a way to have solder mask all over the board except for the pads and a few tracks (added manually) that might be nice, solder resist is helpful to avoid shorts etc.

You can put a zone on the mask layer where you do not want to have solder mask.

If you want a more complex form (Like the skulls),
you could make your touch points as a special footprint.
Either by using the footprint editor (manual drawing or footprint wizard. The later might only work in nightly), svg2mod or bitmap2component to achieve this.

1 Like

Ok, how? Using the keepout area function?

The form isn’t necessarily that complicated, I could to it with lines (after all, the traces are lines). But I don’t understand how to tell Kicad not to put mask there.

I can’t see the mask in the 3d viewer (at least I think I can’t) which isn’t helping.

Nope a normal zone. (As you would do to make a copper pour. But select the appropriate mask layer instead of selecting a copper layer.)

Make sure you’ve turned on the solder mask in the 3D viewer. You can also change its color. Also, for selectively moving tracks to mask layer, you could use KiCommand. Select the track you want copied, then issue the command:

tracks selected F.Mask todrawsegments

or if you want all tracks, just

tracks F.Mask todrawsegments

within the KiCommand dialog box.


Ook… I guess I should read the manual. The mask layer defines where the mask shouldn’t be?

At work now, I’ll try kicommand and fiddling around a bit with the 3d viewer. I think I have everything on, but you never know.


And a few more chars to make the forum happy.

Brilliant. I should have figured, doesn’t make so much sense to say where it goes I guess.

I don’t understand the chars reference :-s

Thanks everyone

If you have any problems with KiCommand, here’s the main thread.


Sort of off topic, I did have the everything on in 3d viewer, including solder mask. I switched it on and off, tried various things (realistic mode on/off, changing colour, other stuff). Can only see the board. Tried making gerbers and the solder mask layer shows up.

Next stop: KiCommand!

[quote=“mainwright, post:21, topic:6060”]
I don’t understand the chars reference :-s
[/quote]Minimum length post thing.

I tried this in 5.1.9 and it doesn’t seem to work. KiCommand says

3 operands left on the stack.

Any hints?

Please start a new thread, reviving old long threads annoys the readers.