Support for repeating subcircuits/channels/rooms

Bug #1521062 reported by alex haynes
186
This bug affects 36 people
Affects Status Importance Assigned to Milestone
KiCad
Expired
Wishlist

Bug Description

It is very common for circuits to have the same subcircuit repeated multiple times. Currently you have to cut and paste the circuit multiple times in Eeschema and then layout each instance of the subcircuit one at a time in Pcbnew. I am aware of the klonor-kicad scripts ( https://www.youtube.com/watch?v=mChTfL746Fs ) but they really don't work very well if you want to make changes to the schematic and then propagate them forward to the PCB. If had the ability to have a subcircuit automatically repeated multiple times in the schematic editor and then had the ability to copy the layout to the different instances of the circuit in Pcbnew that would be a huge time saver. It would also result in nicer looking layouts since it would get copied exactly right. For me personally this is the biggest problem I have with KiCad, which I think is generally pretty great. It is weird to me that this is not anywhere on the development roadmap.

Revision history for this message
Wayne Stambaugh (stambaughw) wrote :

They are called sheets in Eeschema. You can reuse them at will and copy the .sch file and use them in other projects as well. It's a common well documented technique. There are some weaknesses in the current design. The .sch file must be in the same path as the project file. I'm hoping to fix this during the next development cycle.

Changed in kicad:
importance: Undecided → Wishlist
Revision history for this message
alex haynes (aheinous) wrote :

I am aware of the hierarchical sheet feature. As far as I can tell this is different than what I'm talking about. If I try to make multiple hierarchical sheet symbols that reference the same .sch file then I get "Multiple Item" errors when I try to annotate the schematic. I know I could just copy the .sch file but this isn't really satisfactory since I would have to edit all the copies individually to make changes. There is also no way to layout just the sheet and avoid having to repeat the layout for each "channel." What I want is, for example, a way to have the same input buffer repeated six times for a sound card with six inputs.

Revision history for this message
alex haynes (aheinous) wrote :

Okay, I just got multiple sheet symbols to point to the same .sch file. It is clearly mention in the documentation so that's my bad. Am I correct that there is no way to copy the layout?

Revision history for this message
Wayne Stambaugh (stambaughw) wrote : Re: [Bug 1521062] Re: Support for repeating subcircuits/channels/rooms

You can copy and paste using block save command and then pasting the
block elsewhere in your schematic. If you want to copy and paste blocks
between projects, you must run Eeschema executable so you can open
schematics from different project. When Eeschema is launched from
KiCad, it is in project mode so opening schematics other than those in
the current project is disabled.

On 11/30/2015 7:18 PM, alex haynes wrote:
> Okay, I just got multiple sheet symbols to point to the same .sch file.
> It is clearly mention in the documentation so that's my bad. Am I
> correct that there is no way to copy the layout?
>

Revision history for this message
alex haynes (aheinous) wrote :

By layout I meant as in pcbnew. Ultimately what I want is to be able avoid having to layout (component placement, PCB tracks, etc.) the same subcircuit more than once. I didn't know you could reference the same hierarchical sheet more than once (I had tried before and it didn't work for some reason) in Eeshema but now that I do I'm fine with the way things work in Eeschema. Am I correct that you have to just manually repeat the layout in pcbnew?

Revision history for this message
Wayne Stambaugh (stambaughw) wrote :

On 12/2/2015 10:01 PM, alex haynes wrote:
> By layout I meant as in pcbnew. Ultimately what I want is to be able
> avoid having to layout (component placement, PCB tracks, etc.) the same
> subcircuit more than once. I didn't know you could reference the same
> hierarchical sheet more than once (I had tried before and it didn't work
> for some reason) in Eeshema but now that I do I'm fine with the way
> things work in Eeschema. Am I correct that you have to just manually
> repeat the layout in pcbnew?
>

Yes. Pcbnew does not support links to external footprints or modules.
It's been discussed on the developer's mailing list in the past but it's
a matter of manpower and priorities as to when this would be implemented.

xzcvczx (xzcvczx)
tags: removed: wishlist
Revision history for this message
Franck78 (fbourdonnec) wrote :

A solution ?

Let's assume each sub-circuit is displayed exactly replicated in eechema.

