Message 1 of 2
Revolutioin link mechanism
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
#Refer this site:https://forums.autodesk.com/t5/fusion-360-api-and-scripts/inverse-kinematics-robot/m-p/5901869#M944
import adsk,math,traceback
def driveJoint():
ui = None
try:
app = adsk.core.Application.get()
ui = app.userInterface
des = adsk.fusion.Design.cast(app.activeProduct)
root = des.rootComponent
# Get the two occurrences in the root. These are two
# instances of the same component.
door1 = root.occurrences.itemByName('Demo v3:1')
#door2 = root.occurrences.itemByName('door v3:2')
# Get the component referenced by the occurrences.
doorComp = door1.component
# Get the joint in the piston component. It will be in
# the context of the piston component.
motorJoint = doorComp.joints.itemByName('Rev1')
# Create proxies of the joint for each occurrence.
motor1 = motorJoint.createForAssemblyContext(door1)
#motor2 = motorJoint.createForAssemblyContext(door2)
# Get the RevoluteJointMotion object from each joint.
revJointMotion1 = motor1.jointMotion
#revJointMotion2 = motor2.jointMotion
# Drive the joints.
for i in range(-90, 90, 3):
revJointMotion1.rotationValue = i * (math.pi/180.0)
#revJointMotion2.rotationValue = (i+180) * (math.pi/180.0)
adsk.doEvents()
for i in range(90, -90, -3):
revJointMotion1.rotationValue = i * (math.pi/180.0)
#revJointMotion2.rotationValue = (i+180) * (math.pi/180.0)
adsk.doEvents()
except:
if ui:
ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))
def main():
print ('drive')
driveJoint()
main()Hi, I try to revolute the link mechanism by using Fusion360 Python API.
I successd revolution Joints.
(I referred this URL:
https://forums.autodesk.com/t5/fusion-360-api-and-scripts/inverse-kinematics-robot/m-p/5901869#M944
)
However, one joints only rotates, doesnt move as link mechanism.
Please watch this video.
