How to report the selected item in Combo Box

In my extension ,I created a combo box to select an exact axis and will use the axis later , but I don’t know how to get the item selected.

I created the combo box by:

axis_selected = ui.ComboBox(0, “x”, “y”, “z”)

Hi @1031521414. I created a sample here for you: developer-office-hours/ at main · mati-nvidia/developer-office-hours · GitHub

Let me know if you have any questions!

Thank you for your help.
And could you help me for another question ?
I’m making an extension witch enables you create a force whose applying position and direction can change along with the rigid body the force applies on.
In order to realize the function to change the direction and position along with the rigid body, I have known a function that can get real-time rotation and position of the rigid body

def get_rigid_body_pos_rot(self, path: str):
get current transform of the rigid body on path from physx and return pos and rot
curr_pos = carb.Float3(0, 0, 0)
curr_rot_quat = carb.Float3()
curr_transform = get_physx_interface().get_rigidbody_transformation(str(path))
rv_success = curr_transform[“ret_val”]
if rv_success:
curr_pos_f3 = curr_transform[“position”]
curr_pos = carb.Float3(curr_pos_f3[0], curr_pos_f3[1], curr_pos_f3[2])
curr_rot_f4 = curr_transform[“rotation”]
curr_rot_quat = carb.Float3(curr_rot_f4[3], curr_rot_f4[0], curr_rot_f4[1], curr_rot_f4[2])
return curr_pos, curr_rot_quat
In this code , I should call a path witch is a class imported from pxr.Sdf. But I could only get a string like “/World/Xform/Cone”. Is there some function can change the string into the class?

You can do something like this:

from pxr import Sdf
path_obj = Sdf.Path("/World/Xform/Cube")

In the future, please create a new forum post for new questions so that it’s easier for others with the same question to find an answer.

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