246 Commits

Author SHA1 Message Date
Daniel Rojas
9e11051cac Simplify connector loop code 2020-07-11 11:53:29 +02:00
Daniel Rojas
cf6d3676c4 Ensure items in a connection set alternate between connectors and cables 2020-07-11 11:31:02 +02:00
Daniel Rojas
b4791900f2 Make connecting components together easier and more flexible
Closes #67.

- Allow defining arbitrarily long lists of alternating connectors and cables in a connection set.
- Start work towards removing 'ferrules' as special case, merging them with normal connectors
- Stramline auto-generation of simple, one pin connectors (ferrules, wire splices, ...)
2020-07-10 18:53:32 +02:00
Daniel Rojas
8f5b1aaf16 Allow using connector pin names to define connections
Pin names from pinout list can now be used in addition to pin numbers when defining connections, provided the identifier is unambiguous.
Closes #71.
2020-07-09 19:21:53 +02:00
Daniel Rojas
6a2924fa12 Check for duplicate pin numbers and raise an exception
Closes #72.
2020-07-09 18:10:38 +02:00
Daniel Rojas
e1e665583f Outsource nested HTML table creation to helper function 2020-07-05 20:36:02 +02:00
Daniel Rojas
0252476248 Fix bug in bundle wire BOM generation 2020-07-05 20:10:38 +02:00
Daniel Rojas
501303cbee Implement line break parsing for ferrules 2020-07-05 19:54:14 +02:00
Daniel Rojas
c2fa1d09e7 Merge changes to ferrule code generation 2020-07-05 19:46:20 +02:00
Daniel Rojas
54f114e592 Refactor ferrule GraphViz code generation
Cleaner code, better graphical output, more flexible (splices look as good as ferrules)
2020-07-05 19:07:59 +02:00
Daniel Rojas
46ed2418b4 Remove any newlines in fields for BOM generation 2020-07-05 18:06:57 +02:00
Daniel Rojas
d4ac4da651 Implement line break parsing for some fields
Implemented in `type`, `subtype`, `notes` fields
2020-07-05 17:41:18 +02:00
kvid
4e9933f01d
Simplify BOM code (#62)
* Remove bundle grouping as it is not needed for the wire grouping

Grouping the bundles has no purpose, as the same
wires can be collected by just looping all bundles.

* Allow one common value or list of values for each wire

Allow one common value when they are equal for all wires,
or a list of values to allow each wire a different value.

* Fix the minor issues commented by the owner

The owner review comments can be seen here:
https://github.com/formatc1702/WireViz/pull/62

* Make grouping code more pythonic
2020-07-05 16:52:10 +02:00
Daniel Rojas
de1e45f72b Fix bug in refactoring of #55, add SVG output option 2020-07-05 12:24:51 +02:00
Daniel Rojas
144c99e021 Refactor #55 2020-07-04 17:16:00 +02:00
Jason
ebf1e5a6f2
Add ability to export PNG data directly to other programs. (#55) 2020-07-04 17:03:04 +02:00
Daniel Rojas
b2387378c3 Make parts of BOM code more pythonic 2020-07-04 13:55:37 +02:00
Daniel Rojas
84c10e2c1a Clean up code 2020-07-04 13:55:37 +02:00
Daniel Rojas
407a9235b7 Simplify and fix bug in BOM generation 2020-07-04 13:55:37 +02:00
Daniel Rojas
4796c7cc97 Fix bug of non-bundle wires appearing in BOM 2020-07-02 19:45:28 +02:00
Daniel Rojas
16929687d3 Fine-tune cable appearance
Add hack to make manufacturer / part number row have vertical separators, to be visually consistent with connectors.

In the future, connectors will have to be modified to be HTML tables instead of GraphViz record nodes, in order to support colored bands for the connector, or individual pins (#53). When this is implemented, a cleaner solution should be found for both connectors and cables.
2020-07-02 19:16:56 +02:00
Daniel Rojas
65a4d6bd07 Update example+tutorial input files
tut
2020-07-02 19:16:56 +02:00
Daniel Rojas
94731cdf81 Fix post-merge bugs 2020-07-02 18:56:17 +02:00
Daniel Rojas
5fbe3e6b7e Merge branch 'feature/part-number' into dev
# Conflicts:
#	src/wireviz/Harness.py
2020-07-02 08:26:58 +02:00
KV
6f91b65128 Support named type of cables (or wires in a bundle)
Add cable type to diagram and BOM entries.
2020-07-02 07:44:17 +02:00
KV
c9895bd282 Move the cable category filtering before BOM grouping
Simplify the grouping loop slightly, by moving the filtering out.

The category of bundle entries is allways the same and is therefore
not needed for grouping.

The BOM output is unchanged by this change. It is verified using:
      python build_examples.py
      git diff ../../{examples,tutorial}/*.tsv
2020-07-02 07:44:17 +02:00
KV
dd1372c31d Use lambdas for BOM grouping, and rename group variables
Avoid duplications of BOM entry grouping definitions by moving
each grouping into a single lambda function.

Use the 'group' term in the involved variable names for clarity.

The BOM output is unchanged by this change. It is verified using:
  python build_examples.py
  git diff ../../{examples,tutorial}/*.tsv
2020-07-02 07:44:17 +02:00
Tyler Ward
c200f66009 Merged in refactoring changes from upstream 2020-07-02 00:50:48 +01:00
Tyler Ward
9c5ea06ca2 Added spaces after MPN: and IPN: 2020-07-01 23:47:49 +01:00
Tyler Ward
f67235e326 Added diagram support for part numbers on ferrules 2020-07-01 23:45:35 +01:00
Tyler Ward
1ec9ca4f81 Improved part number support
Added internal part number and manufacturer fields
Added support for wire part numbers in a bundle
Moved part number information to seperate row in table
2020-07-01 23:17:20 +01:00
Andreas Nordin
08e53bcd48
Feature: bidirectional AWG/mm2 unit conversion (#41)
* Fix AWG<-> mm2 conversions

Add an inverted dictionary and a lookup function from awg -> mm2. Also
do some minor refactoring. Both sides of the conversion table were
converted to strings, since '0000' and '2/0' are perfectly valid AWG
values.

* Update example ex02 with awg -> mm2 conversion

Show conversions for ex02, and make sure it displays conversions in both
directions. Rebuild the example files.

* Fix faulty conversion of non-(mm2,AWG) units

The parsing allows arbitrary units to be used for cable dimensions --
this might be valid units, e.g. square inches, or invalid, e.g. bananas.
We only allow conversion between mm2 and AWG, so check that the
gauge_unit is either of those before conversion. If not, pass through as
is.

* Fix AWG string casing in output

Convert e.g. 'awg, 'AwG' to upper case for consistent rendering. Leave
any other input gauge units as they were.

Co-authored-by: Daniel Rojas <github@danielrojas.net>
2020-06-29 14:41:45 +02:00
Daniel Rojas
c42b33b38d Address FIXMEs and fine-tune merge of #39 2020-06-29 12:35:40 +02:00
Gabe R
82b173f2ce Refactor and clean up code (#39)
* Format all files using autopep8 to add basic PEP8 conformity.
* Add Exception types to bare excepts to prevent catching `ctrl+c`
* Remove some unnecessary assignment to dummy variables before returning
* Add `Optional` to type hints that can be `NoneType`
* Change a number of single-letter variables to more descriptive names
* Replace string.format() use with Python's f-strings, as they tends to be cleaner, and provide a performance boost.
  * One multiline string was left as string.format() as I do not believe f-strings support multiline
  * Some of the string.format() instances had unused/ignored arguments. I left them out of the f-strings, but I marked those cases with a comments that begins `# FIXME:`
* Rename variables that were shadowding python standard functions (specifically `format->fmt`, `input->inp`, `type->maintype`)
  * Some instances of `type` were not changed, as it breaks the yaml parsing. Needs to be looked into.
* Move classes in `wireviz.py` to two new files `DataClasses.py` and `Harness.py`.

Co-authored-by: Daniel Rojas <github@danielrojas.net>
2020-06-29 11:57:03 +02:00
Tyler Ward
92b6b21895 Added ability to set part numbers 2020-06-28 22:11:05 +01:00
Tyler Ward
a3728f52ce
Fix for Designators apearing across all colours of wires of a guage. (#37)
The wirelist for the bom now has individual designators added. this also 
alows for the removal of designator list merging later.
2020-06-28 22:58:24 +02:00
Florian Pigorsch
eb65be39dc Fix some typos: budnle, conector, separetely 2020-06-28 14:55:09 +02:00
Daniel Rojas
7060c38f07 Add parse_file() function and use it in build_examples.py 2020-06-28 12:28:13 +02:00
Daniel Rojas
5d84bb86eb Update gitignore 2020-06-28 11:43:31 +02:00
Daniel Rojas
154e28f257 Change gen_bom to generate_bom 2020-06-28 11:43:22 +02:00
Andreas Nordin
1f06c6017c refactor: rename 'input' -> 'yaml_data'
'input' overloads a python built-in name. Refactor to avoid this.
2020-06-28 10:52:08 +02:00
Andreas Nordin
f14a07fe95 feature: add --prepend-file option
- Allow prepending a separate YAML file for e.g. including common
  template definitions. This is accomodated by a new commandline option,
  --prepend-file, which takes a path to a YAML file. This is prepended
  to the regular input as-is.

- Refactor file loading to accomodate the above. This includes moving
  relevant parts to main() and instead supplying parse () with a string
  representation of the YAML data. Also add early file existance checks
  and bail out if any of the inputs are inaccessible or nonexistant.
2020-06-28 10:51:49 +02:00
Andreas Nordin
cdb2cf2b91 update build_examples script 2020-06-28 10:49:47 +02:00
Andreas Nordin
9af391ff9d clean up imports, cmdline handling
Order imports properly. Fix path when running script directly from repo
rather than as an installed package. Refactor command line handling.
2020-06-28 10:47:15 +02:00
Andreas Nordin
5514fd4244 refactor dependencies and installation
There are hard copies of the graphviz and pyyaml dependencies included
in the repo. Remove these.

Sort out installation and dependency handling by writing a functional
setup.py script. Rename top level documentation. Refactor wireviz.py
slightly to allow it to run as an installed script.

# Conflicts:
#	src/batch.py
#	src/wireviz/batch.py
#	src/wireviz/build_examples.py
2020-06-28 10:46:24 +02:00
Daniel Rojas
dfb184c1a4 Move source from src/ to src/wireviz/
in preparation for merge of refactor brancb
2020-06-28 10:39:11 +02:00