How to group a set of prims to get a new prim?

From this code, we find all the floor tile prims

floor_prims = [x.GetPath() for x in stage.Traverse() if "SM_floor" in x.GetName() and prims_utils.get_prim_type_name(x.GetPath()) == "Xform"]

I want to create a new prim named floor_prim which groups all these prims together so that I can pass it to rep.randomizer.scatter_2d(surface_prims=prim, check_for_collisions=True)

How should I do this using Python in Isaac Sim?

Here’s the ENV
ENV_URL = “omniverse://localhost/mona/full_warehouse_worker_and_anim_cameras_mona.usd”

Hi @mona.jalal

You can use the move_prim function to group prims as follow:

import omni.isaac.core.utils.prims as prims_utils
import omni.isaac.core.utils.stage as stage_utils

stage = stage_utils.get_current_stage()
floor_prims = [x.GetPath() for x in stage.Traverse() if "SM_floor" in x.GetName() and prims_utils.get_prim_type_name(x.GetPath()) == "Xform"]

path_to = "/Root/floor"
prims_utils.define_prim(prim_path=path_to, prim_type="Xform")
[prims_utils.move_prim(path_from=path_from, path_to=f"{path_to}/{path_from.name}") for path_from in floor_prims]

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.