Replicate layout, group already exists. Can you purge groups?

I was working on some project for which I used replicate layout. I seem to have done somerhing wrong. When I opened Kicad again, my components weren’t there.

So I updated the board, all components were put back in and I tried to use replicate layout again. But than I got the message that the group already exists, despite they are nowhere to be found in the board.

What can I do in Kicad to fix this. I would like to purge all groups from my current board design. Can that be done?

Regards :tumbler_glass:

Bas

I use only my plugins so I can’t confirm the following except to say you should see what you need and be able to delete it as the files are simply Text-Files

Open the PCB file in a Text-Editor and look for the stuff you want to delete, it should be Grouped and obvious. Can do the same thing for the Kicad-file and Schematic’s as needed…
(save a backup copy first, just in case…). Exit Kicad then, re-open to confirm…

ADDED: For example, screenshot below shows a Group of two items. I could simply delete the Group… - I just deleted the ‘Group’ and verified the PCB still contains the two items but are no longer in a ‘Group’. Pay attention to the Opening and Closing Parenthesis’
Thus, it should work for you, too…

1 Like

I only know “Group” in KiCad in the context that items can be grouped together or un-grouped.

From what I remember, this grouping was added after the Replicate Layout plugin was made but I’m not sure. Maybe there is some overlap or interference between those two?

1 Like

Can you share the project? Maybe I could look into it. I have read the plugin code and because I was involved in the usage logic and bugfixing (long time ago) I would like to know if there’s a bug.

1 Like

Just in the nick of time, I just manually removed em in VScode but I could Ctrl Z back :smiley:

I only added the board file. There were only 2 groups that I had to remove, they do contain a lot of things.
forEelik.kicad_pcb (1.7 MB) Hope that is enough?

I often make 2 schematic sheets of 8 IO ports and each sheet is further divided into 8 sub sheets. For these kind of things I use replicate layout the most. What I would like to do in those cases is to first replicate and group the 16 IO things (that works), place 8 groups and than replicate again with the IO port sheets to mirror the 8 sub groups. That last part I never got working.

When I start from a template project I can finish a total new board in an hour or so :smiley: I <3 Kicad

This design however was for me butterfly :smiley:

Thx for the help :coffee:

Bas

Hi, author here.

Generally any issues with the plugin should be reported on the plugin’s GitHub page. It makes it easier for me to track them.

As for your issue.

The plugin has limited and weakly tested support for groups, so there is a (high) chance that your workflow uncovered a serious issue with the plugin. If you can recreate the issue, can you share the replicate_layout.log file which should be in the project folder.

I’ll try to look into the project but for recreating the issue I might also need the schematics file.

3 Likes

It isn’t that much work to replicate. I’ll do that in the near future.

The plugin needs the schematic,too. You have to attach the whole project.

EDIT: Mitja already said that. I tried, it fails because it doesn’t find the schematic.

To be clear, there are 2 problems. First the problem with the nested subsheets,

2 sheets A and B

each containing 4 identical sub sheets. Every sub sheet has an R and LED.

Here I used replicate layout one time with subsheets as reference.
Than I manually dragged the sets belonging to sheet_A into a good position.


(unrelated, but the tracks with the vias arent copied)

I want to mirror this layout for the parts of sheet B as well so I’ll use replicate layout a 2nd time with now the main sheet as reference.

afbeelding

And this does work.

However, this mesh is usually a problem when you have much footprints. So I removed the board and I redid the board, but this time I checked ‘group layouts’
afbeelding

That also works. But now the last part. Like before I want to duplicate the layout of sheet A to sheet B. So I enter one of the 4 groups of a component in A. I select one of the footprints and I try to use the replicate layout again. Only this time this message appears

afbeelding

While typing this post, I came up with this workaround.

I manually placed 4 groups into their final position. Therefor I have no need for them being in groups, so I deleted all groups in sight. Than I retried the plugin and…

This seem to work. I did notice a few tracks floating but that may be me screwing around things.

I think this workaround (= ungrouping groups after dragging them in final position) is completely workable IMO.

Back to the other problem.

