Message 1 of 1
jointMotion angle change not working with linked component
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I have a Palette with sliders moving joints on a robot through the API.
This works when the robot is not a linked component. However, when the robot is
a linked component, moving the sliders doesn't do anything. Doesn't crash or give
any error messages. Breaking the link makes it work.
Do I have to do things differently when a component with joints is linked? I tried
calling refresh() but that doesn't seem to help. Weirdly, if I go through the browser UI
and use "drive joints", it works even when linked so maybe the UI is doing something different?
Can anybody help? Here is my code below. Thanks!
if cmd == 'joint_changed': # joint position slider was moved # get slider position joint_num = data['joint_num'] joint_name = "joint{}".format(joint_num) joint_angle_deg = float(data['joint_angle_deg']) # update model joint robot_comp = find_comp(CNAME_XARM) if robot_comp: # doing directly to jointMotion joints = robot_comp.joints joint = robot_comp.joints.itemByName(joint_name) rev_motion = adsk.fusion.RevoluteJointMotion.cast(joint.jointMotion) rev_motion.rotationValue = (joint_angle_deg / 360) * 2 * math.pi