How to refer to the child of a prim without giving the prim path

Hi,
I need to loop through several prims and do operations on each prim’s child. For that, I need a code that refers to the child of a prim without using the child’s path because the path is different every time the loop executes.
Here is how my usd is structured:

I need to access the “shape” prims inside the “Hole” prims.

Hey Ai-Da,
Assuming we are allowed to use the path for “Shapes_powerTowerPoints” it might looks something like this:

stage = omni.usd.get_context().get_stage()
shapes = stage.GetPrimAtPath('/World/Shapes_powerTowerPoints')
for shape in shapes.GetChildren(): # Get's children in Shapes_powerTowerPoints
    for shape_child in shape.GetChildren(): # Get's children in Hole
        pass # Do something with shape_child, which is shape_1, shape_2, etc...

Otherwise you could also start from the Stage’s root value.

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