Omni.usd commands' return value

`I use following command to create Xform, and I wish to get the Xform prim:

    result=omni.kit.commands.execute('CreatePrimWithDefaultXform', prim_type='Xform', attributes={})

but I checked in the console, result is a tuple type, not a prim type? 
How can I get the prim created by the omni.usd commands?

Hi Commands that don’t accept a prim path for where you would like to create a prim, will return the created prim path. CreatePrimWithDefaultXform accepts a prim path using the keyword argument prim_path so you know where it was created. Alternatively, you can have it select the created prim and then get the selected prim using omni.usd. You can learn more about the keyword arguments for any kit command using the Commands History window: Command History — extensions latest documentation

Two additional functions will help with this:

  1. Usd.Stage.GetPrimAtPath() will return a Usd.Prim object given the prim path that you provided to the command to create the prim: Usd module — pxr-usd-api 105.0.2 documentation
  2. omni.usd.get_stage_next_free_path() can help you ensure that you are not trying to create a prim at a path that is already occupied by another prim: get_stage_next_free_path — omni.usd 1.10.15 documentation

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