Select a sub-circuit.
Apply a group membership to each component and also an ID in that group.
The trick is to have the same ID for the same component of the group.
Hence the display exactly the same so that the scan routine always find the same thing at the same position and get the same ID.

Now we have identified and ordered sub groups of components.
Add that info to the netlist

Switch to pcbnew, import the netlist.

Note instead of stacking all components blindly, each group could be displayed not stacked.

Select a group (mouse or software function)
Arrange it
Snapshot the group (eg position of each member)
Select another group
Apply the snapshot. Each component of the same id goes to same relative position.
Move the group
Repeat
Done.

Problem ?
Component containing a sub function (2 gates) shared in two sub-circuit.

The snapshot function can optionally ignore the vias and the tracks or clean a target group before being applied.

Not overly complicated. The 'group' is the base for a bunch of things (and a request).
have the group locked and seen as one component for all others operations (align distribute,...)

The real thing here is the way groups are implemented. Groups flat or hierarchical. Grouped in eeschema or in pcbnew ?

Seth Hillbrand (sethh)
Changed in kicad:
assignee: nobody → Seth Hillbrand (sethh)
milestone: none → 6.0.0-rc1
status: New → Triaged
Revision history for this message
eelik (eelik) wrote :

Seth seem to have taken this, thanks to him for that. For everyone's information: this seems to be a very common question in the forums. Searching for "repeat subcircuit", "duplicate layout", "replicate layout" and some other related phrases gives maybe tens of threads. Here are some:

https://forum.kicad.info/t/how-to-repeat-multiple-layout-blocks/14560 (The latest)
https://forum.kicad.info/t/replicate-layout-action-plugin/8539 (Important. Seth has taken part in this discussion)
https://forum.kicad.info/t/repeating-the-same-layout-for-identical-subcircuits/5092
https://forum.kicad.info/t/how-to-duplicate-a-pcb-layout-in-kicad-5/12909
https://forum.kicad.info/t/duplicating-part-of-a-layout/9789
https://forum.kicad.info/t/set-same-layout-for-all-hierarchical-sheets/6346

Revision history for this message
zakhar nasimov (thedocument) wrote :

A fwe reccomendations from https://bugs.launchpad.net/kicad/+bug/1818642 this feature should have its own module to manage the templates/various circuits. Also should be exportable and made easily portable.

Revision history for this message
eelik (eelik) wrote :

@zakhar: We seem to be talking about different things. This report is about identically repeated layout section inside one board. Yours is about re-using between projects.

If someone hasn't followed the user forum, the "Replicate layout" action plugin (linked to in the post above, https://forum.kicad.info/t/replicate-layout-action-plugin/8539) has been developed further and looks very useful. It's both simple enough and powerful enough. In my opinion the functionality of it would be a good model for "native" implementation unless someone comes up with a better one.

Revision history for this message
Seth Hillbrand (sethh) wrote :

Proposed Tech spec for this feature is at:
https://docs.google.com/document/d/1y7AL9M4350vifdX3lmcU77sLQ8YWy-fBtMmfsXEObqg/edit?usp=sharing

Comments on missing features in this spec should be added to this bug report

tags: removed: channel channels clone clones copies copy klonor repeat repeating subcircuit
Revision history for this message
Matt Rohloff (mrohloff) wrote :

@Seth: Regarding the tech spec. In pcbnew, are linked-rooms an identical image of their parent room? E.g. component C34 in the parent room is also C34 in the linked-room. (I would like this.) Thanks for the clarification.

Revision history for this message
Seth Hillbrand (sethh) wrote :

No. This is for repeating circuit elements that remain linked to the netlist. Duplicating the reference designators would break netlists and, as such, will not be supported at this time.

Can you say a bit more about your use case here? Maybe it fits with some of the other wishlist items like lp:1782927

Revision history for this message
Matt Rohloff (mrohloff) wrote :

@Seth: I guess I'm not good at explaining... I listed that # in my last report (Bug #1823478). I don't want netlist links or anything related to the schematic. Just carbon copies of the PCB layers that are within a defined boundary. The carbon copies are objects that cannot be decomposed (unlike groups). Dynamic panelization.

