Text in Copper Zone

I tried svg2mod. I can see the module in the “library browser” but can’t insert it into the PCB board.
I didn’t do your complicated process with substraction etc… just a simple text -> convert to path -> set layer name to “Cu” and export it to a pretty KiCAD module…
Is it important to use your process?

This could be a solution.
I just saw your KiCommand repo on github.
But how can I convert the text into draw segments (and then to tracks)?
I installed the scripts and enable kicommand:

It is a bit difficult to explain if you don’t do the milling process yourself and without knowing how the person producing the board works, but the procedure is usually done in two stages.

The first stage is to cut all the clearances around the traces, pads, zones, text etc. to produce the clearances as set in the Kicad design rules, producing a board layout that matches the schematic connectivity.

The second procedure using a much larger cutter cuts away all the copper from the areas on the board like the clearance area around the text in your first picture, but you do not have to do the second procedure if it is not necessary. The only time I use it is when working with 0.5mm pitch components to make solder bridges under ic’s a lot easier to avoid.

If you discuss this with the person producing the board I am sure they will be fully aware of all this.

As a F.Cu layer, I cannot add it to the board.
As a Edge.Cuts layer, it works… but I need it as a F.Cu, not as a Edge.Cuts :disappointed:

And svg2mod doesn’t convert the letter “a” correctly…

The problem is likely to be that you are attempting to turn outline defined fonts, i.e svg, ttf, or PS, into toolpaths/gerber plotter outputs for placement on your layout, with the associated problem of loops/holes within glyphs.

What you ideally need for these applications are centreline defined, a.k.a. engraving, fonts.

The FootprintTextForPCB utility mentioned above uses the centreline defined Hershey engraving fonts for this reason.

If you are using Inkscape already, I believe there is the ability to install the Eggbot Hershey fonts for such uses, which can then be exported as gcode or paths. There is also the Inkscape2pcb export script on github which can export a gEDA PCB format footprint from Inkscape that Kicad can easily import, which is an alternative to svg2mod that uses Inkscape’s own internals to converts paths to segments, but ignores polygons, unlike svg2mod.

There are lots of ways to skin this particular cat, but a centreline defined font is probably the most important aspect if converting to line elements.

Good luck,

Erich

1 Like

I just looked at this again and realized not all the commands necessary are in KiCommand. I’ll fix this in the next few days and repost here when ready to download. I’m reworking the todrawsegments command to take text objects as a parameter. The command string will be something like:

toptextobj selected F.SilkS todrawsegments F.Cu tocopper

Edit to add: I have already extracted strokes from text in KiPadCheck, and I’m in the middle of updating command definitions. Once I get the update working and porting the code from KiPadCheck, I’ll post the update.

Working on a solution with KiCommand. Still in development.

Text Size W/H/T 1.5/1.5/0.3
Top is text on F.SilkS
Middle is segments on F.SilkS
Bottom is tracks on F.Cu
Zone is clearance = minimum width = 0.0254

The command string assumes the desired text is selected. It copies the text to F.SilkS as drawsegments, then copies those drawsegments to tracks on F.Cu. I’ve moved the text and the drawsegments to non-overlapping just for the screenshot. I added the F.Cu zone afterwards and ran DRC (which fills the zone). Neither the zone nor the text have nets assigned.

toptextobj selected topoints delist pairwise F.SilkS todrawsegments F.Cu tocopper

Still working out the bugs.

5 Likes

I pushed this update to github. My impression is that uptake on KiCommand is fairly low at the moment, so there may very well be bugs that slip by.

I’ve added a core command topoints and modified todrawsegments to accept point pairs in addition to tracks. Given this, I had to do some cartwheels to get the width from the text and apply them to the drawsegments. Those cartwheels are documented in the texttosegments command.

Usage: toptextobj selected Dwgs.User texttosegments F.Cu tocopper

The first two commands retreive all the selected top text objects. Then Dwgs.User texttosegments copies the text objects to the Dwgs.User layer, then the F.Cu tocopper copies those segments to the F.Cu copper layer.

Let me know if you have any problems or questions!

Here is the definition of texttosegments in the persist file (which you never have to look at):

:persist texttosegments "Draw [TEXTOBJLIST LAYER] Copies text objects in TEXTOBJLIST to LAYER."
        swap copy GetThickness call list swap 
        topoints pairwise 2 pick todrawsegments 
        copy 2 pick SetWidth callargs pop
        swap pop swap pop
        ;
2 Likes

I’ve been watching your progress on KiCommand since you started. I’ve yet to understand a task that it does that I might want to do; and to spend the time to learn it.

If KiCommand can draw text on copper as per the OP then I can clearly see the issue and that KiCommand is the solution.

Can KiCommand help design really complex edge cuts?

I think so. I’ve been trying to add useful geometry commands that assist with drawsegments and arcs into polygons.

Here is a list of interesting Draw and Geometry commands that might help:
Draw - drawparams outlinepads drawarctest outlinetoptext param newnet texttosegments orthogonal showparam grid findnet round pad2draw makeangle scale drawarc topoints outlinetext drawtext drawsegments cut regular

Geometry - rotatepoints areacorners rotate corners angle topoints ends wxpoint setlength length

One thing that might help is for you to define a specific complex edge cut, then I can see if the commands exist to create it. And if not, I might be able to create new commands that would help.

P.S. My comment on “uptake…fairly low” was not a specific complaint at all, just a reason that updates may include bugs at this point. I haven’t yet implemented any type of automated testing. And I totally understand that people will try it out when they have time and a specific need that KiCommand seems to solve.

I don’t know if you will believe me…

I want to create a pcb that looks like a one eyed one horned flying purple people eater.

Less complex, but similar, to this:

Can you define each vertex as an x,y point? if so, then you can use drawsegments:

drawsegments (Category: Draw) 
	[POINTSLIST] Points list is interpreted as pairs of X/Y
	values. Line segments aredrawn between all successive pairs
	of points, creating a connected sequence of lines where each
	point is a vertex in a polygon as opposed to being just a
	list of line segments or point pairs. This command uses
	previously set drawparams and the points are in native units
	(nm) so using mm or mils commands is suggested. 

Or you could define the body, one arm, one ear and one leg, then copy and rotate as appropriate, using rotate and/or makeangle. I think you can also program move commands.

That does make me think of a new command, perhaps outline that will traverse the outline considering the indicated drawsegments as merged polygons.

Does any of this sound interesting for your problem?

You do realize that if you can do this, then not having to use a Cad or Drawing program to export and import would be a pretty cool thing to document how to do.

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
	RADIUS.

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?

3 Likes

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?