summaryrefslogtreecommitdiff
path: root/tableconversion.py
diff options
context:
space:
mode:
authorJoshua Drake <Joshua.Ellis.Drake@gmail.com>2024-10-31 21:51:59 -0500
committerJoshua Drake <Joshua.Ellis.Drake@gmail.com>2024-10-31 21:51:59 -0500
commit1f55b201683159c209a95e973a370ccb325d4dca (patch)
tree862f6cf50aa7b18b0a872f9609261c8ef1878014 /tableconversion.py
parent7c068fa8e7cdf6507566bb8f40c3d163a8822e39 (diff)
Finished the ability to take a range of pins into account. Almost done overall.
Diffstat (limited to 'tableconversion.py')
-rw-r--r--tableconversion.py32
1 files changed, 23 insertions, 9 deletions
diff --git a/tableconversion.py b/tableconversion.py
index 5fc74a6..ef81240 100644
--- a/tableconversion.py
+++ b/tableconversion.py
@@ -12,37 +12,51 @@ def parse_wireviz_yml(file_path):
connections = data['connections']
wire_info = []
for connection in connections:
- #print(connection[0])
connectorwpin = str(connection[0])
connector = connectorwpin[2:connectorwpin.find("':")]
connectorpins = connectorwpin[connectorwpin.find(" [")+2:connectorwpin.rfind("]}")].strip(" ").split(",")
+ connectorpinsadjusted = []
+ for pins in connectorpins:
+ if pins.count("-") > 0:
+ pinrange = pins.strip("' ").split("-")
+ for x in range(int(pinrange[0]),int(pinrange[1])+1):
+ connectorpinsadjusted.append(x)
+ else:
+ connectorpinsadjusted = connectorpins
connectorwires = str(connection[1])
bundle = connectorwires[2:connectorwires.find("':")]
bundlewires = connectorwires[connectorwires.find(" [")+2:connectorwires.rfind("]}")].split(",")
- print(connectorpins)
if len(connection) > 2:
connector2wpin = str(connection[2])
connector2 = connector2wpin[2:connector2wpin.find("':")]
connector2pins = connector2wpin[connector2wpin.find(" [")+2:connector2wpin.rfind("]}")].split(",")
-
- for x in range(0,len(connectorpins)):
- print(wires[bundle]['length'])
+ print(connector2pins)
+ connector2pinsadjusted = []
+ for pins in connector2pins:
+ if pins.count("-") > 0:
+ pinrange = pins.strip("' ").split("-")
+ for x in range(int(pinrange[0]),int(pinrange[1])+1):
+ connector2pinsadjusted.append(x)
+ else:
+ connector2pinsadjusted = connector2pins
+ print(connector2pinsadjusted)
+ for x in range(0,len(connectorpinsadjusted)):
wire_info.append({
'End 1': connector,
- 'Pin 1': connectorpins[x],
+ 'Pin 1': connectorpinsadjusted[x],
'Length': wires[bundle]['length'],
'Color': wires[bundle]['colors'][x],
'Gauge': wires[bundle]['gauge'],
'End 2': connector2,
- 'Pin 2': connector2pins[x],
+ 'Pin 2': connector2pinsadjusted[x],
})
#print(connection[1])
-
+
for wire in wires:
wire_name = wire
@@ -54,7 +68,7 @@ def parse_wireviz_yml(file_path):
return wire_df
# Path to your WireViz YML file
-file_path = 'wireviz\Choppy_IB_1X.yml'
+file_path = 'wireviz/Choppy_IB_PPS_main.yml'
wire_table = parse_wireviz_yml(file_path)
# Display the table