**(Attached paperslicer.ghx)** can you make a py file that takes a 3d model and checks the size of it against some hardcoded size? (eg 75 x 50 x 50). doesn't even have to have a ui. can be run from command line and write to command line. --- ```python #!/usr/bin/env python3 """ check_model_size.py Checks whether a 3D model fits within a hardcoded bounding box size. Usage: python check_model_size.py mymodel.stl Supported formats (depends on trimesh + installed loaders): .stl .obj .ply .glb .gltf etc. Install: pip install trimesh numpy """ import sys import trimesh # ------------------------------------------------------------------- # HARDCODED MAX SIZE (in millimetres) # Change these values as needed # ------------------------------------------------------------------- MAX_X = 75 MAX_Y = 50 MAX_Z = 50 # ------------------------------------------------------------------- def main(): if len(sys.argv) != 2: print("Usage: python check_model_size.py ") sys.exit(1) model_path = sys.argv[1] try: mesh = trimesh.load(model_path) # Handle scenes containing multiple meshes if isinstance(mesh, trimesh.Scene): mesh = trimesh.util.concatenate( tuple( g for g in mesh.geometry.values() ) ) # Bounding box extents size_x, size_y, size_z = mesh.bounding_box.extents print("\nModel dimensions:") print(f"X: {size_x:.2f} mm") print(f"Y: {size_y:.2f} mm") print(f"Z: {size_z:.2f} mm") print("\nMaximum allowed:") print(f"X: {MAX_X} mm") print(f"Y: {MAX_Y} mm") print(f"Z: {MAX_Z} mm") fits_x = size_x <= MAX_X fits_y = size_y <= MAX_Y fits_z = size_z <= MAX_Z print("\nResult:") if fits_x and fits_y and fits_z: print("PASS: Model fits within size limits.") sys.exit(0) else: print("FAIL: Model exceeds size limits.") if not fits_x: print(f" - X too large ({size_x:.2f} > {MAX_X})") if not fits_y: print(f" - Y too large ({size_y:.2f} > {MAX_Y})") if not fits_z: print(f" - Z too large ({size_z:.2f} > {MAX_Z})") sys.exit(2) except Exception as e: print(f"Error loading model: {e}") sys.exit(3) if __name__ == "__main__": main() ``` Example: `python check_model_size.py cube.stl` Example output: ``` Model dimensions: X: 72.14 mm Y: 41.00 mm Z: 49.99 mm Maximum allowed: X: 75 mm Y: 50 mm Z: 50 mm Result: PASS: Model fits within size limits. ``` --- make output more concise --- ``` #!/usr/bin/env python3 import sys import trimesh MAX_X = 75 MAX_Y = 50 MAX_Z = 50 def main(): if len(sys.argv) != 2: print("usage: check_model_size.py ") sys.exit(1) try: mesh = trimesh.load(sys.argv[1]) if isinstance(mesh, trimesh.Scene): mesh = trimesh.util.concatenate(tuple(mesh.geometry.values())) x, y, z = mesh.bounding_box.extents limits = { "X": (x, MAX_X), "Y": (y, MAX_Y), "Z": (z, MAX_Z), } failures = [] for axis, (size, limit) in limits.items(): if size > limit: failures.append(f"{axis} too large") if not failures: print("PASS") sys.exit(0) scale = min( MAX_X / x, MAX_Y / y, MAX_Z / z ) print( f"FAIL: {', '.join(failures)} | " f"uniform scale <= {scale:.3f}" ) sys.exit(2) except Exception: print("ERROR") sys.exit(3) if __name__ == "__main__": main() ``` Example: `FAIL: X too large | uniform scale <= 0.955` `FAIL: X too large, Y too large | uniform scale <= 0.820` `PASS`