Message 1 of 5
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
import adsk.core, adsk.fusion, adsk.cam, traceback
def run(context):
ui = None
try:
app = adsk.core.Application.get()
ui = app.userInterface
des = adsk.fusion.Design.cast(app.activeProduct)
root_comp = des.rootComponent
EYE = adsk.core.Matrix3D.create()
o1 = root_comp.occurrences.addNewComponent(EYE)
o2 = root_comp.occurrences.addNewComponent(EYE)
o1_1 = o1.component.occurrences.addNewComponent(EYE)
o1_2 = o1.component.occurrences.addNewComponent(EYE)
ROT = adsk.core.Matrix3D.create()
ROT.setToRotation(1., adsk.core.Vector3D.create(0, 0, 1), adsk.core.Point3D.create(0, 0, 0))
o2_1 = o1_1.moveToComponent(o2)
o2_1.transform = ROT
print('Before:')
print('o2_1.transform.asArray():')
print(o2_1.transform.asArray())
_ = o1_2.moveToComponent(o2)
print('After:')
print('o2_1.transform.asArray():')
print(o2_1.transform.asArray())
except:
if ui:
ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))
The test code above results:
Before:
o2_1.transform.asArray():
(0.5403023058681398, -0.8414709848078965, 0.0, 0.0, 0.8414709848078965, 0.5403023058681398, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0)
After:
o2_1.transform.asArray():
(1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0)
Why does o1_2.moveToComponent(o2) affects on o2_1.transform?
Solved! Go to Solution.