How can I write text in solder mask?

Update: please support this as a feature request in KiCad here: https://bugs.launchpad.net/kicad/+bug/1783249.

I’d like to write text in solder mask by using the F.Mask layer. However, there seems to be no way to make this a negative. In other words, I can easily add text to the F.Mask layer, but that leaves solder mask as the background and makes the text now uncovered copper, but what I want to do is the opposite: I’d like to leave the background as uncovered copper and make the text solder mask.

See the attached image from the KiCad 3D viewer. Yellow is bare copper and green is solder mask. I’d like the negative of this. Any way to do it?

Solder Mask is usually plotted negative to start with, so clear is mask.
If you want text-as-mask, you may just be in luck, see the nifty new script thread here :

Here I have loaded 2 plots
image

Blue is std FMask, and Cyan is the spare layer (eg dwgs.user), and you need a filled area in FMask, (plot dark) that the later merged negative Gerber text can cut into (plot clear).

When that combined file is flipped again, you should get the text in mask-colour, and the box-behind, as copper. I think that was what you needed ? Let us know how the FAB manages this :slight_smile:

2 Likes

Looks pretty promising! I’ll have to give it a shot. I guess the steps would be:

  1. Add text and drawings to a user layer.
  2. Produce Gerber’s.
  3. Invert the user layer using your script.
  4. Combine this inverted layer with F.Mask with your script.
  5. Send to board house, right?

And if I want to have silkscreen on solder mask I’d need to combine the original user layer with the F.SilkS layer too, right?

You don’t need to invert the layer (I’m not sure how that would work), but use the -s parameter to “subtract” the layer from another.

I haven’t tested the output with any Fab, so it may or may not work with their CAM software…!

I get it, so:

  1. First do an F.Mask zone around where my text will be in order to remove all solder mask there
  2. Then add some text to a user layer (or even to F.SilkS).
  3. Then produce the gerbers and use your script to do F.Mask layer - F.SilkS layer or whatever. This will now cut out the F.Mask from where I want to leave behind the solder mask, and voila! I can send it to the fab shop and the solder mask should be left on those areas as text/lines/drawings/whatever I’ve put there.

Note to anyone following this thread: please go to my KiCad feature request here: https://bugs.launchpad.net/kicad/+bug/1783249

…and click the little pen icon near the top, where it says “This bug affects __ people”. Then, say this bug affects you too! Comment if you wish as well, but let’s get this feature request some traction as I’d really like to be able to do this right in KiCad.

Yes, but I’d be cautious about F.Silk, as that can get a lot of information, plus it commonly also ‘wipes’ the pads clear of accidental Silk-on-pad.
So you need to remember to disable that, and restrict what is on Silk to a manageable amount.

Do you really want to have no Silk info (usually plotted white, at no charge, because everyone does that…)

You may actually want to merge 3 files here ?

First, 1) the Solder Mask layer, then 2) a LPD Text layer, for over bare PCB cases (where negative text is ok) and finally a 3) subtract/negative layer, LPC, that cuts into block areas carefully placed in file 1.

You could also cut text into copper, to spread how you pass the information, using only Cu and Mask layers.

@bobc - Can your nifty script manage multiple files Dark / Clear ?

It should handle any sequence of add/subtract, -a sets the mode to dark, -s sets mode to clear, for following files. It’s similar to arithmetic plus/minus e.g. a + b - c - d + e is equivalent to

gerber_combine a b -s c d -a e

the default mode is dark, and first file should be a dark.

I’m not sure what happens if a file has both dark and clear commands. The use case here would be a good test!

Sounds great. I had not expected to need multiple files, but can see here it could be useful.

I guess your script just prefixes LPC, and removes first LPD ?
I suppose another choice would be to toggle LPD/LPC when they are found but that starts to make the head hurt with all the combinations !

There may be a use for LPD Silk with LPC pads (std KiCad output), to be selectively flipped to become LPD Silk + LPD Pads - ie that gives a solder mask with negative silk text, when finally flipped at the FAB.
Perhaps a -f option for flip(clear) ?

Yes, and yes :wink:

Sounds like a good idea, and should be easy to implement.


I had a quick stab at the OP example, with copper negative text on Eco1, and “text for solder mask” on Eco2.

It looks ok using Easyeda gerber viewer and gerbv (from Geda).

Windows batch file

set GC=C:\git_bobc\kicad-utils\scripts\gerber_combine\gerber_combine.py

rem front copper with negative text
%GC% test1-F.cu.gtl -s test1-Eco1.User.gbr -o test1-F.cu.new.gtl

rem front mask with text cutout
rem %GC% test1-F.Mask.gts -s test1-Eco2.User.gbr -o test1-F.Mask.new.gts

%GC% test1-F.Mask.gts -s test1-Eco2.User.gbr test1-F.silks.gto -o test1-F.Mask.new.gts

In fact here I used the whole silk layer to create the solder mask layer. It’s hard to tell from the above image, but there is solder mask under all of the silkscreen text and graphics.

There seems to be sufficient flexibility to achieve most things.

I would recommend creating a test article and ordering a low cost sample before committing to a final design!

2 Likes

I tried your script. I did F.Mask -s F.SilkS. It works! I already sent off my board to the fab house with just silkscreen on bare copper though, before getting your script to work. If they don’t print the silkscreen on bare copper I’ll definitely redo it, using your tool to put solder mask underneath the silkscreen.

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