Change 'gender' to 'subtype' for more flexibility

This commit is contained in:
Daniel Rojas 2020-06-13 20:15:35 +02:00
parent 567e65f062
commit a43d7701f4
10 changed files with 24 additions and 24 deletions

View File

@ -1,11 +1,11 @@
connectors: connectors:
X1: X1:
type: D-Sub type: D-Sub
gender: female subtype: female
pinout: [DCD, RX, TX, DTR, GND, DSR, RTS, CTS, RI] pinout: [DCD, RX, TX, DTR, GND, DSR, RTS, CTS, RI]
X2: X2:
type: Molex KK 254 type: Molex KK 254
gender: female subtype: female
pinout: [GND, RX, TX] pinout: [GND, RX, TX]
cables: cables:

View File

@ -1,7 +1,7 @@
templates: # defining templates to be used later on templates: # defining templates to be used later on
- &molex_f - &molex_f
type: Molex KK 254 type: Molex KK 254
gender: female subtype: female
- &con_i2c - &con_i2c
pinout: [GND, +5V, SCL, SDA] pinout: [GND, +5V, SCL, SDA]
- &wire_i2c - &wire_i2c
@ -24,7 +24,7 @@ connectors:
pinout: [GND, +12V, MISO, MOSI, SCK] pinout: [GND, +12V, MISO, MOSI, SCK]
X5: X5:
type: Molex Micro-Fit type: Molex Micro-Fit
gender: male subtype: male
pinout: [GND, +12V] pinout: [GND, +12V]
cables: cables:

View File

@ -1,11 +1,11 @@
connectors: connectors:
X1: X1:
type: Molex KK 254 # more information type: Molex KK 254 # more information
gender: female subtype: female
pinout: [GND, VCC, RX, TX] # pincount is implicit in pinout pinout: [GND, VCC, RX, TX] # pincount is implicit in pinout
X2: X2:
type: Molex KK 254 type: Molex KK 254
gender: female subtype: female
pinout: [GND, VCC, RX, TX] pinout: [GND, VCC, RX, TX]
cables: cables:

View File

@ -1,11 +1,11 @@
connectors: connectors:
X1: &boo X1: &boo
type: Molex Micro-Fit type: Molex Micro-Fit
gender: male subtype: male
pinout: [GND, VCC] pinout: [GND, VCC]
X2: &con_power_f # define template X2: &con_power_f # define template
type: Molex Micro-Fit type: Molex Micro-Fit
gender: female subtype: female
pinout: [GND, VCC] pinout: [GND, VCC]
X3: X3:
<<: *con_power_f # create from template <<: *con_power_f # create from template

View File

@ -1,11 +1,11 @@
connectors: connectors:
X1: &boo X1: &boo
type: Molex Micro-Fit type: Molex Micro-Fit
gender: male subtype: male
pinout: [GND, VCC] pinout: [GND, VCC]
X2: &con_power_f X2: &con_power_f
type: Molex Micro-Fit type: Molex Micro-Fit
gender: female subtype: female
pinout: [GND, VCC] pinout: [GND, VCC]
X3: X3:
<<: *con_power_f <<: *con_power_f

View File

@ -1,11 +1,11 @@
# connectors: # connectors:
# X1: # X1:
# type: D-Sub # type: D-Sub
# gender: female # subtype: female
# pincount: 4 # pincount: 4
# X2: # X2:
# type: Molex KK 254 # type: Molex KK 254
# gender: female # subtype: female
# pincount: 3 # pincount: 3
cables: cables:

View File

@ -2,7 +2,7 @@
templates: templates:
- &template_con - &template_con
type: Molex KK 254 type: Molex KK 254
gender: female subtype: female
pinout: [GND, VCC, SCL, SDA] pinout: [GND, VCC, SCL, SDA]
- &template_wire - &template_wire
gauge: 0.25 mm2 gauge: 0.25 mm2

View File

@ -2,7 +2,7 @@
templates: templates:
- &template_con - &template_con
type: Molex KK 254 type: Molex KK 254
gender: female subtype: female
pinout: [GND, VCC, SCL, SDA] pinout: [GND, VCC, SCL, SDA]
- &template_wire - &template_wire
gauge: 0.25 mm2 gauge: 0.25 mm2

View File

@ -32,11 +32,11 @@ _Note_: WireViz is not designed to represent the complete wiring of a system. It
connectors: connectors:
X1: X1:
type: D-Sub type: D-Sub
gender: female subtype: female
pinout: [DCD, RX, TX, DTR, GND, DSR, RTS, CTS, RI] pinout: [DCD, RX, TX, DTR, GND, DSR, RTS, CTS, RI]
X2: X2:
type: Molex KK 254 type: Molex KK 254
gender: female subtype: female
pinout: [GND, RX, TX] pinout: [GND, RX, TX]
cables: cables:

View File

@ -128,7 +128,7 @@ class Harness:
else: else:
# a = attributes # a = attributes
a = [n.type, a = [n.type,
n.gender, n.subtype,
'{}-pin'.format(len(n.pinout)) if n.show_pincount else ''] '{}-pin'.format(len(n.pinout)) if n.show_pincount else '']
# p = pinout # p = pinout
p = [[],[],[]] p = [[],[],[]]
@ -256,7 +256,7 @@ class Harness:
if gen_bom: if gen_bom:
# connectors # connectors
_con = self.bom_connectors() _con = self.bom_connectors()
header_con = ['Type','Gender','Pin count','Qty','Designators'] header_con = ['Type','Subtype','Pin count','Qty','Designators']
bom_con = tuplelist2tsv(_con, header_con) bom_con = tuplelist2tsv(_con, header_con)
with open('{}.connectors.bom.tsv'.format(filename),'w') as file: with open('{}.connectors.bom.tsv'.format(filename),'w') as file:
file.write(bom_con) file.write(bom_con)
@ -276,16 +276,16 @@ class Harness:
bom = [] bom = []
types = Counter([v.type for v in self.connectors.values()]) types = Counter([v.type for v in self.connectors.values()])
for type in types.keys(): for type in types.keys():
genders = Counter([v.gender for v in self.connectors.values() if v.type == type]) subtypes = Counter([v.subtype for v in self.connectors.values() if v.type == type])
for gender in genders.keys(): for subtype in subtypes.keys():
pincounts = Counter([v.pincount for v in self.connectors.values() if v.type == type and pincounts = Counter([v.pincount for v in self.connectors.values() if v.type == type and
v.gender == gender]) v.subtype == subtype])
for pincount in pincounts.keys(): for pincount in pincounts.keys():
designators = [k for k,v in self.connectors.items() if v.type == type and designators = [k for k,v in self.connectors.items() if v.type == type and
v.gender == gender and v.subtype == subtype and
v.pincount == pincount] v.pincount == pincount]
qty = pincounts[pincount] qty = pincounts[pincount]
bom.append([type, gender, pincount, qty, designators]) bom.append([type, subtype, pincount, qty, designators])
return bom return bom
def bom_cables_and_cutlist(self): def bom_cables_and_cutlist(self):
@ -323,7 +323,7 @@ class Connector:
name: str name: str
category: str = None category: str = None
type: str = None type: str = None
gender: str = None subtype: str = None
pincount: int = None pincount: int = None
notes: str = None notes: str = None
pinout: List[Any] = field(default_factory=list) pinout: List[Any] = field(default_factory=list)