Add bom ignore option for cables and connectors
This commit is contained in:
parent
4e4dac8597
commit
389e48035d
@ -65,6 +65,7 @@ class Connector:
|
|||||||
hide_disconnected_pins: bool = False
|
hide_disconnected_pins: bool = False
|
||||||
autogenerate: bool = False
|
autogenerate: bool = False
|
||||||
loops: List[Any] = field(default_factory=list)
|
loops: List[Any] = field(default_factory=list)
|
||||||
|
ignore_in_bom: bool = False
|
||||||
|
|
||||||
def __post_init__(self):
|
def __post_init__(self):
|
||||||
|
|
||||||
@ -139,6 +140,7 @@ class Cable:
|
|||||||
color_code: Optional[str] = None
|
color_code: Optional[str] = None
|
||||||
show_name: bool = True
|
show_name: bool = True
|
||||||
show_wirecount: bool = True
|
show_wirecount: bool = True
|
||||||
|
ignore_in_bom: bool = False
|
||||||
|
|
||||||
def __post_init__(self):
|
def __post_init__(self):
|
||||||
|
|
||||||
|
|||||||
@ -336,7 +336,7 @@ class Harness:
|
|||||||
bom_extra = []
|
bom_extra = []
|
||||||
# connectors
|
# connectors
|
||||||
connector_group = lambda c: (c.type, c.subtype, c.pincount, c.manufacturer, c.mpn, c.pn)
|
connector_group = lambda c: (c.type, c.subtype, c.pincount, c.manufacturer, c.mpn, c.pn)
|
||||||
for group in Counter([connector_group(v) for v in self.connectors.values()]):
|
for group in Counter([connector_group(v) for v in self.connectors.values() if v.ignore_in_bom is not True]):
|
||||||
items = {k: v for k, v in self.connectors.items() if connector_group(v) == group}
|
items = {k: v for k, v in self.connectors.items() if connector_group(v) == group}
|
||||||
shared = next(iter(items.values()))
|
shared = next(iter(items.values()))
|
||||||
designators = list(items.keys())
|
designators = list(items.keys())
|
||||||
@ -355,7 +355,7 @@ class Harness:
|
|||||||
# TODO: If category can have other non-empty values than 'bundle', maybe it should be part of item name?
|
# TODO: If category can have other non-empty values than 'bundle', maybe it should be part of item name?
|
||||||
# The category needs to be included in cable_group to keep the bundles excluded.
|
# The category needs to be included in cable_group to keep the bundles excluded.
|
||||||
cable_group = lambda c: (c.category, c.type, c.gauge, c.gauge_unit, c.wirecount, c.shield, c.manufacturer, c.mpn, c.pn)
|
cable_group = lambda c: (c.category, c.type, c.gauge, c.gauge_unit, c.wirecount, c.shield, c.manufacturer, c.mpn, c.pn)
|
||||||
for group in Counter([cable_group(v) for v in self.cables.values() if v.category != 'bundle']):
|
for group in Counter([cable_group(v) for v in self.cables.values() if v.category != 'bundle' and v.ignore_in_bom is not True]):
|
||||||
items = {k: v for k, v in self.cables.items() if cable_group(v) == group}
|
items = {k: v for k, v in self.cables.items() if cable_group(v) == group}
|
||||||
shared = next(iter(items.values()))
|
shared = next(iter(items.values()))
|
||||||
designators = list(items.keys())
|
designators = list(items.keys())
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user