leomcelroy / svg-pcb

Design PCBs in the Browser
https://www.leomcelroy.com/svg-pcb-website
GNU General Public License v3.0
68 stars 9 forks source link

Layer of component vs layers of pads #46

Open kr15h opened 1 year ago

kr15h commented 1 year ago

In KiCad board format there is a clear distinction between

  1. the layer where the component is placed
  2. All the layers where component pads are placed

So when you add a footprint to board and it becomes a component, you can decide if that component is on F.Cu or B.Cu. Let's call it the component primary layer. Each pad has a geometry and it can influence multiple layers. F.Cu mainly and then F.Mask and F.Paste. I suppose that KiCad changes those to B.Cu, B.Mask, etc. if The primary layer of the component changes to B.Cu.

I wonder what would be a good way to approach this. The KiCad way sort of makes sense if you are clear that the properties of the component override or affect the elements that are enclosed. So that if the layer prefix of the component matches the prefixes of the layers of the pads, nothing changes, but if they are different, the pad layer prefixes get replaced with component layer.

For example:

component: {
layer: "B.Cu",
pads: [{layers: ["F.Cu", "F.Mask", "F.Paste"]}, ...]
}

When rendering or exporting the layers of the pads would become:

pads: [{layers: ["B.Cu", "B.Mask", "B.Paste"]}, ...]
kr15h commented 1 year ago

In a way I like that SvgPcb could simplify this in a way that a component would be always on one layer and the pads would be on that layer always. The *.Mask layers could then be automatically generated on export, as it is done in the current Gerber export implementation. The additional pad layers for KiCad could be also then added on export.

With that said. maybe one should decide if it is needed to have additional layer definitions per pad. One component, one layer would make it much easier to understand.

This also assumes that a component would have drills as a separate object. Drills could be drills instead of layers. Drills always drill through all layers.

Also vias as separate objects, as discussed in #45.