Skip to content

Commit

Permalink
Warn on STL simplification failures
Browse files Browse the repository at this point in the history
  • Loading branch information
velovix committed Jan 9, 2024
1 parent 35191fa commit acc2625
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion onshape_urdf_exporter/stl_utils.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from pathlib import Path

import open3d as o3d
from colorama import Fore, Style


def simplify_stl(path: Path) -> None:
Expand All @@ -20,11 +21,13 @@ def simplify_stl(path: Path) -> None:
simple_mesh = simple_mesh.compute_triangle_normals()
simple_mesh = simple_mesh.compute_vertex_normals()

assert o3d.io.write_triangle_mesh(
success = o3d.io.write_triangle_mesh(
str(path),
simple_mesh,
write_vertex_normals=False,
write_triangle_uvs=False,
compressed=False,
write_vertex_colors=False,
)
if not success:
print(f"{Fore.YELLOW}WARNING: Failed to simplify STL {path}{Style.RESET_ALL}")

0 comments on commit acc2625

Please sign in to comment.