Retrieve prim path from ReplicatorItem

How can I retrieve the prim path of a ReplicatorItem?
For example:

import omni.replicator.core as rep
torus = rep.create.torus()

If I run this code with Isaac GUI I can manually see that its prim path of torus is /Replicator/Torus_Xform/Torus, but how can I programmatically get it with python?

Hey @federico.domeniconi. As I’ve mentioned before, anything related to Replicator is best asked in the SDG forum. I’ve move this topic there now.

Sorry if I posted in the wrong section.

I found the function omni.replicator.core.get.prim_at_path in the documentation but it doesn’t work.

Morever I think that the name of the function and the documentation are misleading. In fact:

  • the name of the function is prim_at_path
  • the doc says Get the prim at the exact path and the inputs is USD path to the desired prim

but it also accept a ReplicatorItem as input.

I tried this function in the Isaac GUI but it doesn’t work:

import omni.replicator.core as rep
torus = rep.create.torus()
path = rep.get.prim_at_path(torus)

It raises the following error:

(sorry for posting the image of the error, but Isaac didn’t let me copy the text)

Hello,

Sorry for the confusion.

get.prim_at_path() returns a prim object, not a path.

Using your example:

import omni.replicator.core as rep
torus = rep.create.torus()
prim = rep.get.prim_at_path("/Replicator/Torus_Xform")

torus is already a prim object (wrapped in a ReplicatorItem), which is why get.prim_at_path(torus) does not work, since torus is not a path or a path wrapped by ReplicatorItem.

If you are trying to get the path of the prim that was just created:

import omni.replicator.core as rep
torus = rep.create.torus()
path = rep.utils.get_node_targets(torus.node, "inputs:prims")[0]

And you can always work directly with the prim after its creation without knowing its path:

with torus:
    rep.modify.pose(...)

I have gone through documentation for rep.utils.get_node_targets() where second input param we need to pass is attribute. Can you please mention, where can I find these attributes?

They can be found on the prim object, either through the Omniverse User Interface, or via Python by using the dir() method to examine the object.

Hovering over an attribute in the Property pane of the UI will give you its attribute name

The majority of the time, you should not have to bother with doing this, as the replicator API handles node connections for you.