SchrodingersGat / KiBoM

Configurable BoM generation tool for KiCad EDA (http://kicad.org/)
MIT License
352 stars 95 forks source link

Add support for multiple inclusive or exclusive variants #37

Closed AngusP closed 4 years ago

AngusP commented 5 years ago

This adds the ability to effectively 'OR' together inclusive variants ('+') and to AND exclude exclusive variants ('-').

From the README

e.g. if we have a PCB with three components that have the following values in the fit_field field:

  • C1 -> "-production,+test"
  • C2 -> "+production,+test"
  • R1 -> ""
  • R2 -> "-test"

If the script is run with the flag --variant production then C2, R1 and R2 will be loaded.

If the script is run without the --variant production flag, then C1, R1 and R2 will be loaded.

If the script is run with the flag --variant test, then C1, C2 and R1 will be loaded.

If the script is run with the flags --variant production,test, then C2 and R1 will be loaded.

This just adds a little more flexibility and power to the already very-handy PCB variants feature.

I've also added a row to the headers in the XML, CSV and HTML formats that gives the variant for which the BOM was generated. Possibly another command line argument to include the variant name in the filename may be useful too?

Also the logic I settled on was that the part should be fitted if the check field is empty, or if there is at least one include and no excludes. An alternative would be to allow an explicit include to override excludes, though in my opinion the use for that is less clear.

SchrodingersGat commented 5 years ago

Sorry @AngusP can you address the conflicts here thanks :)

AngusP commented 5 years ago

@SchrodingersGat done

AngusP commented 5 years ago

Hi again @SchrodingersGat, just checking in, from my end it looks all OK

trentks commented 4 years ago

Hi @SchrodingersGat can this please be pulled?

Rather silly to have variants without being able to mix and match them.

SchrodingersGat commented 4 years ago

If @AngusP can fix the conflicts in README.md I'll merge. Sorry that this one has escaped my attention.

trentks commented 4 years ago

@AngusP I think you've merged into your working branch, but this pull request is from your master branch. Heads up: you have a merge conflict between your master and working branches, within your KiBOM_CLI.py.

-    print("PCB variant:", args.variant)
+print("PCB variant:", ", ".join(pref.pcbConfig))

SchrodingersGat:master currently has the +print("PCB variant:", ", ".join(pref.pcbConfig)) line.

Cheers.

SchrodingersGat commented 4 years ago

Thanks for the contribution, and the nudge ;)