Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] "Exclude from Bill of Materials" Still Included In the BOM #522

Closed
dbeckwith01 opened this issue Nov 29, 2023 · 4 comments
Closed
Assignees
Labels
bug Something isn't working

Comments

@dbeckwith01
Copy link

Describe the bug
I am using the docker image for KiBoT on a MacBook M2 Pro to automate my fabrication outputs. I have noticed the when the "Exclude from Bill of Materials" is ticked in the schematic file it still shows up in the BOM.

I have posted this issue on KiBOM initial and I was asked to repost here.

To Reproduce
Using docker via docker run --rm -it -v ./:/src setsoft/kicad_auto:ki7 /bin/bash
Run KiBot with the following command kibot -c ./src/config.kibot.yaml -e ./src/Test.kicad_sch -b ./src/Test.kicad_pcb

Expected behavior
If "Exclude from Bill of Materials" is ticked, the part is not listed in the BOM.

Environment (please complete the following information):
Where are you running KiBot:

  • In a CI/CD workflow? In docker on local machine and also via GitHub
  • In a GitHub action? Which tag are you using? Using v2_k7 with GitHub action
  • Using a docker image? locally kicad_auto:ki7
  • Using a desktop system? MacBook M2 Pro, running MacOS Sonoma v14.0, running docker with Rosetta2

Additional context
Test.zip

@set-soft set-soft added needs more info Further information is requested bug Something isn't working and removed needs more info Further information is requested labels Nov 30, 2023
@set-soft
Copy link
Member

Hi @dbeckwith01 !

I think I know what the problem is. You are using exclude_from_bom, but not dnp (Do not populate flag).

This usually works for KiBoM because KiCad doesn't even list these components when creating the netlist from the GUI, but KiBot uses the command line interface of KiCad which includes them, of course with a flag exclude_from_bom.

So KiBoM is only implementing the dnp flag because @SchrodingersGat never saw a netlist file with the exclude_from_bom flag. On the other hand KiBot is generating the XML files with all the components, just reflecting the correct flag, and using KiCad! but not the GUI.

The patch for KiBoM is really simple:

diff --git a/kibom/component.py b/kibom/component.py
index b005b01..336bf33 100755
--- a/kibom/component.py
+++ b/kibom/component.py
@@ -354,7 +354,8 @@ class Component():
         # First, check for the 'dnp' attribute (added in KiCad 7.0)
         for child in self.element.getChildren():
             if child.name == 'property':
-                if child.attributes.get('name', '').lower() == 'dnp':
+                name = child.attributes.get('name', '').lower()
+                if name == 'dnp' or name == 'exclude_from_bom':
                     return False
 
         # Check the value field first

I'm creating a PR SchrodingersGat/KiBoM#197

@set-soft
Copy link
Member

Updated docker images should be available now. Let me know if you have any problems

@dbeckwith01
Copy link
Author

@set-soft Thank you for looking into this, discovering the issue and providing the diff. What's the best way to implement this fix given that I'm using the Docker images. I guess I should wait until KiBoM is updated and then the KiBoT image can be updated.

@set-soft
Copy link
Member

set-soft commented Dec 1, 2023

Hi @dbeckwith01 !

I updated the docker images. The KiBoM package should be 1.9.1-2, try pulling fresh images and run:

$ dpkg -l kibom*
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name            Version      Architecture Description
+++-===============-============-============-==========================================
ii  kibom.inti-cmnb 1.9.1-2      all          Configurable BoM generation tool for KiCad

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants