Skip to content

Commit

Permalink
Adding back mesh, fixed Mesh import.
Browse files Browse the repository at this point in the history
  • Loading branch information
senthurayyappan committed Nov 19, 2024
1 parent 3cb0bad commit 552d2b6
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
1 change: 1 addition & 0 deletions docs/api/mesh.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
::: onshape_api.mesh
1 change: 1 addition & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions onshape_api/mesh.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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.
Expand All @@ -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)
"""
Expand Down

0 comments on commit 552d2b6

Please sign in to comment.