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

**URL:** <https://forums.developer.nvidia.com/t/usd-python-api-failed-to-settranslate-to-a-cube-position-in-script-editor/266729>\
**Category:** Isaac Sim\
**Created:** [September 18, 2023, 6:35am UTC](https://forums.developer.nvidia.com/t/usd-python-api-failed-to-settranslate-to-a-cube-position-in-script-editor/266729 "2023-09-18T06:35:27Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Te77iiiii\_Ho](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@Te77iiiii\_Ho](https://forums.developer.nvidia.com/u/Te77iiiii_Ho)\
**Post date:** [September 18, 2023, 6:35am UTC](https://forums.developer.nvidia.com/t/usd-python-api-failed-to-settranslate-to-a-cube-position-in-script-editor/266729/1 "2023-09-18T06:35:27Z")

</div>

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?

 ![2023-09-18_14-27](https://global.discourse-cdn.com/nvidia/original/4X/b/2/c/b2c357c2589ccb63b0e407ea318f7d42d7cb7658.png)

---

<div class="post-metadata">

**Author:** ![Te77iiiii\_Ho](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@Te77iiiii\_Ho](https://forums.developer.nvidia.com/u/Te77iiiii_Ho)\
**Post date:** [September 18, 2023, 6:57am UTC](https://forums.developer.nvidia.com/t/usd-python-api-failed-to-settranslate-to-a-cube-position-in-script-editor/266729/2 "2023-09-18T06:57:41Z")

</div>

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

![2023-09-18_14-52](https://global.discourse-cdn.com/nvidia/original/4X/9/8/a/98adf74b835a8cfee542ad9d1518dae8319e541c.png)

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.

**===================EDIT======================**

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.

---

<div class="post-metadata">

**Author:** ![Simplychenable](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/simplychenable/32/271930_2.png) [@Simplychenable](https://forums.developer.nvidia.com/u/Simplychenable)\
**Post date:** [September 18, 2023, 12:09pm UTC](https://forums.developer.nvidia.com/t/usd-python-api-failed-to-settranslate-to-a-cube-position-in-script-editor/266729/3 "2023-09-18T12:09:01Z")

</div>

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)

```auto
the_prim.GetAttribute("xformOp:translate").Set(new_pos)

```

---

<div class="post-metadata">

**Author:** ![Te77iiiii\_Ho](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@Te77iiiii\_Ho](https://forums.developer.nvidia.com/u/Te77iiiii_Ho)\
**Post date:** [September 19, 2023, 2:45am UTC](https://forums.developer.nvidia.com/t/usd-python-api-failed-to-settranslate-to-a-cube-position-in-script-editor/266729/4 "2023-09-19T02:45:56Z")

</div>

It works!

---

<div class="post-metadata">

**Author:** ![Simplychenable](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/simplychenable/32/271930_2.png) [@Simplychenable](https://forums.developer.nvidia.com/u/Simplychenable)\
**Post date:** [September 19, 2023, 2:49am UTC](https://forums.developer.nvidia.com/t/usd-python-api-failed-to-settranslate-to-a-cube-position-in-script-editor/266729/5 "2023-09-19T02:49:44Z")

</div>

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 - [https://github.com/mati-nvidia/developer-office-hours/blob/main/exts/maticodes.doh\_2023\_04\_14/scripts/move\_prim\_forward.py](https://github.com/mati-nvidia/developer-office-hours/blob/main/exts/maticodes.doh_2023_04_14/scripts/move_prim_forward.py)

or [directly from the livestream VOD](https://youtu.be/aP0mEDxEySs?t=684).

---

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/system/32/68080_2.png) [@system](https://forums.developer.nvidia.com/u/system)\
**Post date:** [October 3, 2023, 2:50am UTC](https://forums.developer.nvidia.com/t/usd-python-api-failed-to-settranslate-to-a-cube-position-in-script-editor/266729/6 "2023-10-03T02:50:32Z")

</div>

Closed on October 3, 2023, 2:50am UTC

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