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) """