Replicate layout: Action plugin

Thanks for report. I still haven’t figured out the wx framework and even though it should be portable there are always some OS specifics.

When I’ll fix it I’ll ping you for a test.

I am aware of this. One issue I have is that having all plugins in one repo is awkward as the commit log is fragmented. And more to the point I can not use the github release feature.

Second issue is how to approach major change in plugin. Release a new one or just change the current one and screw everybody who got used to the old one?

Generally only devs care about commit log and we know how to filter it for specific directory. So I wouldn’t fret about it.

Why not? You can upload separate archives for each plugin if you want.

I think as long as you provide ways to download older version (like from github release page) you should feel free to move on and develop new things. At least that’s how I think of it.

Of course all of this is totally up to you and you can choose to do things the way that is most convenient for you.

@hildogjr I’ve changed the GUI layout, so if you would be so kind and test it on your platfor, I would really appreciate it.

Thanks for the info, as I haven’t used the feature, I seem to got the wrong information how it is implemented and used

:+1:
I think the change in action_replicate_layout.py file create some bad behavior. The plugin doesn’t appear in Pcbnew list anymore.
I found 2 issues: some identation and some related with self.SetSizeHints (https://wxpython.org/Phoenix/docs/html/classic_vs_phoenix.html, KiCad still using wx classic on Py2).
I made a pull request in your git with my fix. Check the final appearance:

If necessary to port your code with wx3/4 compatibility, it could be used wx.__version__ to control which function will be used.
Some propose for the GUI:

Thanks for testing and PR. I have a question regarding progress bar. Can you point me to some code where this is implemented?

Yes.

In this code https://github.com/xesscorp/KiCost/blob/master/kicost/kicost_gui.py, look by self.m_gauge_process object.
The difference here is that I parsed a progress bar that was originally in Teminal, by CLI software part, and update the the frame.m_gauge_process.SetValue(foo) using the overload GUI_ETAHandler.
In my understanding of your code:

self.m_gauge_process = wx.Gauge(self.m_panel1, wx.ID_ANY, 100, wx.DefaultPosition, wx.DefaultSize, wx.GA_HORIZONTAL)
self.m_gauge_process.SetValue(0) 
self.m_gauge_process.SetToolTip(wx.ToolTip(u"Percentage of the replicate process."))


# In the main loop
self.m_gauge_process.SetValue(count / totalObjectsToReplicate * 100)

should be enough.

Awesome, I have a new project that needs 8 copies of a small module and this worked like magic. Great work. Only one moan, on my 4K screen the dialogue box looks like the image below unless I mess with the display scaling before starting KiCad (possibly a KiCad issue 'cos some of its dialogues are a bit squashed too but still legible). KiCad Version: (5.0.2)-1, release build under Windows 10 on a Dell Inspiron 7559.

Actually, I there is another thing I just noticed; The order of the replicated modules is different to my needs because they are daisy chained and must go in a specific order. Have I missed something? I thought I might get around this by doing them one by one (the dialogue gives the impression that it might be possible by deselecting the others) but no joy :disappointed: Is the order of placement related to the order of sub-sheet creation rather than their names?

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 :grin:

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:

  1. 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.

  2. Could you tell me the meaning of “anchor module” and “pivot module” please? Are they footprints?

  3. 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?

  4. 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?

  5. 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