diff --git a/examples/ex15.bom.tsv b/examples/ex15.bom.tsv new file mode 100644 index 0000000..dd1dfe8 --- /dev/null +++ b/examples/ex15.bom.tsv @@ -0,0 +1,3 @@ +Id Description Qty Unit Designators +1 Cable, Serial, 4 x 0.25 mm² shielded 0.2 m W1 +2 Connector, Molex KK 254, female, 7 pins 2 X1, X2 diff --git a/examples/ex15.gv b/examples/ex15.gv new file mode 100644 index 0000000..ed3a7b9 --- /dev/null +++ b/examples/ex15.gv @@ -0,0 +1,240 @@ +graph { +// Graph generated by WireViz 0.5-dev +// https://github.com/formatc1702/WireViz + graph [bgcolor="#FFFFFF" fontname=arial nodesep=0.33 rankdir=LR ranksep=2] + node [fillcolor="#FFFFFF" fontname=arial height=0 margin=0 shape=none style=filled width=0] + edge [fontname=arial style=bold] + X1 [label=< + + + + +
+ + +
X1
+
+ + + + +
Molex KK 254female7-pin
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
GND1
VCC2
RX3
TX4
GND5
VCC6
GND7
+
+> fillcolor="#FFFFFF" shape=box style=filled] + X2 [label=< + + + + +
+ + +
X2
+
+ + + + +
Molex KK 254female7-pin
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
1GND
2VCC
3RX
4TX
5GND
6VCC
7GND
+
+> fillcolor="#FFFFFF" shape=box style=filled] + edge [color="#000000:#895956:#000000"] + X1:p1r:e -- W1:w1:w + W1:w1:e -- X2:p1l:w + edge [color="#000000:#ff0000:#000000"] + X1:p2r:e -- W1:w2:w + W1:w2:e -- X2:p2l:w + edge [color="#000000:#ff8000:#000000"] + X1:p3r:e -- W1:w3:w + W1:w3:e -- X2:p4l:w + edge [color="#000000:#ffff00:#000000"] + X1:p4r:e -- W1:w4:w + W1:w4:e -- X2:p3l:w + edge [color="#000000"] + X1:p1r:e -- W1:ws:w + W1 [label=< + + + + +
+ + +
W1
+
+ + + + + + +
Serial4x0.25 mm² (24 AWG)+ S0.2 m
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
 
X1:1:GND + 1:BN + X2:1:GND
+ + + + +
+
X1:2:VCC + 2:RD + X2:2:VCC
+ + + + +
+
X1:3:RX + 3:OG + X2:4:TX
+ + + + +
+
X1:4:TX + 4:YE + X2:3:RX
+ + + + +
+
 
X1:1:GNDShield
 
+
+> fillcolor="#FFFFFF" shape=box style=filled] +} diff --git a/examples/ex15.html b/examples/ex15.html new file mode 100644 index 0000000..a9f7e2d --- /dev/null +++ b/examples/ex15.html @@ -0,0 +1,306 @@ + + + + + ex15 + + +

ex15

+

Diagram

+ +
+ +
+ +
+ + + + + + + + +X1 + + +X1 + +Molex KK 254 + +female + +7-pin + +GND + + + + +1 + +VCC + + + + +2 + +RX + + + +3 + +TX + + + +4 + +GND + + + + +5 + +VCC + + + + +6 + +GND + + + + +7 + + + +W1 + + +W1 + +Serial + +4x + +0.25 mm² (24 AWG) + ++ S + +0.2 m +  +X1:1:GND +     1:BN     +X2:1:GND + + + +X1:2:VCC +     2:RD     +X2:2:VCC + + + +X1:3:RX +     3:OG     +X2:4:TX + + + +X1:4:TX +     4:YE     +X2:3:RX + + + +  +X1:1:GND +Shield + +  + + + +X1:e--W1:w + + + + + + +X1:e--W1:w + + + + + + +X1:e--W1:w + + + + + + +X1:e--W1:w + + + + + + +X1:e--W1:w + + + + +X2 + + +X2 + +Molex KK 254 + +female + +7-pin + +1 + +GND + + + + +2 + +VCC + + + + +3 + +RX + + + +4 + +TX + + + +5 + +GND + + + + +6 + +VCC + + + + +7 + +GND + + + + + + +W1:e--X2:w + + + + + + +W1:e--X2:w + + + + + + +W1:e--X2:w + + + + + + +W1:e--X2:w + + + + + + + +
+ +
+ +
+ +

Bill of Materials

