Thanks for the info. I’ve pushed a quick fix which allows the plugin window to be resized, and I really hope that this makes the plugin usable. But this is all the effort I am willing to put into this as with forthcoming migration to python3 and subsequent upgrade/removal of wxpython I’d rather fix other issues than deal with wx issues.
You should be able to do them one by one. If this is not working I’ve got a bug. Might be related to the already reported one. But it will be some time, before I am able to start fixing it. The order of placement is related to the order of annotations, which is usually related to the order of sub sheet creation. As a workaround, you can replicate them somewhere off the board area with enough spacing that you can select them one by one and move them to desired location.
Thank you very much Mitja fantastic response time. That works a treat, no more chunky graphics needed
OK, I played around a bit and found that if I start with the lowest numbered module they do go in numerical order. Perversely, I started with the highest numbered one because that way the numbering makes sense with relation to their order. Starting with the lowest and using a negative offset gives the desired result. I hope I didn’t cause you too much angst with this one - sorry m(_ _)m
Fast response was pure luck as I was just browsing the forum at the time and the GUI fix was quick as it was quite simple. Thanks for feedback regarding GUI issues.
Also thanks for the negative offset trick and I’ll have to test the plugin if it is started at the end or middle.
I’ve just published major revision of the plugin. The plugin will replicate the layout around the anchor footprint. Such behavior enables more flexible layout schemes besides linear and circular which were supported until now (thanks for the idea @eelik). Old behavior can be mimicked with the use of just published Place footprints action plugin.
I don’t have anything productive to use this for right now, but I tested this for fun. With the new functionality it’s great! With the design I showed above this plugin would have saved hours of work.
One small wish: reading schematic to find “sheets to replicate” is a bit tedious. If I lay out the reference footprints manually I have already done that, but when the list appears in the plugin’s GUI it would be easier to select by reference designator because they are directly visible in the layout. So you could add the reference designators of those footprints which are used as location reference. Instead of for example just:
sheet1
sheet2
…
it could have
sheet1 (R2)
sheet2 (R4)
…
[A Distraction questions, Sorry @MitjaN] With @eelik feedback, I cannot stop wondering what about this UI way:
Done. Thanks for the feedback. It is highly appreciated.
Hello Mitja,
I am having trouble using the replicate layout action plugin. It appears to be installed properly on my Mac (it shows up in External Plugins) and I get error messages and windows from it. My questions:
-
Is there a slower version of the animation than the one at your github site? On my Mac, it changes pages about once per second or less which makes it impossible to read carefully.
-
Could you tell me the meaning of “anchor module” and “pivot module” please? Are they footprints?
-
I have a completed, hierarchical schematic for a test case (one circuit, two identical copies wanted). The schematic consists of the Root with two sub-sheets called Rep1 and Rep2. Each of those invokes the actual schematic called Base.sch. The project is Rep.pro. Base.sch does not appear in the list of files within the project. Is that a problem?
-
I have laid out one copy of the desired circuit using Rep1 (which calls Base.sch) and I want to make another copy. I clicked on one footprint in the layout but I don’t know how to declare that as the anchor. Nor do I know how to select and declare the pivot. Could you help please?
-
When I click on “Replicate layout” in “Tools -> External Plugins…”, I get the Replicate layout window that shows two areas, the top entitled “Hierarchy level” and the lower entitled “Sheets to replicate”. Both are blank. What am I doing wrong here?
This is my test case. My actual use case is to make 11 replicates of a moderately complex circuit. Could you help me to understand what I am doing wrong, please?
Any help, from anyone, will be gratefully received and acknowledged.
Thank you for your time
Peter
“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.
Thank you again,
Peter
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.
A wild idea for future.
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
ubuntu 18.04.2
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.
you’re absolutely right, i added the info in my posts above.
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