Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor depency handling, installation, and add a few features #9

Merged
merged 12 commits into from
Jun 28, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,9 @@
.DS_Store
temp/
.eggs
__pycache__
.*.swp
*.egg-info
*.pyc
build
data
dist
File renamed without changes.
26 changes: 23 additions & 3 deletions readme.md → README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,28 @@ WireViz is a tool for easily documenting cables, wiring harnesses and connector

_Note_: WireViz is not designed to represent the complete wiring of a system. Its main aim is to document the construction of individual wires and harnesses.

## Installation

WireWiz requires the ```graphviz``` package as well as it's python bindings. Graphviz itself is installed using your regular package manager, e.g. ```apt-get install graphviz```. The Graphviz python bindings are automatically installed as dependencies by the install script.

Installation of the WireWiz package and its python dependencies can be done using pip after cloning the repository:

```
git clone <repo url>
cd <working copy>
pip3 install -e .
```

## Examples

### (re)building the example projects

If you would like to rebuild all of the included demos, examples and tutorials, use the ```build_examples.py``` script:

```cd src/wireviz
./build_examples.py
```

### Demo 01

[WireViz input file](examples/demo01.yml):
Expand Down Expand Up @@ -79,7 +99,7 @@ as well as the [example gallery](examples/readme.md) to see more of what WireViz
## Usage

```
$ python3 wireviz.py ~/path/to/file/mywire.yml
$ wireviz ~/path/to/file/mywire.yml
```

This will output the following files
Expand All @@ -94,11 +114,11 @@ mywire.html HTML page with wiring diagram and BOM embedded

## Status

This is very much a [work in progress](todo.md). Source code, API, syntax and functionality may change wildly at any time.
This is very much a [work in progress](TODO). Source code, API, syntax and functionality may change wildly at any time.

## Requirements

Developed and tested using Python 3.7; might not work with older Python versions.
Developed and tested using Python 3.7; might not work with older Python versions. Ubuntu 18.04 LTS users in particular may need to separately install Python 3.7 or above, as that comes with Python 3.6 as the included system Python install.

## License

Expand Down
2 changes: 1 addition & 1 deletion todo.md → TODO
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@

## Other

