summaryrefslogtreecommitdiff
path: root/tableconversion.py
diff options
context:
space:
mode:
authorJoshua Drake <joshua.ellis.drake@okstate.edu>2024-11-06 17:21:47 -0600
committerJoshua Drake <joshua.ellis.drake@okstate.edu>2024-11-06 17:21:47 -0600
commit14b9d0eef7a43a31b822e9fa66edf63f152f2458 (patch)
treee70abf52cffafccc9682b7d8a185902ae91821a9 /tableconversion.py
parent246447d7155b7b04bb9d477ecccc860dd79bdd6a (diff)
Need to finish indexing pins using pinlables...HEADmaster
Diffstat (limited to 'tableconversion.py')
-rw-r--r--tableconversion.py42
1 files changed, 30 insertions, 12 deletions
diff --git a/tableconversion.py b/tableconversion.py
index c69ac71..1dedce1 100644
--- a/tableconversion.py
+++ b/tableconversion.py
@@ -13,11 +13,16 @@ def parse_wireviz_yml(file_path):
connectorlist = []
for connector in data['connectors']:
connectorlist.append(connector)
- print(connectorlist)
+ #print(connectors['ECU']['pins'])
wire_info = []
for connection in connections:
connectorwpin = str(connection[0])
connector = connectorwpin[2:connectorwpin.find("':")]
+ connectorwires = str(connection[1])
+ if (len(connection)==2)and(connectorlist.count(connector) < 1):
+ connectorwpin = str(connection[1])
+ connector = connectorwpin[2:connectorwpin.find("':")]
+ connectorwires = str(connection[0])
#currently skipping all abnormal conditions
if connectorlist.count(connector) < 1:
continue
@@ -26,41 +31,53 @@ def parse_wireviz_yml(file_path):
for pins in connectorpins:
if str(pins).count("-") > 0:
pinrange = pins.strip("' ").split("-")
- print(pinrange)
for x in range(int(pinrange[0]),int(pinrange[1])+1):
connectorpinsadjusted.append(x)
else:
connectorpinsadjusted.append(pins)
- print(connectorpinsadjusted)
-
- connectorwires = str(connection[1])
bundle = connectorwires[2:connectorwires.find("':")]
bundlewires = connectorwires[connectorwires.find(" [")+2:connectorwires.rfind("]}")].split(",")
connector2pinsadjusted = []
- idcount=idcount+1
+
if len(connection) > 2:
connector2wpin = str(connection[2])
connector2 = connector2wpin[2:connector2wpin.find("':")]
connector2pins = connector2wpin[connector2wpin.find(" [")+2:connector2wpin.rfind("]}")].split(",")
for pins in connector2pins:
+ idcount=idcount+1
if pins.count("-") > 0:
pinrange = pins.strip("' ").split("-")
- for x in range(int(pinrange[0]),int(pinrange[1])+1):
- connector2pinsadjusted.append(x)
+ negativesign=0
+ for pin in pinrange:
+ if str(connectors[connector]['pins']).count(pin) < 1:
+ print(pin)
+ negativesign=1
+ if not negativesign:
+ for x in range(int(pinrange[0]),int(pinrange[1])+1):
+ connector2pinsadjusted.append(x)
+ else:
+ connector2pinsadjusted = connector2pins
else:
connector2pinsadjusted = connector2pins
for x in range(0,len(connectorpinsadjusted)):
- ident = str(ord(connector[0]))+str(ord(str(connectorpinsadjusted[x])[0]))+str(ord(wires[bundle]['colors'][x][0]))+str(idcount)
+ ident = str(ord(connector[0]))[:1]+str(ord(str(connectorpinsadjusted[x])[-1]))[-1]+str(ord(str(connector2pinsadjusted[x])[-1]))[-1]+str(ord(wires[bundle]['colors'][x][0]))+str(idcount)[-1]
ident = ident.strip(" ")
+ pin1 = connectorpinsadjusted[x]
notes = "none"
+ if str(connectors[connector]).count("'pinlabels':"):
+ if str(connectors[connector]['pinlabels']).count(connectorpinsadjusted[x]):
+ stringarray= [str(x) for x in connectors[connector]['pinlabels']]
+ print(stringarray)
+ print(connectorpinsadjusted)
+ print(stringarray.index(connectorpinsadjusted[x].strip("\"")))
if str(wires[bundle]).find("'notes':") > 0:
notes = wires[bundle]['notes']
wire_info.append({
'Identifier': ident,
'End 1': connector,
- 'Pin 1': connectorpinsadjusted[x],
+ 'Pin 1': pin1,
'Length': wires[bundle]['length'],
'Color': wires[bundle]['colors'][x],
'Gauge': wires[bundle]['gauge'],
@@ -69,8 +86,9 @@ def parse_wireviz_yml(file_path):
'Notes': notes,
})
else:
+ idcount=idcount+1
for x in range(0,len(connectorpinsadjusted)):
- ident = str(ord(connector[0]))+str(ord(str(connectorpinsadjusted[x])[0]))+str(ord(wires[bundle]['colors'][x][0]))+str(idcount)
+ ident = str(ord(connector[0]))[:1]+str(ord(str(connectorpinsadjusted[x])[-1]))[-1]+"0"+str(ord(wires[bundle]['colors'][x][0]))+str(idcount)[-1]
ident = ident.strip(" ")
notes = "none"
if str(wires[bundle]).find("'notes':") > 0:
@@ -94,7 +112,7 @@ def parse_wireviz_yml(file_path):
return wire_df
# Path to your WireViz YML file
-file_path = 'wireviz/Choppy_IB_CEX.yml'
+file_path = 'wireviz/Choppy_ECU_12FB.yml'
wire_table = parse_wireviz_yml(file_path)
# Display the table