Footprint Wizard Scripting: How to use inner layers

I am looking for an example of the footprint wizard to use the In1.Cu layer (of a 4 layer board). The included wizards don’t show how to do that.
Ideally, I would want to place the pads on the surface layer and then put some vias and connecting traces on the next copper layer under that surface layer. So that when the footprint is placed on a 2 layer board it uses F.CU and B.Cu, when it is placed in a ≥4 layer board it uses F.Cu and In1.Cu.

You probably can’t do that, KiCad only supports the surface layers in footprints and adding vias and traces to footprint isn’t really supported either.

Of course you can fake a through-via using a plated through hole and a track using a custom shaped pad, but µVias or tracks on inner layers aren’t possible AFAIK.

I would recommend drawing your via/inner layer stuff in the PCB Editor and copy-paste if necessary.

I’m using this touchpad wizard. It is doing basically what I want, but I need the connections in In1.Cu instead of B.Cu.

You could use that footprint, but delete its connections on B.Cu, place that footprint in the PCB editor and draw the connections in the desired inner layer manually.

I don’t think there is another way with the current software.

1 Like

To the best of my knowledge there is no interface for drawing stuff on inner layers in footprints, but if you put stuff on an internal layer (for example by modifying the text of the footprint with a text editor) then there is a good chance your changes will work. But there is no guarantee and this could change with KiCad versions.

The concept of footprints also does not work well with inner layers. Footprints are usually created independent of the PCB, and at that moment the number of layers for the PCB is also unknown.

There are a bunch of valid reasons for much more control over layers in footprints. One reason is for PCB’s which are a combination of Rigid and Flex, and on such PCB’s not all layers are available over the full surface of the PCB. But as far as I know there is no support for this in KiCad at the moment.

2 Likes

Thanks @paulvdh and @Jonathan_Haas for the replies. I’ll figure out a semi-automated way to achieve what I need. I think it’s probably a good Idea to not use a footprint wizard because of these limitations, but to script the generation of that pattern in pcbnew. Would that work?

Creating that pattern within the PCB editor would probably be possible, but then you’d have problems assigning nets to the “pads” and connecting stuff to it and so on.

I’d probably recommend going the route I outlined above, just use a footprint script, but omit the generation of inner/backside tracks and draw these manually in the PCB editor. (If drawing these manually would take to much time, of course you could try to script that, too, but probably not necessary). When 7.0 is released you probably could create these connection very quickly using the new finish selection (fake autorouter) feature.

1 Like