+ +
+ + + + + + + + + + + + + + + + + + + + + + +
IdDescriptionQtyUnitDesignators
1Cable, Serial, 4 x 0.25 mm² shielded0.2mW1
2Connector, Molex KK 254, female, 7 pins2X1, X2
+ +
+ + diff --git a/examples/ex15.png b/examples/ex15.png new file mode 100644 index 0000000..ab7aa04 Binary files /dev/null and b/examples/ex15.png differ diff --git a/examples/ex15.svg b/examples/ex15.svg new file mode 100644 index 0000000..a0c9370 --- /dev/null +++ b/examples/ex15.svg @@ -0,0 +1,240 @@ + + + + + + + + + +X1 + + +X1 + +Molex KK 254 + +female + +7-pin + +GND + + + + +1 + +VCC + + + + +2 + +RX + + + +3 + +TX + + + +4 + +GND + + + + +5 + +VCC + + + + +6 + +GND + + + + +7 + + + +W1 + + +W1 + +Serial + +4x + +0.25 mm² (24 AWG) + ++ S + +0.2 m +  +X1:1:GND +     1:BN     +X2:1:GND + + + +X1:2:VCC +     2:RD     +X2:2:VCC + + + +X1:3:RX +     3:OG     +X2:4:TX + + + +X1:4:TX +     4:YE     +X2:3:RX + + + +  +X1:1:GND +Shield + +  + + + +X1:e--W1:w + + + + + + +X1:e--W1:w + + + + + + +X1:e--W1:w + + + + + + +X1:e--W1:w + + + + + + +X1:e--W1:w + + + + +X2 + + +X2 + +Molex KK 254 + +female + +7-pin + +1 + +GND + + + + +2 + +VCC + + + + +3 + +RX + + + +4 + +TX + + + +5 + +GND + + + + +6 + +VCC + + + + +7 + +GND + + + + + + +W1:e--X2:w + + + + + + +W1:e--X2:w + + + + + + +W1:e--X2:w + + + + + + +W1:e--X2:w + + + + + + diff --git a/examples/ex15.yml b/examples/ex15.yml new file mode 100644 index 0000000..a5e346c --- /dev/null +++ b/examples/ex15.yml @@ -0,0 +1,31 @@ +connectors: + X1: + type: Molex KK 254 # more information + subtype: female + pinlabels: [GND, VCC, RX, TX, GND, VCC, GND] # pincount is implicit in pinout + internal_shorts: [[1, 5, 7], [2, 6]] + internal_shorts_color: [PK, RD] + X2: + type: Molex KK 254 + subtype: female + pinlabels: [GND, VCC, RX, TX, GND, VCC, GND] + internal_shorts: [[1, 5, 7], [2, 6]] + +cables: + W1: + color_code: IEC # auto-color wires based on a standard + wirecount: 4 # need to specify number of wires explicitly when using a color code + gauge: 0.25 mm2 # also accepts AWG as unit + show_equiv: true # auto-calculate AWG equivalent from metric gauge + length: 0.2 # length in m + shield: true + type: Serial + +connections: + - + - X1: [1-4] + - W1: [1-4] + - X2: [1,2,4,3] # crossover + - # connection from connector pin to wire shielding + - X1: 1 + - W1: s diff --git a/examples/readme.md b/examples/readme.md index 88a4389..e785dd3 100644 --- a/examples/readme.md +++ b/examples/readme.md @@ -84,3 +84,9 @@ [Source](ex14.yml) - [Bill of Materials](ex14.bom.tsv) +## Example 15 +![](ex15.png) + +[Source](ex15.yml) - [Bill of Materials](ex15.bom.tsv) + + diff --git a/src/wireviz/DataClasses.py b/src/wireviz/DataClasses.py index 5b4bb06..8a14445 100644 --- a/src/wireviz/DataClasses.py +++ b/src/wireviz/DataClasses.py @@ -164,6 +164,8 @@ class Connector: loops: List[List[Pin]] = field(default_factory=list) ignore_in_bom: bool = False additional_components: List[AdditionalComponent] = field(default_factory=list) + internal_shorts: Optional[List[List[Pin]]] = field(default_factory=list) + internal_shorts_color: Optional[List[Color]] = field(default_factory=list) def __post_init__(self) -> None: diff --git a/src/wireviz/Harness.py b/src/wireviz/Harness.py index 30468a6..4a76567 100644 --- a/src/wireviz/Harness.py +++ b/src/wireviz/Harness.py @@ -246,9 +246,19 @@ class Harness: # fmt: on else: pinhtml.append(' ') + + for short, short_color in zip_longest(connector.internal_shorts, connector.internal_shorts_color): + if short_color == None: + short_color = "BK" + + if pinindex+1 in short: + pinhtml.append(f' ') + else: + pinhtml.append(f' ') if connector.ports_right: pinhtml.append(f' {pinname}') + pinhtml.append(" ") pinhtml.append(" ") @@ -257,6 +267,13 @@ class Harness: row.replace("", "\n".join(pinhtml)) for row in html ] + + for short, short_color in zip_longest(connector.internal_shorts, connector.internal_shorts_color): + print("Short_connections: " + str(short) + str(short_color)) + if short_color == None: + short_color = "BK" + # TODO adding dashed Line for Jumpers + html = "\n".join(html) dot.node(