* Imrpove tutorial texts
* Improve tutorial texts
* Create syntax reference / cheat sheet
* Set global parameters (show_pins, ...) and allow override on per-item basis
* Allow custom GraphViz code before/after WireViz-generated code
Expand Down
6 changes: 3 additions & 3 deletions examples/demo01.bom.tsv
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Item Qty Unit Designators
D-Sub, female, 9 pins 1 X1
Molex KK 254, female, 3 pins 1 X2
Cable 3 x 0.25 mm² shielded 0.2 m W1
Connector, D-Sub, female, 9 pins 1 X1
Connector, Molex KK 254, female, 3 pins 1 X2
Cable, 3 x 0.25 mm² shielded 0.2 m W1
4 changes: 2 additions & 2 deletions examples/demo01.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<html><body style="font-family:Arial"><h1>Diagram</h1><?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<!-- Generated by graphviz version 2.44.0 (20200408.0750)
<!-- Generated by graphviz version 2.44.0 (0)
-->
<!-- Pages: 1 -->
<svg width="825pt" height="290pt"
Expand Down Expand Up @@ -168,4 +168,4 @@
</g>
</g>
</svg>
<h1>Bill of Materials</h1><table style="border:1px solid #000000; font-size: 14pt; border-spacing: 0px"><tr><th align="left" style="border:1px solid #000000; padding: 8px">Item</th><th align="left" style="border:1px solid #000000; padding: 8px">Qty</th><th align="left" style="border:1px solid #000000; padding: 8px">Unit</th><th align="left" style="border:1px solid #000000; padding: 8px">Designators</th></tr><tr><td style="border:1px solid #000000; padding: 4px">D-Sub, female, 9 pins</td><td align="right" style="border:1px solid #000000; padding: 4px">1</td><td style="border:1px solid #000000; padding: 4px"></td><td style="border:1px solid #000000; padding: 4px">X1</td></tr><tr><td style="border:1px solid #000000; padding: 4px">Molex KK 254, female, 3 pins</td><td align="right" style="border:1px solid #000000; padding: 4px">1</td><td style="border:1px solid #000000; padding: 4px"></td><td style="border:1px solid #000000; padding: 4px">X2</td></tr><tr><td style="border:1px solid #000000; padding: 4px">Cable 3 x 0.25 mm² shielded</td><td align="right" style="border:1px solid #000000; padding: 4px">0.2</td><td style="border:1px solid #000000; padding: 4px">m</td><td style="border:1px solid #000000; padding: 4px">W1</td></tr></table></body></html>
<h1>Bill of Materials</h1><table style="border:1px solid #000000; font-size: 14pt; border-spacing: 0px"><tr><th align="left" style="border:1px solid #000000; padding: 8px">Item</th><th align="left" style="border:1px solid #000000; padding: 8px">Qty</th><th align="left" style="border:1px solid #000000; padding: 8px">Unit</th><th align="left" style="border:1px solid #000000; padding: 8px">Designators</th></tr><tr><td style="border:1px solid #000000; padding: 4px">Connector, D-Sub, female, 9 pins</td><td align="right" style="border:1px solid #000000; padding: 4px">1</td><td style="border:1px solid #000000; padding: 4px"></td><td style="border:1px solid #000000; padding: 4px">X1</td></tr><tr><td style="border:1px solid #000000; padding: 4px">Connector, Molex KK 254, female, 3 pins</td><td align="right" style="border:1px solid #000000; padding: 4px">1</td><td style="border:1px solid #000000; padding: 4px"></td><td style="border:1px solid #000000; padding: 4px">X2</td></tr><tr><td style="border:1px solid #000000; padding: 4px">Cable, 3 x 0.25 mm² shielded</td><td align="right" style="border:1px solid #000000; padding: 4px">0.2</td><td style="border:1px solid #000000; padding: 4px">m</td><td style="border:1px solid #000000; padding: 4px">W1</td></tr></table></body></html>
Binary file modified examples/demo01.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion examples/demo01.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 changes: 12 additions & 12 deletions examples/demo02.bom.tsv
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
Item Qty Unit Designators
Crimp ferrule, 0.25 mm² 2
Molex KK 254, female, 4 pins 2 X2, X3
Molex KK 254, female, 5 pins 1 X4
Molex KK 254, female, 8 pins 1 X1
Cable 2 x 0.25 mm² 0.3 m W4
Wire 0.14 mm² BK 0.9 m W1, W2, W3
Wire 0.14 mm² BU 0.3 m W3
Wire 0.14 mm² GN 0.6 m W1, W2
Wire 0.14 mm² OG 0.3 m W3
Wire 0.14 mm² RD 0.6 m W1, W2
Wire 0.14 mm² VT 0.3 m W3
Wire 0.14 mm² YE 0.6 m W1, W2
Connector, Crimp ferrule, 0.25 mm² 2
Connector, Molex KK 254, female, 4 pins 2 X2, X3
Connector, Molex KK 254, female, 5 pins 1 X4
Connector, Molex KK 254, female, 8 pins 1 X1
Cable, 2 x 0.25 mm² 0.3 m W4
Wire, 0.14 mm², BK 0.9 m W1, W2, W3
Wire, 0.14 mm², BU 0.3 m W3
Wire, 0.14 mm², GN 0.6 m W1, W2
Wire, 0.14 mm², OG 0.3 m W3
Wire, 0.14 mm², RD 0.6 m W1, W2
Wire, 0.14 mm², VT 0.3 m W3
Wire, 0.14 mm², YE 0.6 m W1, W2
8 changes: 4 additions & 4 deletions examples/demo02.gv
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ graph {
X2 [label="X2|{Molex KK 254|female|4-pin}|{{<p1l>1|<p2l>2|<p3l>3|<p4l>4}|{GND|+5V|SCL|SDA}}"]
X3 [label="X3|{Molex KK 254|female|4-pin}|{{<p1l>1|<p2l>2|<p3l>3|<p4l>4}|{GND|+5V|SCL|SDA}}"]
X4 [label="X4|{Molex KK 254|female|5-pin}|{{<p1l>1|<p2l>2|<p3l>3|<p4l>4|<p5l>5}|{GND|+12V|MISO|MOSI|SCK}}"]
F1 [label=<
_F1 [label=<

<TABLE BORDER="1" CELLBORDER="0" CELLSPACING="0" CELLPADDING="2"><TR>
<TD PORT="p1l"> Crimp ferrule, 0.25 mm² </TD>
Expand All @@ -18,7 +18,7 @@ graph {


> margin=0 orientation=180 shape=none style=filled]
F2 [label=<
_F2 [label=<

<TABLE BORDER="1" CELLBORDER="0" CELLSPACING="0" CELLPADDING="2"><TR>
<TD PORT="p1l"> Crimp ferrule, 0.25 mm² </TD>
Expand Down Expand Up @@ -68,9 +68,9 @@ graph {
W3:w4:e -- X4:p5l:w
W3 [label=<<table border="0" cellspacing="0" cellpadding="0"><tr><td><table border="0" cellspacing="0" cellpadding="3" cellborder="1"><tr><td colspan="3">W3</td></tr><tr><td>4x</td><td>0.14 mm² (26 AWG)</td><td>0.3 m</td></tr></table></td></tr><tr><td>&nbsp;</td></tr><tr><td><table border="0" cellspacing="0" cellborder="0"><tr><td>X1:1</td><td>BK</td><td>X4:1</td></tr><tr><td colspan="3" cellpadding="0" height="6" bgcolor="#000000" border="2" sides="tb" port="w1"></td></tr><tr><td>X1:5</td><td>BU</td><td>X4:3</td></tr><tr><td colspan="3" cellpadding="0" height="6" bgcolor="#0066ff" border="2" sides="tb" port="w2"></td></tr><tr><td>X1:6</td><td>OG</td><td>X4:4</td></tr><tr><td colspan="3" cellpadding="0" height="6" bgcolor="#ff8000" border="2" sides="tb" port="w3"></td></tr><tr><td>X1:7</td><td>VT</td><td>X4:5</td></tr><tr><td colspan="3" cellpadding="0" height="6" bgcolor="#8000ff" border="2" sides="tb" port="w4"></td></tr><tr><td>&nbsp;</td></tr></table></td></tr></table>> fillcolor=white margin=0 shape=box style="filled,dashed"]
edge [color="#000000:#000000:#000000"]
F1:e -- W4:w1:w
_F1:e -- W4:w1:w
edge [color="#000000:#ff0000:#000000"]
F2:e -- W4:w2:w
_F2:e -- W4:w2:w
edge [color="#000000:#000000:#000000"]
W4:w1:e -- X4:p1l:w
edge [color="#000000:#ff0000:#000000"]
Expand Down
20 changes: 10 additions & 10 deletions examples/demo02.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<html><body style="font-family:Arial"><h1>Diagram</h1><?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<!-- Generated by graphviz version 2.44.0 (20200408.0750)
<!-- Generated by graphviz version 2.44.0 (0)
-->
<!-- Pages: 1 -->
<svg width="906pt" height="763pt"
Expand Down Expand Up @@ -341,9 +341,9 @@
<polyline fill="none" stroke="black" points="780,-191.5 898,-191.5 "/>
<text text-anchor="middle" x="839" y="-176.3" font-family="arial" font-size="14.00">SCK</text>
</g>
<!-- F1 -->
<!-- _F1 -->
<g id="node5" class="node">
<title>F1</title>
<title>_F1</title>
<polygon fill="white" stroke="transparent" points="15.5,-60 190.5,-60 190.5,-96 15.5,-96 15.5,-60"/>
<text text-anchor="start" x="19" y="-73.8" font-family="arial" font-size="14.00"> Crimp ferrule, 0.25 mm² &#160;</text>
<text text-anchor="start" x="180" y="-73.8" font-family="arial" font-size="14.00"> &#160;</text>
Expand Down Expand Up @@ -374,24 +374,24 @@
<polyline fill="none" stroke="black" stroke-width="2" points="547,-37 351,-37 "/>
<text text-anchor="start" x="374.5" y="-18.8" font-family="arial" font-size="14.00"> </text>
</g>
<!-- F1&#45;&#45;W4 -->
<!-- _F1&#45;&#45;W4 -->
<g id="edge25" class="edge">
<title>F1:e&#45;&#45;W4:w</title>
<title>_F1:e&#45;&#45;W4:w</title>
<path fill="none" stroke="#000000" stroke-width="2" d="M192,-76C261.21,-76.64 277.86,-58.64 350,-58"/>
<path fill="none" stroke="#000000" stroke-width="2" d="M192,-78C262.68,-78 279.32,-60 350,-60"/>
<path fill="none" stroke="#000000" stroke-width="2" d="M192,-80C264.14,-79.36 280.79,-61.36 350,-62"/>
</g>
<!-- F2 -->
<!-- _F2 -->
<g id="node6" class="node">
<title>F2</title>
<title>_F2</title>
<polygon fill="white" stroke="transparent" points="15.5,0 190.5,0 190.5,-36 15.5,-36 15.5,0"/>
<text text-anchor="start" x="19" y="-13.8" font-family="arial" font-size="14.00"> Crimp ferrule, 0.25 mm² &#160;</text>
<text text-anchor="start" x="180" y="-13.8" font-family="arial" font-size="14.00"> &#160;</text>
<polygon fill="none" stroke="black" points="15.5,-7.5 15.5,-28.5 190.5,-28.5 190.5,-7.5 15.5,-7.5"/>
</g>
<!-- F2&#45;&#45;W4 -->
<!-- _F2&#45;&#45;W4 -->
<g id="edge26" class="edge">
<title>F2:e&#45;&#45;W4:w</title>
<title>_F2:e&#45;&#45;W4:w</title>
<path fill="none" stroke="#000000" stroke-width="2" d="M192,-16C264.05,-16.6 280.8,-33.6 350,-33"/>
<path fill="none" stroke="#ff0000" stroke-width="2" d="M192,-18C262.63,-18 279.37,-35 350,-35"/>
<path fill="none" stroke="#000000" stroke-width="2" d="M192,-20C261.2,-19.4 277.95,-36.4 350,-37"/>
Expand Down Expand Up @@ -496,4 +496,4 @@
</g>
</g>
</svg>
<h1>Bill of Materials</h1><table style="border:1px solid #000000; font-size: 14pt; border-spacing: 0px"><tr><th align="left" style="border:1px solid #000000; padding: 8px">Item</th><th align="left" style="border:1px solid #000000; padding: 8px">Qty</th><th align="left" style="border:1px solid #000000; padding: 8px">Unit</th><th align="left" style="border:1px solid #000000; padding: 8px">Designators</th></tr><tr><td style="border:1px solid #000000; padding: 4px">Crimp ferrule, 0.25 mm²</td><td align="right" style="border:1px solid #000000; padding: 4px">2</td><td style="border:1px solid #000000; padding: 4px"></td><td style="border:1px solid #000000; padding: 4px"></td></tr><tr><td style="border:1px solid #000000; padding: 4px">Molex KK 254, female, 4 pins</td><td align="right" style="border:1px solid #000000; padding: 4px">2</td><td style="border:1px solid #000000; padding: 4px"></td><td style="border:1px solid #000000; padding: 4px">X2, X3</td></tr><tr><td style="border:1px solid #000000; padding: 4px">Molex KK 254, female, 5 pins</td><td align="right" style="border:1px solid #000000; padding: 4px">1</td><td style="border:1px solid #000000; padding: 4px"></td><td style="border:1px solid #000000; padding: 4px">X4</td></tr><tr><td style="border:1px solid #000000; padding: 4px">Molex KK 254, female, 8 pins</td><td align="right" style="border:1px solid #000000; padding: 4px">1</td><td style="border:1px solid #000000; padding: 4px"></td><td style="border:1px solid #000000; padding: 4px">X1</td></tr><tr><td style="border:1px solid #000000; padding: 4px">Cable 2 x 0.25 mm²</td><td align="right" style="border:1px solid #000000; padding: 4px">0.3</td><td style="border:1px solid #000000; padding: 4px">m</td><td style="border:1px solid #000000; padding: 4px">W4</td></tr><tr><td style="border:1px solid #000000; padding: 4px">Wire 0.14 mm² BK</td><td align="right" style="border:1px solid #000000; padding: 4px">0.9</td><td style="border:1px solid #000000; padding: 4px">m</td><td style="border:1px solid #000000; padding: 4px">W1, W2, W3</td></tr><tr><td style="border:1px solid #000000; padding: 4px">Wire 0.14 mm² BU</td><td align="right" style="border:1px solid #000000; padding: 4px">0.3</td><td style="border:1px solid #000000; padding: 4px">m</td><td style="border:1px solid #000000; padding: 4px">W3</td></tr><tr><td style="border:1px solid #000000; padding: 4px">Wire 0.14 mm² GN</td><td align="right" style="border:1px solid #000000; padding: 4px">0.6</td><td style="border:1px solid #000000; padding: 4px">m</td><td style="border:1px solid #000000; padding: 4px">W1, W2</td></tr><tr><td style="border:1px solid #000000; padding: 4px">Wire 0.14 mm² OG</td><td align="right" style="border:1px solid #000000; padding: 4px">0.3</td><td style="border:1px solid #000000; padding: 4px">m</td><td style="border:1px solid #000000; padding: 4px">W3</td></tr><tr><td style="border:1px solid #000000; padding: 4px">Wire 0.14 mm² RD</td><td align="right" style="border:1px solid #000000; padding: 4px">0.6</td><td style="border:1px solid #000000; padding: 4px">m</td><td style="border:1px solid #000000; padding: 4px">W1, W2</td></tr><tr><td style="border:1px solid #000000; padding: 4px">Wire 0.14 mm² VT</td><td align="right" style="border:1px solid #000000; padding: 4px">0.3</td><td style="border:1px solid #000000; padding: 4px">m</td><td style="border:1px solid #000000; padding: 4px">W3</td></tr><tr><td style="border:1px solid #000000; padding: 4px">Wire 0.14 mm² YE</td><td align="right" style="border:1px solid #000000; padding: 4px">0.6</td><td style="border:1px solid #000000; padding: 4px">m</td><td style="border:1px solid #000000; padding: 4px">W1, W2</td></tr></table></body></html>
<h1>Bill of Materials</h1><table style="border:1px solid #000000; font-size: 14pt; border-spacing: 0px"><tr><th align="left" style="border:1px solid #000000; padding: 8px">Item</th><th align="left" style="border:1px solid #000000; padding: 8px">Qty</th><th align="left" style="border:1px solid #000000; padding: 8px">Unit</th><th align="left" style="border:1px solid #000000; padding: 8px">Designators</th></tr><tr><td style="border:1px solid #000000; padding: 4px">Connector, Crimp ferrule, 0.25 mm²</td><td align="right" style="border:1px solid #000000; padding: 4px">2</td><td style="border:1px solid #000000; padding: 4px"></td><td style="border:1px solid #000000; padding: 4px"></td></tr><tr><td style="border:1px solid #000000; padding: 4px">Connector, Molex KK 254, female, 4 pins</td><td align="right" style="border:1px solid #000000; padding: 4px">2</td><td style="border:1px solid #000000; padding: 4px"></td><td style="border:1px solid #000000; padding: 4px">X2, X3</td></tr><tr><td style="border:1px solid #000000; padding: 4px">Connector, Molex KK 254, female, 5 pins</td><td align="right" style="border:1px solid #000000; padding: 4px">1</td><td style="border:1px solid #000000; padding: 4px"></td><td style="border:1px solid #000000; padding: 4px">X4</td></tr><tr><td style="border:1px solid #000000; padding: 4px">Connector, Molex KK 254, female, 8 pins</td><td align="right" style="border:1px solid #000000; padding: 4px">1</td><td style="border:1px solid #000000; padding: 4px"></td><td style="border:1px solid #000000; padding: 4px">X1</td></tr><tr><td style="border:1px solid #000000; padding: 4px">Cable, 2 x 0.25 mm²</td><td align="right" style="border:1px solid #000000; padding: 4px">0.3</td><td style="border:1px solid #000000; padding: 4px">m</td><td style="border:1px solid #000000; padding: 4px">W4</td></tr><tr><td style="border:1px solid #000000; padding: 4px">Wire, 0.14 mm², BK</td><td align="right" style="border:1px solid #000000; padding: 4px">0.9</td><td style="border:1px solid #000000; padding: 4px">m</td><td style="border:1px solid #000000; padding: 4px">W1, W2, W3</td></tr><tr><td style="border:1px solid #000000; padding: 4px">Wire, 0.14 mm², BU</td><td align="right" style="border:1px solid #000000; padding: 4px">0.3</td><td style="border:1px solid #000000; padding: 4px">m</td><td style="border:1px solid #000000; padding: 4px">W3</td></tr><tr><td style="border:1px solid #000000; padding: 4px">Wire, 0.14 mm², GN</td><td align="right" style="border:1px solid #000000; padding: 4px">0.6</td><td style="border:1px solid #000000; padding: 4px">m</td><td style="border:1px solid #000000; padding: 4px">W1, W2</td></tr><tr><td style="border:1px solid #000000; padding: 4px">Wire, 0.14 mm², OG</td><td align="right" style="border:1px solid #000000; padding: 4px">0.3</td><td style="border:1px solid #000000; padding: 4px">m</td><td style="border:1px solid #000000; padding: 4px">W3</td></tr><tr><td style="border:1px solid #000000; padding: 4px">Wire, 0.14 mm², RD</td><td align="right" style="border:1px solid #000000; padding: 4px">0.6</td><td style="border:1px solid #000000; padding: 4px">m</td><td style="border:1px solid #000000; padding: 4px">W1, W2</td></tr><tr><td style="border:1px solid #000000; padding: 4px">Wire, 0.14 mm², VT</td><td align="right" style="border:1px solid #000000; padding: 4px">0.3</td><td style="border:1px solid #000000; padding: 4px">m</td><td style="border:1px solid #000000; padding: 4px">W3</td></tr><tr><td style="border:1px solid #000000; padding: 4px">Wire, 0.14 mm², YE</td><td align="right" style="border:1px solid #000000; padding: 4px">0.6</td><td style="border:1px solid #000000; padding: 4px">m</td><td style="border:1px solid #000000; padding: 4px">W1, W2</td></tr></table></body></html>
Binary file modified examples/demo02.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading