svg-pcb icon indicating copy to clipboard operation
svg-pcb copied to clipboard

KiCad export: handling other layers

Open ducky64 opened this issue 1 year ago • 4 comments

It seems like currently for KiCad export, only F.Cu and B.Cu layers are exported. But other layers are also important, for example board edge (Edge.Cuts) and silkscreen (F.SilkS or S.Silkscreen depending on convention).

Can these non-copper layers be exported as graphical lines, with the layer name being passed through?

ducky64 avatar May 19 '23 19:05 ducky64

Yes, the Edge.Cuts layers will appear as soon as there is an actual shape to export. We are still working on silkscreen layers though. Would you need other layers?

kr15h avatar May 22 '23 17:05 kr15h

I'd imagine Edge.Cuts and the silkscreen layers would be the most common ones (and probably a good enough start - at least good enough for my current application), though I can see more specialized flows having annotations on the other layers.

I don't know your current software architecture so this might not be helpful, but the way I'd think of implementing this is just to "convert" SVG-PCB graphical primitives to KiCad graphical primitives and pass through the layer name (relying on the user properly naming the layers). Maybe do some optional validation of names and generate a soft warning if the layer name isn't known?

For KiCad, both Edge.Cuts and silkscreen use the same underlying graphical primitives (e.g., graphical line segments, formatted slightly differently than copper trace line segments), so implementing one probably mostly solves the other. The board file is valid even if Edge.Cuts is not a closed shape (though the 3d preview and board house will probably be less happy).

ducky64 avatar May 22 '23 18:05 ducky64

Yeah, the Edge.Cuts are there, given that there are actual lines in the layer. Just tested with the current live editor and Edge.Cuts are there. the *.Silkscreen layers show up in KiCad as well, they are just not being populated yet as we have to solve a few things before. Take a look at the screenshot below.

image

kr15h avatar May 22 '23 19:05 kr15h

Oh I see, it has to be done with board.addShape("interior", ...) and isn't just propagating through lines on Edge.Cuts. Works now!

ducky64 avatar May 22 '23 21:05 ducky64