Schematic and Layout Modules

Hello,

I once again struggle with the efficiency of my approach on how to carry over designs of subcircuits between different designs and wanted to see if someone came up with something better. As far as I remember there was an idea to have a library for modules like we have now for symbols and footprints but as it is still far away (I think so at least) I need something for the time in between. I was thinking about creating a small plugin for this purpose but maybe this isn’t even necessary if someone already has a well working process.

My process for now is as follows:

  • I have a “library” for all my prerouted subcircuits where they live as own kicad projects
  • if I want to use one of the modules I copy the schematic to a folder in this project
  • then it gets included in the projects schematic as hierarchical sheet
  • the layout of the sub circuit gets imported into the main layout via copy and paste
  • at this point the connection between schematic and layout is lost but I came up with two ideas to “fix” this which both have their problems:
    • All modules have predefined reference designators so the connection can be made based on this references directly:
      • then each subcircuit can be used only once and one has to rely on things like the replicate_layout plugin to get multiple copies of the subcircuit.
      • this approach also only works if you don’t modify the subcircuits for your project, once you have multiple variants the whole process again gets more complicated (e.g. if you have to replace TRIM resistors for different voltages)
      • you have to keep and maintain a long list of how you assigned the prefixes for each module
    • the moduls schematic does not get annotated, the layout gets placeholders like designators like xx1:
      • this can be improved if the placeholders gets synchronized with how the annotation will happen later (e.g. the resistor which will be R303, R403, R503 etc. gets xx3)
      • obviously this is a lot of handwork to then replace the placeholders to fit the automatic assigned annotations

So the whole problem is the (re-) connection of schematic and layout. is there maybe a way that this information does not get lost in the first place?

Greetings,
Tojan

The plugin Save/Restore Layout is what your are looking for.

1 Like

you are absolutely right. sadly it has a bug right now so I can’t save my layouts but once it is fixed I can simplify my process with it. thanks a lot!

Hi, I’ve been talking with the plugin owner about this bug.
If you want you can do a simple patch to get the plugin to work.
in the file :
save_restore_layout.py
in the function def get_sch_hash(sch_file, md5hash): should be line 62
at the beginning of the function you can add this line :
sch_file = sch_file.replace(“File: “,””)

this is a way to get the plugin to work until a fix is released.