I rotated one footprint and I tried to replicate the layout again. I checked group layout again but onfotunately the group, which I just manually deleted… still seems to exist.

I looked into the board file with an editor and I saw no groups. So I closed and re-opened the board editor.
And now it does work.

So I think no actions have to be taken.

There is however one smaller 3rd issue. The floating tracks are a recurring theme. I can trigger it fairly simple by using Ctrl-Z after I used the plugin.

This could be annoying, if you replicate something and you have made a mistake or you need to add something.

Regards :tumbler_glass:

Bas
test.zip (23.9 KB)

First of all thanks for the thorough test and report.

Can you bi a bit more verbose what “mesh” and why it is a problem

Yeah the KiCad group implementation is not really best suited to use with the Replicate Layout plugin. Especially nested replication. So if you want to replicate layout and use groups (for whatever reason) then the only way is to replicate nested sheet, delete the groups, restart Kicad and replicate parent sheet.

Yeah it looks like that even when one deletes the groups, they are not freed from memory, and plugin can still detect them, therefore emitting an error. I think I experienced this before but I did not know where is the issue. Your testing is pointing me in the right direction. Again, thanks for this.

So if I understand you correctly, when you run the plugin and then you undo the plugin action, the footprints position is undone, while replicated tracks stay?

If either the groups are not really deleted, or some reference remains in a (linked?) list, then this is a bug that should be reported on gitlab. And all the better if you can replicate this in a (simple) test project and add that too.

Yes this!

Can you bi a bit more verbose what “mesh” and why it is a problem
Most certainly.

If you start up the board editor the first time and update. Kicad nicely puts groups of components into the board. The components are arranged according to the schematic sheets, so one can find their things relatively easy. And there are no footprints overlapping at this point.

If you route one of the groups of components and run replicate layout. The components and tracks of the newly formed groups may be lying on top of eachother. This is what I called a ‘mesh’. The plugin does not relocate the groups in order to create space between. If the components aren’t grouped by the plugin there is no way in pulling the groups apart from eachother.

There are 2 workarounds, 1 is simply using the ‘make group’ option. so you can pull the groups away from eachother. This has my preference as groups prevent you from accidently doing damage.

Option 2 is to make space yourself by preplacing the components so that there is enough space for the new groups to be replicated.

Kind regards,

Bas

Aaah,

the plugin is intended to run only after you placed the destination anchor footprints at their final positions. You can use “Place footprints” action plugin for this. In this case you don’t need to use group as replicated sheets should be in their final positions and there should be no overlaps.

For example, you have a sheet consisting of Q, D, R, R. You layout the sheet 1 (placing Q101, D101, R101 and R102) then you place sheet 2 and 3 anchor footprints (D201, D301) - destination anchor footprints. Then you select source anchor footprint (D101) and you run the plugin.

This is the intended workflow (and also the reason for “Place footprints” plugin)

Yeah with:

  1. python API becoming deprecated
  2. rumors that KiCad will get native solution for replication process
  3. my lack of time

I don’t have high hopes of the bug being resolved neither am I really motivated to build a test case and report this bug.

Thanks for understanding

So first route a group, determen where the next one should begin, run ‘place footprint’ and lastly run replicate layout.

Imma gonna try this out :+1:t2:

Thank you for your efforts :tumbler_glass:

Bas

I don’t think we understand each other.

First route a group. Then place the destination anchor footprints. Either manually or using Place footprints or even KiCad’s native array tools. Then run the Replicate layout plugin

I think we do, we are saying the exact same things. I only added ‘determen where the next one should begin’ (meaning: figuring out where the next anchor footprint should begin).

1 Like

Of these, I think number 1 will happen sooner. At the moment the plan is to remove the support in v10 (PCB Python Bindings | Developer Documentation | KiCad).

Number two is an interesting problem. The plugin has been one of the flagships of the plugin system, very popular and often recommended. It works well (sans these kind of edge cases). The existence of the plugin may actually be one reason why the feature hasn’t been implemented yet in KiCad proper. There has been some plans and talk, but it has been postponed for many years.

1 Like