PrintTolTest 0.2.2__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 +31 -12
- PrintTolTest/tolerance.py +2 -2
- {printtoltest-0.2.2.dist-info → printtoltest-0.2.2.1.dist-info}/METADATA +1 -1
- printtoltest-0.2.2.1.dist-info/RECORD +9 -0
- printtoltest-0.2.2.dist-info/RECORD +0 -9
- {printtoltest-0.2.2.dist-info → printtoltest-0.2.2.1.dist-info}/WHEEL +0 -0
- {printtoltest-0.2.2.dist-info → printtoltest-0.2.2.1.dist-info}/entry_points.txt +0 -0
- {printtoltest-0.2.2.dist-info → printtoltest-0.2.2.1.dist-info}/licenses/LICENSE.md +0 -0
- {printtoltest-0.2.2.dist-info → printtoltest-0.2.2.1.dist-info}/top_level.txt +0 -0
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(
|
28
|
-
|
29
|
-
|
30
|
-
|
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 =
|
35
|
-
|
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 [
|
48
|
-
signed = tolerances[axis][
|
49
|
-
absolute = tolerances[axis][
|
50
|
-
sign_prefix =
|
51
|
-
print(
|
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([
|
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] = {
|
6
|
+
tolerances[axis] = {"signed": signed, "absolute": absolute}
|
7
7
|
return tolerances
|
@@ -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.2.dist-info/licenses/LICENSE.md,sha256=q0l2oX2406iNTmytch1XT4lDnxztbjgyja6zvp8wBA0,2773
|
5
|
-
printtoltest-0.2.2.dist-info/METADATA,sha256=HxKR6DvDuxMrpzr685ZqwRKbdDXGURacM0MHtH1_5R4,2199
|
6
|
-
printtoltest-0.2.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
7
|
-
printtoltest-0.2.2.dist-info/entry_points.txt,sha256=_w7s7qEvPZvII0_utuplEVnUzskCu9NJlJqLH6PHzwo,55
|
8
|
-
printtoltest-0.2.2.dist-info/top_level.txt,sha256=Hy6xq9GW_e6XfU8p2bI4KdcVJUnVUp-IHatcm53ZZ-U,13
|
9
|
-
printtoltest-0.2.2.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|