Skip to content

Comments

Adding support for wire length units#161

Closed
zombielinux wants to merge 1 commit intowireviz:devfrom
zombielinux:patch-1
Closed

Adding support for wire length units#161
zombielinux wants to merge 1 commit intowireviz:devfrom
zombielinux:patch-1

Conversation

@zombielinux
Copy link
Contributor

Will also be editing dataclasses.py to add the support as well as defaulting units to meters if unpopulated.

Will also be editing dataclasses.py to add the support as well as defaulting units to meters if unpopulated.
Copy link
Collaborator

@kvid kvid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@zombielinux Thank you for contributing. I'm just another contributor, like you. @formatc1702 is the owner that approves and merges PRs into dev when he thinks they are ready. He is currently on vacation, and I decided to give you a few advices that I believe will help you getting this PR accepted, but remember that @formatc1702 might not share all my opinions.

shield_name = ' shielded' if shared.shield else ''
name = f'Cable{cable_type}, {shared.wirecount}{gauge_name}{shield_name}'
item = {'item': name, 'qty': round(total_length, 3), 'unit': 'm', 'designators': designators,
item = {'item': name, 'qty': round(total_length, 3), 'unit': shared.lengthunit, 'designators': designators,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here you risk making a BOM entry where total_length is the sum of several numeric values with different units. I can see at least two strategies to avoid this:

  1. Convert the values to a common unit before adding them together.
  2. Include the length unit in the cable_group to avoid joining entries with different length units.

I recommend discussing this choice (and if choice 1, what common unit to choose) in #7.

Comment on lines 171 to +173
f'{cable.gauge} {cable.gauge_unit}{awg_fmt}' if cable.gauge else None,
'+ S' if cable.shield else None,
f'{cable.length} m' if cable.length > 0 else None,
f'{cable.length} {cable.lengthunit}' if cable.length > 0 else None,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can see an unfortunate difference in naming style between these two attribute pairs:

  • cable.gauge and cable.gauge_unit
  • cable.length and cable.lengthunit

Feel free to discuss naming conventions in a new issue, but I suggest we try to keep it consistent.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added the underbar to length_unit in #171

stevegt added a commit to stevegt/WireViz that referenced this pull request Oct 5, 2020
- partial fix for wireviz#7
- based on and closes wireviz#161 and wireviz#162
@stevegt
Copy link
Contributor

stevegt commented Oct 5, 2020

merged with #162 and submitted as #171

kvid pushed a commit to kvid/WireViz that referenced this pull request Oct 5, 2020
- partial fix for wireviz#7
- based on and closes wireviz#161 and wireviz#162
kvid pushed a commit to kvid/WireViz that referenced this pull request Oct 5, 2020
- partial fix for wireviz#7
- based on and closes wireviz#161 and wireviz#162
kvid pushed a commit to kvid/WireViz that referenced this pull request Nov 15, 2020
- partial fix for wireviz#7
- based on and closes wireviz#161 and wireviz#162
kvid pushed a commit to kvid/WireViz that referenced this pull request Nov 16, 2020
- partial fix for wireviz#7
- based on and closes wireviz#161 and wireviz#162
@kvid kvid mentioned this pull request Nov 16, 2020
17o2 pushed a commit that referenced this pull request Nov 16, 2020
Based on #161, #162, #171.

Co-authored-by: stevegt <stevegt@t7a.org>
Co-authored-by: kvid <kvid@users.noreply.github.com>
@17o2
Copy link
Collaborator

17o2 commented Nov 16, 2020

Closed as part of #196.

@17o2 17o2 closed this Nov 16, 2020
17o2 added a commit that referenced this pull request Nov 16, 2020
17o2 pushed a commit that referenced this pull request Nov 17, 2020
Based on #161, #162, #171.

Co-authored-by: stevegt <stevegt@t7a.org>
Co-authored-by: kvid <kvid@users.noreply.github.com>
lxander42 pushed a commit to lxander42/PipeViz that referenced this pull request Sep 20, 2025
Based on wireviz#161, wireviz#162, wireviz#171.

Co-authored-by: stevegt <stevegt@t7a.org>
Co-authored-by: kvid <kvid@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants