Merge branch 'dev'

This commit is contained in:
Daniel Rojas 2020-05-23 20:15:43 +02:00
commit 7fbaad68dc
4 changed files with 13 additions and 12 deletions

View File

@ -2,7 +2,7 @@
## Summary ## Summary
WireViz is a simple yet flexible markup language for documenting wires and connector pinouts with beautiful graphical output. WireViz is a simple yet flexible markup language for documenting cables, wiring harnesses and connector pinouts with beautiful graphical output.
It is based on [GraphViz](https://www.graphviz.org/) and designed as an "extension" of it. A parser reads a WireViz file and generates valid GraphViz output, which can instantly be rendered to SVG/PNG. It is based on [GraphViz](https://www.graphviz.org/) and designed as an "extension" of it. A parser reads a WireViz file and generates valid GraphViz output, which can instantly be rendered to SVG/PNG.
@ -93,11 +93,11 @@ GraphViz code generated by parser:
## Status ## Status
This is very much a work in progress, and mainly an idea in my head. This is very much a work in progress.
A Python module and test scripts is available. Running the test script will generate GraphViz output. A Python module and test scripts are available. Running the test script will generate GraphViz output.
The parser will follow later; contributions are welcome! The parser will follow later; contributions are welcome!
# To do ## To do
* Automate creation of left/right side ports for connectors * Automate creation of left/right side ports for connectors
* Add simple connectors (ferrules, cable lugs) * Add simple connectors (ferrules, cable lugs)

View File

@ -8,9 +8,9 @@ Harness.add(Node('X2', num_pins=10, ports_left=True))
Harness.add(Cable('W1', num_wires=10, color_code='IEC')) Harness.add(Cable('W1', num_wires=10, color_code='IEC'))
Harness.objects['W1'].connect_all_straight('X1','X2') Harness.objects['W1'].connect_all_straight('X1','X2')
Harness.add(Node('X3', num_pins=12, ports_right=True)) Harness.add(Node('X3', num_pins=20, ports_right=True))
Harness.add(Node('X4', num_pins=12, ports_left=True)) Harness.add(Node('X4', num_pins=20, ports_left=True))
Harness.add(Cable('W2', num_wires=12, color_code='DIN')) Harness.add(Cable('W2', num_wires=20, color_code='DIN'))
Harness.objects['W2'].connect_all_straight('X3','X4') Harness.objects['W2'].connect_all_straight('X3','X4')
Harness.add(Node('X5', num_pins=20, ports_right=True)) Harness.add(Node('X5', num_pins=20, ports_right=True))

View File

@ -3,6 +3,6 @@
// Daniel Rojas - 2020 // Daniel Rojas - 2020
graph G { graph G {
graph [rankdir = LR, ranksep=2, fontname = "arial"]; graph [rankdir = "LR", ranksep=2, fontname = "arial", bgcolor="transparent"]
edge [fontname = "arial"]; edge [fontname = "arial"]
node [shape=record, style=rounded, fontname = "arial"]; node [shape="record", style="rounded,filled", fontname = "arial", fillcolor="white"]

View File

@ -1,8 +1,9 @@
COLOR_CODES = {'DIN': ['WH','BN','GN','YE','GY','PK','BU','RD','BK','VT'], COLOR_CODES = {'DIN': ['WH','BN','GN','YE','GY','PK','BU','RD','BK','VT','GYPK','RDBU','WHGN','BNGN','WHYE','YEBN','WHGY','GYBN','WHPK','PKBN'],
'IEC': ['BN','RD','OG','YE','GN','BU','VT','GY','WH','BK'], 'IEC': ['BN','RD','OG','YE','GN','BU','VT','GY','WH','BK'],
'BW': ['BK','WH']} 'BW': ['BK','WH']}
# TODO: parse and render double-colored cables ('RDBU' etc)
color_hex = { color_hex = {
'BK': '#000000', 'BK': '#000000',
'WH': '#ffffff', 'WH': '#ffffff',
@ -223,7 +224,7 @@ class Cable:
if self.mm2 is not None: if self.mm2 is not None:
e = awg_equiv(self.mm2) e = awg_equiv(self.mm2)
es = ' ({} AWG)'.format(e) if e is not None else '' es = ' ({} AWG)'.format(e) if e is not None else ''
mm ='{} mm²{}'.format(self.mm2, es) mm ='{} mm\u00B2{}'.format(self.mm2, es)
l.append(mm) l.append(mm)
if self.awg is not None: if self.awg is not None:
l.append('{} AWG'.format(self.awg)) l.append('{} AWG'.format(self.awg))