aboutsummaryrefslogtreecommitdiff
path: root/src/ee/kicad/to_bom.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/ee/kicad/to_bom.py')
-rw-r--r--src/ee/kicad/to_bom.py17
1 files changed, 15 insertions, 2 deletions
diff --git a/src/ee/kicad/to_bom.py b/src/ee/kicad/to_bom.py
index 8ca3c19..354d9ba 100644
--- a/src/ee/kicad/to_bom.py
+++ b/src/ee/kicad/to_bom.py
@@ -35,8 +35,21 @@ def comp(c: Component) -> Element:
return comp
-def to_bom(schematic: Union[Schematic, Schematics]) -> Iterable[Component]:
- return [c for c in sorted(schematic.components) if c.has_ref_num and c.ref_type != "#PWR" and c.ref_type != "#FLG"]
+def to_bom(schematic: Union[Schematic, Schematics], require_ref=True) -> Iterable[Component]:
+ bad_ref_types = ("#PWR", "#FLG")
+
+ cs = []
+
+ for c in sorted(schematic.components):
+ if require_ref and not c.has_ref_num:
+ continue
+
+ if c.ref_type in bad_ref_types:
+ continue
+
+ cs.append(c)
+
+ return cs
def to_bom_xml(schematic: Schematic) -> Element: