Comment out parts of a schematic

Hi,

I need parts of a schematic not for now but for later use. Is there a way to ‘comment out’ these parts like I’d do with /* */ in C ?

THX
Cheers
Detlef

I believe if you precede the device ref designator with # they will be ignored when making the PCB.

I use this to show external components for clarity of function.

1 Like

Hi,
yes, that works.

Thank you very much.

Cheers
Detlef

Please be cautious.
When the part is “commented out” it will not be in the BOM. It will also NOT have a footprint on the PCB.

I suspect you DO want a footprint for the optional components.

You can give the component a value of DNI " do not install" or optional.

2 Likes

There is another pb, with the annotation, which does not seem to consider a leading ‘#’ as a “special character”.
Then, #R is considered a different, valid, prefix than R, and is annotated independently.

image

This may lead to designators reassignation (commented RefDes), and conflicts (uncommenting a reassigned RefDes).

Anyways, the suppression of the footprint is indeed a no-go for most practical uses.

I don’t know if this is specific to v5.99.

There is a flag to exclude a component from the BOM.
Select the component, and open the editor (shortcut “E”).
There is a checkbox to exclude the component from the BOM. This exclusion is propagated to all the units of a multipart symbol, no need to repeat the process for each part.

I checked the BOM : works as expected.

I noted that the pick and place files are not modified accordingly. This may be a problem, depending on your fab process.

I didn’t find a way to get a list or status of all the excluded parts. Unless the design is very small, tracking exclusion may be problematic.

There is also a checkbox “Exclude from board”.
It doesn’t seem to do anything.
In fact, the component is still present in the 3D view and in the pick and place file, no visible difference.
Maybe I made wrong assumptions about this function ?

I would be interested in some feedback on the “Exclude from board” function, or other people tests results.

I use the latest nightly build of v5.99.

Did you update the PCB from the schematic after unchecking Exclude from board? If the footprint stays even after that, it’s a bug because the purpose of it is to exclude it from the board (surprise, surprise; see the tooltip).

And indeed, it’s a bug, the part is excluded only when the checkbox is checked when the board has not yet been updated after adding the symbol.

EDIT: https://gitlab.com/kicad/code/kicad/-/issues/8418

EDIT2: Oh well, it wasn’t a bug after all. It needs “Delete footprints with no symbols” option in the Update dialog.

I don’t know if the pick’n’place thing is a bug or a missing feature or what. You could file an issue.

I think tracking the exclusions would be a part of the larger major feature, assembly variants, https://gitlab.com/kicad/code/kicad/-/issues/2131.

Thanks for the reply.
The “Exclude from BOM” feature is probably what the OP requested in the first place (but it only exits in v5.99).

Now, when a component is removed from the BOM, for consistency, it should be removed from all the other Fab files (pick’n place, assembly drawing), and from the 3D view.
I perfectly understand that this is a work in progress !

Not sure it’s super intuitive. Why keep the footprint in the PCB, if it is explicitly marked for exclusion by the user ?
AND there is a symbol, so I don’t understand how “Delete footprints with no symbols” may apply.
There is probably a good reason, but it escapes me.

It’s also possible to delete the whole symbol and still keep the footprint in the board. That’s why there’s the checkbox in the Update dialog. The “Exclude from board” choice is handled with the same mechanism: just like when there’s no symbol at all when the board is updated.

It’s good to keep UI texts simple, but in this case it hides one use case. Maybe it could be added to the tooltip at least.

It is a checkbox for generic purpose in Eeschema / Tools / Update PCB from Schematic [F8] Some people prefer a workflow in which for example mounting holes are not drawn in the schematic, but directly added to the PCB with Pcbnew / Place / Footprint.
Enabling the “Delete footprints with no symbols” option will also delete such footprints.


[Edit]
I always put the mounting holes in the schematic because it is more robust. If the mounting holes are directly inserted on the PCB, they can get deleted during Eeschema / Tools / Update PCB from Schematic [F8] if “Delete extra footprints” is selected. (I think KiCad does not delete them if the’re locked on the PCB)

