PrintTolTest 0.2.1__py3-none-any.whl → 0.2.2.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
PrintTolTest/cli.py CHANGED
@@ -1,6 +1,7 @@
1
1
  import argparse
2
2
  from .tolerance import calculate_tolerance
3
3
 
4
+
4
5
  def prompt_for_dimensions(label):
5
6
  print(f"\nEnter {label} dimensions (in mm):")
6
7
  x = float(input(" X: "))
@@ -8,6 +9,7 @@ def prompt_for_dimensions(label):
8
9
  z = float(input(" Z: "))
9
10
  return (x, y, z)
10
11
 
12
+
11
13
  def main():
12
14
  parser = argparse.ArgumentParser(
13
15
  description="PrintTolTest - Calculate 3D print dimensional tolerance.",
@@ -21,18 +23,32 @@ Examples:
21
23
 
22
24
  All dimensions must be in millimeters (mm).
23
25
  """,
24
- formatter_class=argparse.RawDescriptionHelpFormatter
26
+ formatter_class=argparse.RawDescriptionHelpFormatter,
25
27
  )
26
28
 
27
- parser.add_argument('--expected', type=float, nargs=3, metavar=('X', 'Y', 'Z'),
28
- help='Expected dimensions in mm (e.g. --expected 20 20 20)')
29
- parser.add_argument('--measured', type=float, nargs=3, metavar=('X', 'Y', 'Z'),
30
- help='Measured dimensions in mm (e.g. --measured 19.99 19.95 20.10)')
29
+ parser.add_argument(
30
+ "--expected",
31
+ type=float,
32
+ nargs=3,
33
+ metavar=("X", "Y", "Z"),
34
+ help="Expected dimensions in mm (e.g. --expected 20 20 20)",
35
+ )
36
+ parser.add_argument(
37
+ "--measured",
38
+ type=float,
39
+ nargs=3,
40
+ metavar=("X", "Y", "Z"),
41
+ help="Measured dimensions in mm (e.g. --measured 19.99 19.95 20.10)",
42
+ )
31
43
 
32
44
  args = parser.parse_args()
33
45
 
34
- expected = args.expected if args.expected else prompt_for_dimensions("expected")
35
- measured = args.measured if args.measured else prompt_for_dimensions("measured")
46
+ expected = (
47
+ args.expected if args.expected else prompt_for_dimensions("expected")
48
+ )
49
+ measured = (
50
+ args.measured if args.measured else prompt_for_dimensions("measured")
51
+ )
36
52
 
37
53
  tolerances = calculate_tolerance(expected, measured)
38
54
 
@@ -44,11 +60,14 @@ All dimensions must be in millimeters (mm).
44
60
  print(f"Measured Y dimension (mm): {measured[1]:.2f}")
45
61
  print(f"Measured Z dimension (mm): {measured[2]:.2f}")
46
62
  print("\nTolerance Results:")
47
- for axis in ['X', 'Y', 'Z']:
48
- signed = tolerances[axis]['signed']
49
- absolute = tolerances[axis]['absolute']
50
- sign_prefix = '+' if signed > 0 else ''
51
- print(f"{axis}-axis: Signed = {sign_prefix}{signed:.3f}%, Absolute = {absolute:.3f}%")
63
+ for axis in ["X", "Y", "Z"]:
64
+ signed = tolerances[axis]["signed"]
65
+ absolute = tolerances[axis]["absolute"]
66
+ sign_prefix = "+" if signed > 0 else ""
67
+ print(
68
+ f"{axis}-axis: Signed = {sign_prefix}{signed:.3f}%, Absolute = {absolute:.3f}%"
69
+ )
70
+
52
71
 
53
72
  if __name__ == "__main__":
54
73
  main()
PrintTolTest/tolerance.py CHANGED
@@ -1,7 +1,7 @@
1
1
  def calculate_tolerance(expected, measured):
2
2
  tolerances = {}
3
- for axis, e, m in zip(['X', 'Y', 'Z'], expected, measured):
3
+ for axis, e, m in zip(["X", "Y", "Z"], expected, measured):
4
4
  signed = ((m - e) / e) * 100
5
5
  absolute = abs(signed)
6
- tolerances[axis] = {'signed': signed, 'absolute': absolute}
6
+ tolerances[axis] = {"signed": signed, "absolute": absolute}
7
7
  return tolerances
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: PrintTolTest
3
- Version: 0.2.1
3
+ Version: 0.2.2.1
4
4
  Summary: A simple CLI tool to calculate 3D print dimensional tolerance.
5
5
  Author: NanashiTheNameless
6
6
  Author-email: NanashiTheNameless <NanashiTheNameless@NamelessNanashi.dev>
@@ -40,15 +40,11 @@ It does have issues and is not a perfect representation of printer performance.
40
40
  Get the Latest
41
41
 
42
42
  ```sh
43
- python3 -m pip install --upgrade 'PrintTolTest @ git+https://github.com/NanashiTheNameless/PrintTolTest@main'
43
+ pipx install --force 'PrintTolTest @ git+https://github.com/NanashiTheNameless/PrintTolTest@main'
44
44
  ```
45
45
 
46
46
  Or get from [PyPi](<https://pypi.org/project/PrintTolTest/>) (not recommended, may be out of date)
47
47
 
48
- ```sh
49
- python3 -m pip install --upgrade PrintTolTest
50
- ```
51
-
52
48
  ## Get started
53
49
 
54
50
  ### Interactively
@@ -0,0 +1,9 @@
1
+ PrintTolTest/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
+ PrintTolTest/cli.py,sha256=aFYh8RZ9UN2iIHmoUkg6EaWM_BlQhh93eMjnfTxXoIU,2179
3
+ PrintTolTest/tolerance.py,sha256=Hw4wOVQFi-SET440f5Z2teCtirnGpYg0rWk4IuhvaBo,287
4
+ printtoltest-0.2.2.1.dist-info/licenses/LICENSE.md,sha256=q0l2oX2406iNTmytch1XT4lDnxztbjgyja6zvp8wBA0,2773
5
+ printtoltest-0.2.2.1.dist-info/METADATA,sha256=DhmsRVGO7LlJLJVVv8BKlX6bWhmRtBnUhCCO1y1notc,2201
6
+ printtoltest-0.2.2.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
7
+ printtoltest-0.2.2.1.dist-info/entry_points.txt,sha256=_w7s7qEvPZvII0_utuplEVnUzskCu9NJlJqLH6PHzwo,55
8
+ printtoltest-0.2.2.1.dist-info/top_level.txt,sha256=Hy6xq9GW_e6XfU8p2bI4KdcVJUnVUp-IHatcm53ZZ-U,13
9
+ printtoltest-0.2.2.1.dist-info/RECORD,,
@@ -1,9 +0,0 @@
1
- PrintTolTest/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
- PrintTolTest/cli.py,sha256=SAkXdQZmTWAH6dHMAOVtvQDs-8er_IIchESHZknt78Y,2075
3
- PrintTolTest/tolerance.py,sha256=wN8eGgAUeaArwpPGZofWs203SpdKXk15RnvaQ7EJGgo,287
4
- printtoltest-0.2.1.dist-info/licenses/LICENSE.md,sha256=q0l2oX2406iNTmytch1XT4lDnxztbjgyja6zvp8wBA0,2773
5
- printtoltest-0.2.1.dist-info/METADATA,sha256=TpdwGtIkasaiWgYCddqP3FSQYwP2AS7XJBY_ptfS-DM,2268
6
- printtoltest-0.2.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
7
- printtoltest-0.2.1.dist-info/entry_points.txt,sha256=_w7s7qEvPZvII0_utuplEVnUzskCu9NJlJqLH6PHzwo,55
8
- printtoltest-0.2.1.dist-info/top_level.txt,sha256=Hy6xq9GW_e6XfU8p2bI4KdcVJUnVUp-IHatcm53ZZ-U,13
9
- printtoltest-0.2.1.dist-info/RECORD,,