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

Adding support for wire length units #161

Closed
wants to merge 1 commit into from

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.

@@ -365,7 +365,7 @@ def bom(self):
gauge_name = f' x {shared.gauge} {shared.gauge_unit}' if shared.gauge else ' wires'
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
formatc1702 pushed a commit that referenced this pull request Nov 16, 2020
Based on #161, #162, #171.

Co-authored-by: stevegt <[email protected]>
Co-authored-by: kvid <[email protected]>
@formatc1702
Copy link
Collaborator

Closed as part of #196.

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

Co-authored-by: stevegt <[email protected]>
Co-authored-by: kvid <[email protected]>
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