Creating a mesh from an USD in Isaac Sim with Python


I need to perform a simple task but I struggle to find how to do it.

I have a 3D mesh that is saved in a USD file.

I have no problem adding it to the stage manually but I want to do it with Python in an extension as I need to add lots of these objects and script the positions.

The examples use “CreateMeshPrimCommand”. I found some documentation about this but it is very limited:

Could you point me towards a more precise documentation or give an example of that ?


My current draft:

def create_mesh(
    x: float = 0.0,
    y: float = 0.0,
    z: float = 0.0,
    Rx: float = 0.0,
    Ry: float = 1.0,
    Rz: float = 0.0,
    angle: float = 0.0,
    source_file: str = "./exts_user/my_ext/usd/my_mesh.usd",
    name: str = "my_name",
    """Create a mesh"""
    usd_path = f"/World/physicsScene/{name}",
    # Get the stage
    stage = omni.usd.get_context().get_stage()
    # Create the mesh
    result, path = omni.kit.commands.execute("CreateMeshPrimCommand", prim_type="Mesh")
    # TODO
    # How to load the mesh from a USD file?
    # Get the prim
    my_prim = stage.GetPrimAtPath("/Mesh")
    # Enable physics on prim
    # To account for the hole, we use convexDecomposition instead of convexHull
    utils.setRigidBody(my_prim, "convexDecomposition", False)
    # Add a mass
    mass_api = UsdPhysics.MassAPI.Apply(my_prim)
    # If we know the mass:
    # mass_api.CreateMassAttr(10)
    # Or set the density instead:
    # Add a transform
    xform = UsdGeom.Xformable(my_prim)
    transform = xform.AddTransformOp()
    mat = Gf.Matrix4d()
    mat.SetRotateOnly(Gf.Rotation(Gf.Vec3d(Rx,Ry,Rz), angle))
    return my_prim

Hi @thibd - Someone from our team will review and respond back to you.

Hi @thibd - Apologies for the delay in response. Please let us know if you are still having any issues or questions after using the latest Isaac Sim release.

More information about mesh can be found here: Universal Scene Description: UsdGeomMesh Class Reference