Struggling trying to add polygons to a module [etching indicator]

Hi,

So I would like to make a module that is an etching indicator, which consists of two triangles with their points just touching each other. If there’s a gap between the triangles, the board is under etched, if there’s a thick line between the two, its under etched.

So the best way to draw two sharp triangles would be with polygons. Unfortunately this is not a standard feature. I dont understand why people draw their components or logos in paintbrush or gimp and then import them with the bitmap tool. Does no-one use vector to bring in exact vector art rather then butchered raster images? Anyways I digress…

So I have been manually filling areas by drawing lines next to each other in a free CAD program then importing the DXF, editing the text file to replace the thickness and layer attributes… a very tedious process.

So I read this:


It links to the KiCAD file format, but the link no longer exists. The File format help page on KidCADs just lists the file formats, not the format itself.

Quite a few pages I have read say refer to demos/interf_u/image.mod:
But when I open it, it looks like some sort gerber file:
e.g.:
> PCBNEW-LibModule-V1
> $INDEX
> LOGO
> $EndINDEX
> #
> # LOGO
> # pixmap w = 229, h = 270
> #
> $MODULE LOGO
> Po 0 0 0 15 00000000 00000000 ~~
> T0 0 4800 600 600 0 120 N I 21 “G***”
> T1 0 -4800 600 600 0 120 N I 21 “LOGO”
> DP 0 0 0 0 5 1 21
> Dl -3783 4516
> Dl -3766 -4466
> Dl 3850 -4483

Whereas If I make a module and open it, it looks more like some sort of XML with angle brackets… (so im guessing different file formats? Both are .mod?)

(module Etching_Indicator (layer F.Cu) (tedit 56E34257)
(fp_text reference REF** (at 0 0.5) (layer F.SilkS)
(effects (font (size 1 1) (thickness 0.15)))
)
(fp_text value Etching_Indicator (at 0 -0.5) (layer F.Fab)
(effects (font (size 1 1) (thickness 0.15)))
)

Some posts I have read say make a zone in PCBNew and paste it into your .mod file. I tried a few iterations of syntax I thought would work, none did.

I am guessing the file formats changed, and google is still stuck on serving up all the old links to none applicable examples.

What is the new file format for polygons?
(…so I can turn these two zones into a polygon in the footprint editor):

(zone (net 0) (net_name “”) (layer F.Cu) (tstamp 56E35046) (hatch none 0.508)
(connect_pads (clearance 0.508))
(min_thickness 0.3)
(fill (arc_segments 16) (thermal_gap 0.508) (thermal_bridge_width 0.635))
(polygon
(pts
(xy 178.5 90) (xy 177 89) (xy 178.5 88) (xy 178.5 90)
)
)
)
(zone (net 0) (net_name “”) (layer F.Cu) (tstamp 56E35047) (hatch none 0.508)
(connect_pads (clearance 0.508))
(min_thickness 0.3)
(fill (arc_segments 16) (thermal_gap 0.508) (thermal_bridge_width 0.635))
(polygon
(pts
(xy 177 89) (xy 175.5 90) (xy 175.5 88) (xy 177 89)
)
)
)

Thanks for any help!

KiCAD file formats via here: https://kicad.org/help/
You need to look out for S-expression format… starts on page 26.

And then try to play with fp_poly… I don’t know if it can appear stand alone like gr_line or gr_arc or segment, or always needs to appear as part of a module, but it will be what you’re looking for.
See either one of the files attached there for it’s usage inside a module:

PS: you don’t want to use a zone for your purpose as it would need manual filling, connection with a net to work and can’t be loaded and placed into your layout at whim.

1 Like

Wow Joan your KiCAD logo is beautiful!
Great job, that’s the way to do it!

Thanks quick reply and for pointing me in the right direction with the new documentation, with even the page number too, yay!

For future people interested in how to add a polygon:

If you add these two lines to a .kidcad_mod file within a folder called something.pretty (a library container), you will get two triangles on layer F.Cu which can be used as an etching indicator. The width can be set to a something greater than 0, e.g. 0.15 if required.

  (fp_poly (pts (xy 0 0) (xy 1.5 -1) (xy 1.5 1) (xy 0 0)) (layer F.Cu) (width 0))

  (fp_poly (pts (xy 0 0) (xy -1.5 1) (xy -1.5 -1) (xy 0 0)) (layer F.Cu) (width 0))
1 Like

Okay next piece of the puzzle, trying to import a logo into KiCAD module.

How does one go from importing thousands of fp_lines (because fp_polys cant have arcs, so arcs are splits into multiple tiny short lines) to joining them together into a fp_poly?

Manually in a text editor or write a script? Is there not an easier way?

Don’t know if there is any… would do with a script if I was you. Sorry.