PrintTolTest 0.1.1__py3-none-any.whl → 0.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,28 +1,54 @@
1
- def calculate_tolerance(ideal, measured):
2
- signed = ((measured - ideal) / ideal) * 100
3
- absolute = abs(signed)
4
- return signed, absolute
1
+ import argparse
2
+ from .tolerance import calculate_tolerance
5
3
 
4
+ def prompt_for_dimensions(label):
5
+ print(f"\nEnter {label} dimensions (in mm):")
6
+ x = float(input(" X: "))
7
+ y = float(input(" Y: "))
8
+ z = float(input(" Z: "))
9
+ return (x, y, z)
6
10
 
7
11
  def main():
8
- print("3D Print Tolerance:")
9
- try:
10
- ideal_x = float(input("Ideal X dimension (mm): "))
11
- ideal_y = float(input("Ideal Y dimension (mm): "))
12
- ideal_z = float(input("Ideal Z dimension (mm): "))
13
- measured_x = float(input("Measured X dimension (mm): "))
14
- measured_y = float(input("Measured Y dimension (mm): "))
15
- measured_z = float(input("Measured Z dimension (mm): "))
16
- results = {
17
- "X": calculate_tolerance(ideal_x, measured_x),
18
- "Y": calculate_tolerance(ideal_y, measured_y),
19
- "Z": calculate_tolerance(ideal_z, measured_z),
20
- }
21
- print("\nTolerance Results:")
22
- for axis, (signed, absolute) in results.items():
23
- print(f"{axis}-axis: Signed = {signed:+.3f}%, Absolute = {absolute:.3f}%")
24
- except ValueError:
25
- print("Invalid input. Only numeric values are allowed.")
12
+ parser = argparse.ArgumentParser(
13
+ description="PrintTolTest - Calculate 3D print dimensional tolerance.",
14
+ epilog="""
15
+ Examples:
16
+ PrintTolTest
17
+ Interactive mode, will prompt for expected/measured dimensions.
18
+
19
+ PrintTolTest --expected 20 20 20 --measured 19.99 19.95 20.10
20
+ Command-line mode, pass dimensions directly.
21
+
22
+ All dimensions must be in millimeters (mm).
23
+ """,
24
+ formatter_class=argparse.RawDescriptionHelpFormatter
25
+ )
26
+
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)')
31
+
32
+ args = parser.parse_args()
33
+
34
+ expected = args.expected if args.expected else prompt_for_dimensions("expected")
35
+ measured = args.measured if args.measured else prompt_for_dimensions("measured")
36
+
37
+ tolerances = calculate_tolerance(expected, measured)
38
+
39
+ print("\n3D Print Tolerance Report:")
40
+ print(f"Ideal X dimension (mm): {expected[0]:.2f}")
41
+ print(f"Ideal Y dimension (mm): {expected[1]:.2f}")
42
+ print(f"Ideal Z dimension (mm): {expected[2]:.2f}")
43
+ print(f"Measured X dimension (mm): {measured[0]:.2f}")
44
+ print(f"Measured Y dimension (mm): {measured[1]:.2f}")
45
+ print(f"Measured Z dimension (mm): {measured[2]:.2f}")
46
+ 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}%")
26
52
 
27
53
  if __name__ == "__main__":
28
- main()
54
+ main()
@@ -0,0 +1,7 @@
1
+ def calculate_tolerance(expected, measured):
2
+ tolerances = {}
3
+ for axis, e, m in zip(['X', 'Y', 'Z'], expected, measured):
4
+ signed = ((m - e) / e) * 100
5
+ absolute = abs(signed)
6
+ tolerances[axis] = {'signed': signed, 'absolute': absolute}
7
+ return tolerances
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: PrintTolTest
3
- Version: 0.1.1
3
+ Version: 0.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>
@@ -30,12 +30,17 @@ Dynamic: license-file
30
30
 
31
31
  A simple CLI tool to calculate 3D print dimensional tolerance.
32
32
 
33
+ It is worthy to note this is more for testing your print consistency (and lets be honest, even more-so bragging).
34
+
35
+ Testing in this way is not an end-all be-all solution,
36
+ It does have issues and is not a perfect representation of printer performance.
37
+
33
38
  ## Installation
34
39
 
35
40
  Get the Latest
36
41
 
37
42
  ```sh
38
- python3 -m pip install --upgrade 'PrintTolTest @ git+https://github.com/NanashiTheNameless/PrintTolTest@master'
43
+ python3 -m pip install --upgrade 'PrintTolTest @ git+https://github.com/NanashiTheNameless/PrintTolTest@main'
39
44
  ```
40
45
 
41
46
  Or get from [PyPi](<https://pypi.org/project/PrintTolTest/>) (not recommended, may be out of date)
@@ -46,6 +51,26 @@ python3 -m pip install --upgrade PrintTolTest
46
51
 
47
52
  ## Get started
48
53
 
54
+ ### Interactively
55
+
49
56
  ```sh
50
57
  PrintTolTest
51
58
  ```
59
+
60
+ ### Partially-interactively
61
+
62
+ ```sh
63
+ PrintTolTest --expected X Y Z
64
+ ```
65
+
66
+ ### Non-Interactively
67
+
68
+ ```sh
69
+ PrintTolTest --expected X Y Z --measured X Y Z
70
+ ```
71
+
72
+ ## Credits
73
+
74
+ [All Major Contributors](<CONTRIBUTORS.md>)
75
+
76
+ [All Other Contributors](<https://github.com/NanashiTheNameless/PrintTolTest/graphs/contributors>)
@@ -0,0 +1,9 @@
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,,
@@ -1,8 +0,0 @@
1
- PrintTolTest/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
- PrintTolTest/cli.py,sha256=FGqNz0hA0zhaHUX9-4_3CbIGFs5Rw26jN_p7EKGoXBA,1088
3
- printtoltest-0.1.1.dist-info/licenses/LICENSE.md,sha256=q0l2oX2406iNTmytch1XT4lDnxztbjgyja6zvp8wBA0,2773
4
- printtoltest-0.1.1.dist-info/METADATA,sha256=XelyTzgA9DDjq2g3jmFsL-Y_NDcwP9rgAEhCrMJtEfA,1692
5
- printtoltest-0.1.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
6
- printtoltest-0.1.1.dist-info/entry_points.txt,sha256=_w7s7qEvPZvII0_utuplEVnUzskCu9NJlJqLH6PHzwo,55
7
- printtoltest-0.1.1.dist-info/top_level.txt,sha256=Hy6xq9GW_e6XfU8p2bI4KdcVJUnVUp-IHatcm53ZZ-U,13
8
- printtoltest-0.1.1.dist-info/RECORD,,