Support for repeating subcircuits/channels/rooms

Bug #1521062 reported by alex haynes on 2015-11-30
170
This bug affects 60 people
Affects Status Importance Assigned to Milestone
KiCad
Wishlist
Seth Hillbrand

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.

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

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?

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

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?

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) on 2015-12-17
tags: removed: wishlist
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) on 2018-07-07
Changed in kicad:
assignee: nobody → Seth Hillbrand (sethh)
milestone: none → 6.0.0-rc1
status: New → Triaged
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

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.

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.

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

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

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.

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.

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

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.

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

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers