In replicator, how can I get the "extent" from the .usd file.Which API sholud I use?

@zackliu2017 you could try the following snippet utilizing the UsdGeomBoundable class - Universal Scene Description: UsdGeomBoundable Class Reference :

from pxr import UsdGeom

stage = omni.usd.get_context().get_stage()
prim_path = "/World/Geometry/SM_IndustrialPlasticPallet_A01_01"
prim = stage.GetPrimAtPath(prim_path)
primExtent = UsdGeom.Boundable(prim).GetExtentAttr().Get()


I run the code,but get None

and then, I run anthor code like this, I get error.

does it work on the first scene you screenshotted, though?

in your second example, i noticed your prim path wasn’t set to the actual geom prim, you left it at the reference prim. have you tried it on the geom prim instead?

one more thing to add, the snippet has more to do with USD API and not so much with replicator API, which is probably why you are getting the error in the last section.

At first, Thanks to your reply.
I correcte the prim path.And your code run is correct.
My second example has error like this,