Text in Copper Zone

drawsegments is easy.

First define the param, which are the default layer, thickness and other draw parameters.

Then list the points you want connected with line segments. Just a list of x then y repeated as many times as you need:

0.3 mm t param Edge.Cuts l param
0,0,10,0,10,-10,0,-10,0,0 mm drawsegments

There’s an error in drawsegments that currently misinterprets the layer, so it must be entered like this:

0.3 mm t param Edge.Cuts layernums l param

But I’ll fix that next release.

You can also select whatever you’ve drawn and scale all segments selected to any desired dimension.

Edit to add: and when you’re done, you can round each vertex to a specific radius.

round (Category: Draw) 
	[RADIUS SEGMENTLIST] Round the corners of connected line
	segments within SEGMENTLIST by adding ARCs of specified

I’m still not used to using KiCommand.
Where is the command prompt? I tested some examples from the README and your new function… but non of them works.

Another example

On Windows 10 with KiCad 4.0.7 I cannot use KiCommand…
May I upgrade to the nightly build?

I would stick with 4.0.7 as that is what I am testing on (Windows 7).

The toptextobj… command string may fail with that message if you don’t have any text selected.

The others were basic coding errors on my part that I hadn’t tested in a long time.

I’ve pushed a new version of KiCommand to github that fixes the other errors you mention.

1 Like

Also note that the load command which is usually used to load user commands can actually be used to read in any commands. So you could put a large number of drawsegments commands as above into a file and load them to create a sequence of lines on your board.

Edit to add: if you let the param values be defined externally before loading the file, you can use the drawsegments to draw on any non-copper layer.

1 Like

I went online and found coordinates to plot, translated it into an input file

2,12,2,13,3,14,5,15,5,13,2,12,0,11,-3,8,-4,10,-3,10,-4,13,-3,13,-2,15,-1,15,1,17,1,16,2,17,4,18,5,18,7,19,7,18,9,19,11,19,10,18,11,17,11,16,12,14,10,14,10,13,8,13,7,12,7,9,9,9,9,10,8,11,7,11 mm drawsegments
-1,10,0,8,-2,7,-2,4,-1,3,1,5,3,6,4,6,5,5,6,6,7,5,8,5,10,6,10,7,9,8,7,9 mm drawsegments
9,19,7,21,4,22,-4,20,-7,18,-8,15,-8,13,-7,11 mm drawsegments
10,7,11,8,12,7,13,7,14,9 mm drawsegments
10,14,8,15,7,15,7,14,5,13 mm drawsegments
7,14,9,13,10,12,9,9 mm drawsegments
10,13,11,11,13,10,15,8,18,6,19,2,18,-1,18,-3,16,-7,12,-12,9,-12,5,-11,2,-10,-1,-8,-4,-7,-6,-3,-7,-2,-9,-2,-10,-3,-11,-5,-11,-6,-10,-7,-8,-8,-6,-7,-5,-5 mm drawsegments
15,8,15,5,14,4,10,2,8,0,7,0,6,1,4,1,2,0,-1,1,-3,3 mm drawsegments
-3,8,-3,3,-6,-3 mm drawsegments
-8,13,-10,8,-10,5,-8,0,-8,-2 mm drawsegments
5,8,6,11,5,12,4,12,3,11,3,8,5,8,5,9,4,10,3,10 mm drawsegments
6,1,9,4,8,3,10,2 mm drawsegments

Placed the file into: ~/kicad/kicommand/drawing.txt

Then went into kicommand and drawing.txt load.
Then selected the drawing and drawings selected 180 rotate

And ended up with:

(The red lines are the default frame because the coordinates in the drawing file overlap the frame lines).

This works in OpenGL canvas and 4.0.7 still requires to switch canvases after drawing with kicommand or python to see the new line segments (use F9 then F11).

1 Like

I created an update and added a few commands, including fromsvg that can take the ‘d’ attribute from the ‘path’ element of an SVG file.

I took the graphic and traced over it with straight lines in inkscape then took the resulting SVG:

