Create random number (1-6) of objects from USD using rep.create.from_usd()

Hi,

I’d like to produce random number of prims from a USD object using
def worker():
worker = rep.create.from_usd(red_car, semantics=[(‘class’, ‘red_car’)],
count=rep.distribution.uniform(1,6))

… …
I keep getting errors - “ReplicatorItem” object can not be interpreted as an integer. Obviously “counter=” expects an integer. How can I convert ReplicatorItem object to an integer?

Thank you all!

Can you give omni.replicator.core.randomizer.instantiate a try? I believe the distribution should work with the size var.

https://docs.omniverse.nvidia.com/py/replicator/1.11.8/source/extensions/omni.replicator.core/docs/API.html#omni.replicator.core.randomizer.instantiate

yes, tested instantiate with size attribute working as expected. thank you very much.

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