newton.usd.get_tetmesh#

newton.usd.get_tetmesh(prim)[source]#

Load a tetrahedral mesh from a USD prim with the UsdGeom.TetMesh schema.

Reads vertex positions from the points attribute and tetrahedral connectivity from tetVertexIndices. If a physics material is bound to the prim (via material:binding:physics) and contains youngsModulus, poissonsRatio, or density attributes (under the omniphysics: or physxDeformableBody: namespaces), those values are read and converted to Lame parameters (k_mu, k_lambda) and density on the returned TetMesh. Material properties are set to None if not present.

Example

from pxr import Usd
import newton
import newton.usd

usd_stage = Usd.Stage.Open("tetmesh.usda")
tetmesh = newton.usd.get_tetmesh(usd_stage.GetPrimAtPath("/MyTetMesh"))

# tetmesh.vertices  -- np.ndarray, shape (N, 3)
# tetmesh.tet_indices -- np.ndarray, flattened (4 per tet)
Parameters:

prim (Usd.Prim) – The USD prim to load the tetrahedral mesh from.

Returns:

A newton.TetMesh with vertex positions and tet connectivity.

Return type:

TetMesh