Then I created the following command in KiCommand (it’s quite a long string and must be on one line within double quotation marks):

"m 81.38357,74.230848 5.612659,1.870887 5.211757,3.474503 2.138156,2.138157 10.958048,-6.1472 0.53454,5.078121 -1.06908,4.009044 -2.80633,4.276312 -2.539056,1.603616 1.202716,4.276312 9.48806,-2.939963 13.36348,8.686253 -8.95353,-0.4009 -2.13815,5.34539 -5.21176,-2.67269 -4.67722,4.54358 -2.40542,-3.0736 -4.009046,6.94901 -3.741775,4.27631 -4.142676,2.53906 1.870887,3.34087 v 3.34087 l -4.409948,2.53906 h -2.806329 l -2.80633,-0.53454 -0.267271,-2.00452 1.469982,-1.60362 0.668176,-0.4009 -0.53454,-1.73726 -4.142676,0.53454 -4.677217,-0.93544 -3.34087,-0.66817 -1.336347,-0.13364 -2.405428,3.87541 -1.469982,1.33635 -1.603616,0.66817 -5.479026,-0.66817 -2.405425,-2.80633 -0.133636,-1.60362 3.207235,-3.34087 1.870887,-2.53906 -2.80633,-2.93996 -2.672696,-4.40995 -0.668174,-2.40543 -4.409945,5.47903 -3.207234,-5.34539 -5.078121,2.13815 -3.474506,-6.14719 -8.285356,0.26726 13.229844,-8.418985 10.022607,4.81085 0.400905,-5.34539 -3.741775,-2.138156 -2.405425,-3.474503 -0.668173,-3.073601 v -7.884451 l 13.363474,5.078121 3.608139,-2.939965 5.211757,-2.271789 3.875408,-1.33635 2.138156,0.133636 3.207234,-3.474503 4.677217,-2.939965 2.405425,-0.668174 z" 1 mm fromsvg drawsegments

This results in the following within KiCad:

With preceding param command to set the layer and the thickness, it can be drawn on any non-copper layer (including Edge.Cuts). Then if followed by the tocopper command, it can be put on any copper layer.

Is this what you had in mind?


That is pretty cool!
I just have not had the time to spend on this.
Any chance you can export that something I can easily use?

Not sure what you mean. If you install KiCad and cut/paste the command I listed into the KiCommand dialog box, it will draw the line segments just like I pictured.

What else did you have in mind?

I need to figure out how to run KiCommand.

Link to installation instructions, just copy some files:

If you’re running 4.0.7, bring up Script Console and type: import kicommand


I’m trying to used KiCommand to render the selected text object on the F.Cu layer. Using current github master and the following command:

toptextobj selected Dwgs.User texttosegments F.Cu tocopper

I’m seeing activity on the KiCommand stack as presumably operations are executed, but I don’t see either the segments show up on Dwgs.User or the final result on F.Cu. Any ideas, @HiGreg?

Try changing the view to legacy and back to OpenGL. This should refresh the display so you can see the new objects.

That was it! After refilling my ground plane, it looks great. Thanks for making this so easy with KiCommand.

1 Like

Awesome! Glad it worked for you!

Any chance the layer could be simply edited from F.Cu to “Keepout area” in the file? Or is this impossible?

Is it possible to do the ‘inverted copper’ as shown? image

Not directly, but the expanded Gerber standard supports black and white (positive/negative) plotting, so you could plot the text on a separate layers and then instruct the board fab to add as negative to the coppers, or you could manually edit/append the copper Gerber files with the negative header + text.

Doing this, the user (of course) needs to take care to ensure the negative text does not cross any traces :slight_smile:

Not sure how to do this. Does anyone know what layers/objects in KiCAD would create this?

A bit late to the party but here we go:

I see two options.

One option would be to create keepout area(s) from the text. This keepout area(s) can then be placed inside a zone.

The second option is to create a custom pad that is a rectangle on the outside and has the text cut away. (Sadly there is no “negative” pad shape so you would need to create a single polygon with the text removed. Have a look at this part of the kicad-footprint-generator for inspiration)

1 Like