Revision history for this message
Wayne Stambaugh (stambaughw) wrote :

@Matt, KiCad's primary design goal does not really include panelization support. I'm not opposed to it but it is a very low priority for the project. Some day when we have feature parity with proprietary products, we may look into it.

Revision history for this message
Tomasz Wlostowski (twlostow) wrote :

I second Wayne on that. We are an Circuit/PCB layout package, not CAM software for PCB manufacturers. I've seen even some people asking to add under/overetch compensation to the Gerber exporter. While not impossible, I think it has veeery low priority...

Revision history for this message
Hildo Guillardi Júnior (hildogjr) wrote :

I have one propose. The creation of a object type, some rectangle, to allow replicate the inside components.

The use of the "#" symbol will define the counting. Also the rule to the designator could use "#".

The attached image explain the idea how it will (in high level understanding) replicate and group the signals.

Revision history for this message
Hildo Guillardi Júnior (hildogjr) wrote :

Also the rules applied inside than will be used by all instances.
Second https://docs.google.com/document/d/1qvCH9aHwCzp5qtKTna4jJXuloNU0b96gAxAHSKPuXpU/edit#

Revision history for this message
Heitor (heitorpbittencourt) wrote :
Revision history for this message
Rene Poeschl (poeschlr) wrote :

@heitor: no the bug you link is about reuse of schematic "blocks" by different projects. This bug is for having something similar to multiple instantiation of schematic sheets for the layout side. (duplication of layout within the same project including still being linked to a counterpart of the schematic)

Revision history for this message
Dino Ghilardi (dino-ghilardi) wrote :

Here some thoughts and a possible partial approach considering just the eepcb placement of similar blocks. At first does not consider routed tracks, but it can help a lot in component placement and should be easier to implement as a first step):

-Identify a "repeatable" subcircuit in eeschema just putting it in a single hierarchical sheet
-add to pcbnew a function to repeat the placement of the components of that subsheet.

Using the hierarchical sheet to idendify the subcircuit to repeat it without using "a group id" as mentioned before probably will make such a schematic more readable and can be done without the need for file format change so it can be ported also in 5.x line.

Usage example hypotesis:
1) eeschema: Draw the subcircuit schematic you want to repeat in a single hierarchical sheet.
2) eeschema: in its parent hierarchical sheet copy-and-paste the subcircuit blocks and connect them as needed
3) Synchronize pcb (F8)
4) pcbnew: do the placement of all the components of one of the subcircuits on the pcb.
5) pcbnew: select one of the components just placed.
6) pcbnew [new function]: right-click on the same component of another subcircuit and select "place subcircuit components".

The new function now should select all the components of the subcircuit (those in the same schematic hierarchical sheet of the right-clicked one) and put them in a relative position respect to the selected one that is the same of the placed ones, leaving them selected. Then with "move" or "move exactly" the whole pre-placed block can be placed, using the right-clicked component origin as block origin.

As an evolution/new function starting from this, tracks connecting those components could be copied and put in the selection (the problem here will be the selection of the parts of the tracks to copy and a probable solution is to fully copy the tracks that belong to nets local to the corresponding hierarchical sheet and find some algorithm to choose which part of the other tracks to select).

Cheers,
Dino

Revision history for this message
eelik (eelik) wrote :

"Here some thoughts and a possible partial approach"

You just re-invented the wheel, the Replicate plugin by MitjaN(link in comment #10) does pretty much that (and more). Here is for convenience a link to the more or less up-to-date instructions I gave to one user: https://forum.kicad.info/t/replicate-layout-action-plugin/8539/41

Revision history for this message
Dino Ghilardi (dino-ghilardi) wrote :

Thanks eelik, It seems I missed the plugins! I'm just trying it and on my machine with kicad from master branch I get a "fatal error when running replicator" and a segfault when I use it on a complex board. I'm now trying to figure out if it is a problem of my build system or a real bug (re-compiling everything).

tags: added: feature.request
Revision history for this message
KiCad Janitor (kicad-janitor) wrote :

KiCad bug tracker has moved to Gitlab. This report is now available here: https://gitlab.com/kicad/code/kicad/-/issues/1998

Changed in kicad:
status: Triaged → Expired
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.