Bug: Move Feature is Broken

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Rotating MeshBodies using a move feature results in unpredictable behavior, when they have previously been rotated. Further rotations do not occur around the desired axis. And the actual axis of rotation seems to change in unpredictable ways.
This makes it impossible to move MeshBodies using the API.
Attached is a script to reproduce this issue and an example mesh with labeled faces.
Desired behavior:
The script should rotate the selected MeshBody by 4 rotations around the Z-axis. This is done by 320 small, identical moves to visualize the problem.
Actual behavior:
The MeshBody seems to rotate about an unknown, ever-changing axis that is neither the global or local Z axis. This makes any useful rotation impossible.
Steps to replicate:
Insert example mesh
Rotate by 90 degrees (or other angles) around X or Y-axis.
Select MeshBody
Run Script
Hold Undo to animate
#Author-Author #Description-Description import adsk.core, adsk.fusion, adsk.cam, traceback def run(context): try: app = adsk.core.Application.get() ui = app.userInterface des = app.activeProduct root = des.rootComponent # Creates colection from selection bodies = adsk.core.ObjectCollection.create() for selection in ui.activeSelections: bodies.add(selection.entity) # Goes to direct modeling mode since its required for some reason des.designType = 0 # Creates a transformation matrix that rotates around the Z axis, centered at (0,0,0) by about 4.5 degree transform = adsk.core.Matrix3D.create() transform.setToRotation(3.141/40, adsk.core.Vector3D.create(0,0,1), adsk.core.Point3D.create(0,0,0)) moveFeats = root.features.moveFeatures # Does lots of moves so you can step through by CMD-Z like an animation, # should do 4 Rotations and end up exactily like it started for i in range(320): moveFeatureInput = moveFeats.createInput(bodies, transform) moveFeats.add(moveFeatureInput) except: print(traceback.format_exc())
I would love to hear If I am doing anything wrong or there is a workaround., as my Add-In is based around working with and moving Meshes.