From 552d2b61e48457207b91d26b6accb816e178527e Mon Sep 17 00:00:00 2001 From: imsenthur Date: Tue, 19 Nov 2024 10:09:12 -0500 Subject: [PATCH] Adding back mesh, fixed Mesh import. --- docs/api/mesh.md | 1 + mkdocs.yml | 1 + onshape_api/mesh.py | 6 +++--- 3 files changed, 5 insertions(+), 3 deletions(-) create mode 100644 docs/api/mesh.md diff --git a/docs/api/mesh.md b/docs/api/mesh.md new file mode 100644 index 0000000..4270b0c --- /dev/null +++ b/docs/api/mesh.md @@ -0,0 +1 @@ +::: onshape_api.mesh diff --git a/mkdocs.yml b/mkdocs.yml index 49f01b4..a9863e3 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -25,6 +25,7 @@ nav: - Connect: api/connect.md - Graph: api/graph.md - Log: api/log.md + - Mesh: api/mesh.md - Parse: api/parse.md - Urdf: api/urdf.md - Utilities: api/utilities.md diff --git a/onshape_api/mesh.py b/onshape_api/mesh.py index 573c70a..17fd971 100644 --- a/onshape_api/mesh.py +++ b/onshape_api/mesh.py @@ -6,7 +6,7 @@ from functools import partial import numpy as np -from stl import mesh +from stl.mesh import Mesh def transform_vectors(vectors: np.ndarray, rotation: np.ndarray, translation: np.ndarray) -> np.ndarray: @@ -25,7 +25,7 @@ def transform_vectors(vectors: np.ndarray, rotation: np.ndarray, translation: np return np.dot(vectors, rotation.T) + translation * len(vectors) -def transform_mesh(mesh: mesh.Mesh, transform: np.ndarray) -> mesh.Mesh: +def transform_mesh(mesh: Mesh, transform: np.ndarray) -> Mesh: """ Apply a transformation matrix to an STL mesh. @@ -37,7 +37,7 @@ def transform_mesh(mesh: mesh.Mesh, transform: np.ndarray) -> mesh.Mesh: Transformed STL mesh Examples: - >>> mesh = mesh.Mesh.from_file("mesh.stl") + >>> mesh = Mesh.from_file("mesh.stl") >>> transform = np.eye(4) >>> transform_mesh(mesh, transform) """