USD Python API failed to SetTranslate to a cube position in Script Editor

like the screenshot below shows, I want to use Python API to change the position of a cube. Firstly, I create a ground plane and a cube in stage, then use GetPrimAtPath function to get the prim instance, and then I want to use UsdGeom.XfomCommnAPI.SetTranslate to change to position of this cube but fail, the cube stay still after running this script, the output of the position is also stay unchanged.

I want to know if my method is right to change the cube’s position, and if so, why my cube stay still after running the script?

I’ve found another method to move the cube, using transform = xform.AddTransformOp(), but the Transform attribute of the cube will looks like this:


so the question is how to change the original Translate, Orient, and Scale of the cube, I don’t want to use the add attribute method but just to change the original attribute.


More precisely, the xformable class doesn’t have the GetRotateOp method to access to change the rotation value, how do I do? I want to change the rotation value respect to time.

not sure if this is relevant, you could set the position of the cube using the following code in place of line 20 without using XformCommonAPI (which might make my suggestion moot)

1 Like

It works!

1 Like

in case it interests you, @mati-nvidia had done a livestream going over how you can move a prim forward incrementally in Code. feel free to take a look -

or directly from the livestream VOD.

1 Like

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