Add unpopulated option to additional components qty multiplier
This commit is contained in:
parent
2ac80f3ca6
commit
df4a4188ba
@ -408,6 +408,7 @@ Parts can be added to a connector or cable in the section `<additional-component
|
||||
# when used in a connector:
|
||||
# pincount number of pins of connector
|
||||
# populated number of populated positions in a connector
|
||||
# unpopulated number of unpopulated positions
|
||||
# when used in a cable:
|
||||
# wirecount number of wires of cable/bundle
|
||||
# terminations number of terminations on a cable/bundle
|
||||
|
||||
@ -18,7 +18,7 @@ MultilineHypertext = (
|
||||
Designator = PlainText # Case insensitive unique name of connector or cable
|
||||
|
||||
# Literal type aliases below are commented to avoid requiring python 3.8
|
||||
ConnectorMultiplier = PlainText # = Literal['pincount', 'populated']
|
||||
ConnectorMultiplier = PlainText # = Literal['pincount', 'populated', 'unpopulated']
|
||||
CableMultiplier = (
|
||||
PlainText # = Literal['wirecount', 'terminations', 'length', 'total_length']
|
||||
)
|
||||
@ -232,6 +232,8 @@ class Connector:
|
||||
return self.pincount
|
||||
elif qty_multiplier == "populated":
|
||||
return sum(self.visible_pins.values())
|
||||
elif qty_multiplier == 'unpopulated':
|
||||
return (self.pincount - sum(self.visible_pins.values()))
|
||||
else:
|
||||
raise ValueError(
|
||||
f"invalid qty multiplier parameter for connector {qty_multiplier}"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user