Ignore a part for the board?

I have a hierarchical sheet with multiple instances. But for one instance I don’t want some parts of it on the PCB. I could just place them outside the board, but is there a better way? Maybe would be nice if I could say in the Assign Footprints dialog that this part should not be on the board, but I couldn’t find a way to do it.

There is a way to add components to the schematic that do not get exported to the PCB. This is sometimes used for mounting brackets, screws& washers and other stuff. You can do that by putting a # in front of the reference name. This would delete those components for all instances on the hierarchical sheets though.

Placing the components off-board is a very simple solution but also ugly. Those components will cause DRC errors.

You can also simply delete the the footprints from the PCB after they are imported. This also deletes the connections to them from the netlist. Disadvantage of this method is that the components re-appear every time the netlist is updated.

You can also copy the hierarchical sheet and remove those components from the copy. Disadvantage of this method is that when a change is made on the hierarchical sheet, you must make that change on both copies. This easily leads to errors.

One possibility might be to make one hierarchical sheet for the common components and use it directly in the top level and the second time in another hierachical sheet.

In you main shematic sheet create a hierachical sheet. Let’s change the name to A and file name to A.sch. Copy the file name of this sheet (or at least remember it). In this new sheet add those components which are common to all instances. Add hierarchical labels. Save. Go back to top level and import sheet pins.

Create another hierachical sheet in the top level. Let’s call it B. Enter this sheet. Create another sheet there. Let’s call it sheet C, but paste the file name A.sch into the file name field. If you enter this deeper level sheet you should see the components from your first hierarchical sheet. Go back to B. Add components around the inner sheet, import pins in sheet C, draw wires and add new hierarchical pins.

Go back to top level. Import pins. You should now have two hierarchical sheets visible there. One has only the common components, the other has also extra components. Duplicate the one which has extra components.

4 Likes

I don’t like the workarounds. Maybe a new feature in the assign footprints dialog would be useful to select “don’t place”? I’m a programmer, so I could implement this myself. How should it look like and what name should it have?

A schematic symbol in KiCad is a pretty symplistic thing.
You can either include it by giving it a normal reference name, or exclude it for the PCB by prepending the reference with “#”.

How would you want your place “Maybe, sometimes if …” to look like?

There are a bunch of different side projects around KiCad. At least one of those projects is a python library to help with generating a netlist directly from python.
You could generate your whole, or a part of your netlist with such a script.
You could use such scripts to delete a sub set of the components from the netlist or PCB.

https://duckduckgo.com/?q=kicad+python+netlist&t=opera&ia=images
You may want to look into “skidl”.
https://hackaday.com/2016/12/28/skidl-script-your-circuits-in-python/

But there may be other tools floating on the 'net.

I can’t quite follow your logic. You have a hierarchical sheet with multiple copies but you want one of the copies to be different than the others. I see only two options: either don’t use a copy of that sheet for the one subcircuit which is different, or use my “workaround”.

As a programmer you understand that this is how things are done when you write a program. Create an instance of a class or write a subclass which is partly different. The common functionality is incapsulated in one class, then you instantiate that class directly and write another class which inherits the common functionality.

1 Like

Ok, I tried it with the “#” and it works, even for hierachical sheets. I though it didn’t work, because you first wrote that it would delete it for all instances, but the reference is different for each sheet instance. So no need to change anything. Although using “#” is a bit non-intuitive, maybe it could have an additional more descriptive button in the assign footprint dialog which just adds the “#”.

On second thought, maybe I just didn’t understand what you need.

Even “no footprint” would be possible in cvpcb (“Assign footprints”) it wouldn’t work with hierarchical sheets because they seem to change the footprints of all instances when you change one. But you found your solution already.

No, it doesn’t change it for all instances of a hierarchical sheet. Say for example I have a hierarchical sheet with one resistor and two instances of it. After “annotate schematic” in one instance it is named R1 and in the other instance R2. Then I can just rename it “#R2”, and then just R2 doesn’t show up, problem solved :slight_smile:

And now, when a 3rd party (or you 3 years later) tries to reconcile your schematic to your PCB, they will waste time looking for R2 that doesn’t exist.

Unless you also put a comment on your hierarchical sheet stating something to the effect of “If these component have a # preceding the reference then they don’t have a footprint on the PCB.” (Worded that way because the comment will necessarily be the same on all instances of that hierarchical sheet.)

1 Like

Why would I need this? This is a standard KiCad feature, everyone should know it.

Well, I wouldn’t call it a “standard feature”. It’s more of a a hidden (and non-obvious) workaround unique to KiCad (i.e. not an industry standard AFAIK) that some of us who know a little about how KiCad works under the skirts know about.

Who knows if it will change in v6 (and then be forgotten, known only by the backwards compatible input routine)?

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.