diff --git a/readme.md b/readme.md index 7cc8375..45f2743 100644 --- a/readme.md +++ b/readme.md @@ -2,7 +2,7 @@ ## 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. @@ -93,11 +93,11 @@ GraphViz code generated by parser: ## Status -This is very much a work in progress, and mainly an idea in my head. -A Python module and test scripts is available. Running the test script will generate GraphViz output. +This is very much a work in progress. +A Python module and test scripts are available. Running the test script will generate GraphViz output. The parser will follow later; contributions are welcome! -# To do +## To do * Automate creation of left/right side ports for connectors * Add simple connectors (ferrules, cable lugs) diff --git a/src/example3.py b/src/example3.py index b0f75d0..25af45e 100644 --- a/src/example3.py +++ b/src/example3.py @@ -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.objects['W1'].connect_all_straight('X1','X2') -Harness.add(Node('X3', num_pins=12, ports_right=True)) -Harness.add(Node('X4', num_pins=12, ports_left=True)) -Harness.add(Cable('W2', num_wires=12, color_code='DIN')) +Harness.add(Node('X3', num_pins=20, ports_right=True)) +Harness.add(Node('X4', num_pins=20, ports_left=True)) +Harness.add(Cable('W2', num_wires=20, color_code='DIN')) Harness.objects['W2'].connect_all_straight('X3','X4') Harness.add(Node('X5', num_pins=20, ports_right=True)) diff --git a/src/input/header.dot b/src/input/header.dot index e8b319b..86c0d19 100644 --- a/src/input/header.dot +++ b/src/input/header.dot @@ -3,6 +3,6 @@ // Daniel Rojas - 2020 graph G { - graph [rankdir = LR, ranksep=2, fontname = "arial"]; - edge [fontname = "arial"]; - node [shape=record, style=rounded, fontname = "arial"]; + graph [rankdir = "LR", ranksep=2, fontname = "arial", bgcolor="transparent"] + edge [fontname = "arial"] + node [shape="record", style="rounded,filled", fontname = "arial", fillcolor="white"] diff --git a/src/wireviz.py b/src/wireviz.py index 511bfa6..636ab93 100644 --- a/src/wireviz.py +++ b/src/wireviz.py @@ -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'], 'BW': ['BK','WH']} +# TODO: parse and render double-colored cables ('RDBU' etc) color_hex = { 'BK': '#000000', 'WH': '#ffffff', @@ -223,7 +224,7 @@ class Cable: if self.mm2 is not None: e = awg_equiv(self.mm2) 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) if self.awg is not None: l.append('{} AWG'.format(self.awg))