“Pivot section”: the master, the model layout which you want to copy or replicate. You lay out the board layout of one hierarchical sheet which works as the model for other sheets.
“Anchor module”: module means the same as footprint in KiCad. That’s an unfortunate name and AFAIK only “footprint” is used in KiCad nowadays. You decide which footprint is used as an “anchor”.
You position the corresponding anchor footprint of each hierarchical sheet where you want them to be, and the rest of the footprints are positioned relative to those anchors.
For example you have an IC U1 which has external capacitor C1. The same layout is repeated for U2/C2, U3/C3 etc. You can choose U1 as the anchor module. Position every U manually. Position C1 next to U1. You want to replicate the relative positioning of U1 and C1 to each other U/C pair. Select U1 which you have chosen to be the anchor footprint of the pivot section.
Open the plugin. Select the hierarchy level (in this case only one is available). Select sheets to replicate: you should see the list of the sheet names and the reference designators of the anchor footprints, in this case U[x] Test by selecting them all. Click OK. Now every U should be where you put them but every C should be moved automatically and placed next to their U, like in the pivot section.
The genius of the latest version of the plugin (well, I may be partial because I gave the ideas) is that you don’t have to declare or set any footprint or section. You just select one footprint, any footprint which belongs to any ready-made layout section which could be replicated, and open the plugin dialog. The only thing you have to remember is that the selected footprint and each corresponding footprint of other hierarchical sheet instances stay where they are. The footprints from the same sheet instance where the selected component is will stay where they are and are used as the “pivot section”, i.e. the model to be replicated.
Thank you eelik. Your reply is both unexpectedly prompt and delightfully complete. It should be included in documentation for the package. It would save many people a considerable amount of both time and frustration.
I was able to replicate my test case easily. I did notice one thing however. I noticed that if the netlister dropped the stacks of the sheet parts (one such collection per sheet to be replicated) on top of the pivot layout, some traces were invariably “robbed” from the pivot layout and the now incomplete layout was replicated faithfully. The only work-around that I found in the limited testing that I was able to do since your reply was to perform “undo” operations until the sets of parts were shifted off the pivot layout, at which point they were stacked on top of one another. That could have been a problem if it weren’t for the “Place footprints” action plugin, also from Mitja. With that plugin, you don’t have to have easy access to the parts used to place the replicas. If the replicas are equally spaced, then the anchors can be placed automatically. All good.
But why is the template layout called a pivot section? In the engineering world, it is anything but! And the Oxford English Dictionary agrees.
Thanks for the feedback
I’ll make the animated gifs slower, but I really don’t want to add more frames to them in order to keep the page size within reasonable limits.
Regarding the plugin documentation, I can only agree but it is hard for me to write the documentation as the workflow is really obvious to me. I’ll try to include the description from @eelik, but you are more than welcome to contribute (I’d prefer if you open an issue on GitHub or even better create a PR)
As for the nomenclature, KiCad is slowly migrating naming of modules to footprints. And from the user perspective this has more or less been done. While the internals (code) is still heavily using modules. It is quite hard for me to use different notation (module vs. footprint) as the UI part of the plugin and plugin backend were developed more or less at the same time. I will try to replace all references to modules with footprints. Furthermore the plugin is based upon the python script by @mmccoo and he used the term pivot so I just reused it without thinking. And obviously english is not my first language. So if you have a better suggestion please let me know (again I’d prefer if you open an issue on GitHub or even better create a PR).
I remember a long time ago playing with an animated gif generator being able to specify a frame rate on a frame-by-frame granularity. So it should be possible to lower the fame rate over-all, and lower it even more for specific durations and/or individual frames. For file size control, really useful to be able to change how long individual frames are displayed instead of duplicating frames (or generating tweens) to maintain a single frame rate. I don’t know what tools are available now to do this, but now you know that there is this feature to search for.
Add possibility to define the bounding box with a polygon or polygonal shape in some extra layer (Margin, Dwgs…). The anchor footprint must be inside that box, for other elements everything inside the box (or possibly intersecting it) is duplicated. Also the box would be copied and the old one deleted when a layout is updated.
Certainly this wouldn’t be too easy, it requires geometric calculations a bit like in DRC. But it could be handy if for example partial replication is needed, or there are items other than footprints outside the bounding box of the footprints. It would also be easier to see with one glance what belongs to where and how the connections between the subcircuit and the surroundings should be done etc.
Then a more practical note. If I replicate tracks etc. but forget to delete the old ones they may be duplicated, even many times. Would it be possible to check if the item (track, zone etc.) to be copied is already there exactly in the same place, and if it is, either don’t copy it or delete the old one.
The first one is a wild one, and it would require significant changes to the existent code as I check/calculate only square bounding boxes. I’d have to check each polygon corner position (for footprint courtyards and zones). Doable, but difficult. Coupled with the fact that UI would be awkward at best, the feature would be hardly used and it would significantly increase the maintenance effort and bug likelihood. So if I finish with ever other idea I have, I’ll start with this one (read as: most likely never).
As a workaround for the duplicate tracks, just run the plugin again with delete tracks option selected. Come to think of it, I should probably check this option by default.
I tried to include the Action Plugins on my Ubuntu system but some of them were completely missing (like the replicate layout plugin) were not loaded at all and others like the swap_pins plugin generated errors like
action_swap_pins.py"line 50, in Run )[0]
TypeError: ‘filter’ object is not subscriptable
has anyone which causes this error and was anyone able to get the script running on Ubuntu systems?
Best regards.
kicad version:
Application: kicad
Version: 5.1.0-060a0da~80~ubuntu18.04.1, release build
Libraries:
wxWidgets 3.0.4
libcurl/7.58.0 OpenSSL/1.1.0g zlib/1.2.11 libidn2/2.0.4 libpsl/0.19.1 (+libidn2/2.0.4) nghttp2/1.30.0 librtmp/2.3
Platform: Linux 4.15.0-46-generic x86_64, 64 bit, Little endian, wxGTK
Build Info:
wxWidgets: 3.0.4 (wchar_t,wx containers,compatible with 2.8) GTK+ 3.22
Boost: 1.65.1
OpenCASCADE Community Edition: 6.9.1
Curl: 7.58.0
Compiler: GCC 7.3.0 with C++ ABI 1011
Build settings:
USE_WX_GRAPHICS_CONTEXT=OFF
USE_WX_OVERLAY=ON
KICAD_SCRIPTING=ON
KICAD_SCRIPTING_MODULES=ON
KICAD_SCRIPTING_PYTHON3=ON
KICAD_SCRIPTING_WXPYTHON=ON
KICAD_SCRIPTING_WXPYTHON_PHOENIX=ON
KICAD_SCRIPTING_ACTION_MENU=ON
BUILD_GITHUB_PLUGIN=ON
KICAD_USE_OCE=ON
KICAD_USE_OCC=OFF
KICAD_SPICE=ON
Be more specific, give your Ubuntu version and also KiCad version. For the latter open Help->About KiCad and click Copy Version Information and paste it here.
The first suspect that comes to mind is python3, as my plugins were tested only with python2. Could you please look into the project folder for any log files and send them to me. It would be even better if you raised an issue on github
I’m looking forward to the day Python 2 will finally be obsoleted.
According to Wikipedia its obsolete since 2015:
Python 2.7’s end-of-life date was initially set at 2015 then postponed to 2020 out of concern that a large body of existing code could not easily be forward-ported to Python 3.
Source: https://en.wikipedia.org/wiki/Python_(programming_language)
Python 2 seems to be finally end of lifed by 2020, which is a problem for KiCad because it still seems to be dependent on Wx_bla_bla libs in Python 2 on windoze? See this trhead from earlier today:
It’s not so slow as the metrification of the world. One particular country is still using some other weird units despite repeated attempts to switch to metric. This has been going on since about 1875, and about 100 years later it was unfortunately only “recommended” to switch to metric. None the less, the’re slowly switching, but very slowly. In the meantime here in Europe we get increasinly confronted with weird units in supermarkets and crashing probes on distant planets. Sigh.
There a still some likely bugsof the same sort (in python3 filter returns an iterable instead of list as python2 does) lurking in the code. I’ll try to address them as quick as I can.
The change in how division is handled can also trip you up. But mostly when going from python 3 down to python 2. (Might still be something where you need to invest time when making your project run equally well for both python 2 and python 3. In general the future package should give you an easy way to have your stuff compatible with both.)
I tried the fixes and additional issues came up. I opened a github ticket because its probably better to track the issues there. If you need someone to test the fixes, feel free to call me.