newton.usd.get_tetmesh#

newton.usd.get_tetmesh(prim, *, compat_namespaces=None, _load_custom_attributes=True)[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 (canonical physics: namespace, with compat_namespaces as a fallback), 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.

Custom primvars use their resolved interpolation to determine attribute frequency. Other custom arrays use length-based inference; arrays whose frequency is ambiguous or cannot be inferred emit a warning and are omitted without preventing the TetMesh from loading.

Material-attribute namespaces (deprecated default): with compat_namespaces=None (the default) the legacy vendor namespaces (omniphysics: / physxDeformableBody:) are read off any bound material, matching the pre-canonical behavior. That default is deprecated and emits a DeprecationWarning when it is load-bearing: the bound material authors vendor-namespaced deformable attributes, or canonical physics: attributes without PhysicsVolumeDeformableMaterialAPI (API-applied canonical or render-only materials do not warn); a future release will default to canonical physics:-only. Pass compat_namespaces=() to adopt the canonical-only behavior now – moduli are then read only from a material that applies PhysicsVolumeDeformableMaterialAPI – or pass an explicit list (e.g. newton.usd.DEFORMABLE_LEGACY_NAMESPACES) to keep reading vendor namespaces without the warning.

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.

  • compat_namespaces (Sequence[str] | None) – Vendor attribute namespaces accepted as a fallback to the canonical physics: material attributes, lifting the PhysicsVolumeDeformableMaterialAPI gate. None (the default) selects the deprecated legacy namespaces; pass () for canonical-only.

Returns:

A newton.TetMesh with vertex positions and tet connectivity.

Return type:

TetMesh