While looking around in KiCad (v4.07 those time) I found in KiCad\bin\scripting\plugins\kicad_netlist_reader.py the following lines:

# You may exlude components from the BOM by either:
#
# 1) adding a custom field named “Installed” to your components and filling it
# with a value of “NU” (Normally Uninstalled).
# See netlist.getInterestingComponents(), or
#…

and later in that file:
if c.getField( “Installed” ) == ‘NU’:
exclude = True

So I am adding (in library) to my symbols I don’t wont them in BOM the field “Installed” and give it a value “NU” and I don’t have them in BOM.

Hi,
I suspect my limited english didn’t help explain : I understand the workflow and the intent.

My concerns (so to speak…) are about the difference of behaviour whether a footprint is already present in the PCB.
IMO, from a mi own user point of view, doing nothing when a footprint is already here is not a correct UI behaviour. Te intent of the user is (indeed) to exclude the part.

I don’t know the internals of Kicad (just beginning to try compiling in Linux Mint, still collecting the various dependencies…).
But for me, the "Exclude from board” really looks like a WIP. This is indeed very different from “buggy”.

What I guess is as follows:

  1. Currently, the "Exclude from board” option does no more than breaking some internal “link” between the Symbol (+ netlist connections) and the Footprint.

  2. If the board is still not populated, the footprint is not added.

  3. But if the footprint is already in the PCB, but as no “link” with a netlist, it is treated like an “orphan” footprint. This is similar to the previous “mounting hole” example.
    The existing code has no reason to remove this “orphan” footprint, unless the “Delete footprints with no symbols” option is set during the update.
    NOTE : If this option is set, all unlocked manually added footprints (mounting holes) are destroyed.

The point 3) is flawn. If a usr selects “Exclude from board”, the intent is indeed to remove the footprint,not to “maybe” remove it.

The option should actually delete the specified footprint from the PCB during the update, without relying on the nuke option during update.

Now, from a UI design point of view, if the current behaviour is kept, the "Exclude from board” option should be greyed out when it won’t do anything.

I analyzed another problem with the two options and duplicated sub-sheets, and the lake of visual feedback, but this post is already way too long (and off-topic) :slight_smile:

My 2 cents…

Thank you, paulvdh for making explicit that while you can add mounting holes to the schematic in eeschema, it is not necessary to do so before adding them to the PCB in pcbnew. At first, I did not conceive of any reason why you would want to do so in eeschema. After reflecting on this matter, it seems to me that you might want to have mounting hole(s) in eeschema if at least one mounting screw is intended to be used to tie two nets together. That would be a good way to explicitly document this fact about the circuit.
Just my thoughts.

Placing the mounting screws in Eeschema allows you to assign them to GND.
Indeed, this can also be made in the PCB editor.

Setting the mounting holes to GND is very common, as it allows them to be merged into the filled GND planes, and to connect GND to the chassis (if applicable).

As a matter of personal preference, I really like to have all the electric connections explicitly visible in Eeschema, including those to the mounting holes, and not spread between the schema and the PCB editor.

2 Likes

I agree, in Kicad, this may be less robust.
In 5.99 (the one I use), the [F8] option has changed to “Delete footprints with no symbols” and will erase “orphan” footprints, even if assigned to a net (GND).
But locked items are not erased.
If you forget to lock the part and select this option, too bad…

I’ve been following the comments one of the points I’d like to make is that - I see the ability to exclude a part from the BOM, but leave on the footprint as a means to handle some of the virtual parts like antenna strip lines.

Second is the ability to exclude from the BOM and PCB layout should not eliminate the parts from the schematic. This would allow parts and items needed for a SPICE simulation to be on the schematic, be excluded easily from the BOM and PCB - yet preserve the items that were used in the simulation. Currently in the earlier versions of Kicad, you can exclude any part from the simulation by using the UI tool for editing the spice model.

Mostly another use case in the discussion and reminder that excluding doesn’t accidently exclude from the spice simulation…