#400995
I just want to set a new rotation to the objects in pymaxwell, but when the value (either X or Y or Z) is set to equal or over 90/-90 degrees, the outcome is incorrect. Can anyone give me some hints?

Attached are the model file and code.


from pymaxwell4 import *

mxs = 'C:/Users/wong.mingfae/Desktop/model.mxs'
outputFile = 'C:/Users/wong.mingfae/Desktop/model_out.mxs'

scene = Cmaxwell(mwcallback)
scene.readMXS(mxs)

# -------- set new rotation to Plane1 ------
Plane1 = scene.getObject('Plane1')
Plane1_Rotation = Plane1.getRotation()[0]
print('\n objName =', Plane1)
print('Plane1_Rotation =', Plane1_Rotation)
set_Rotation = Cvector(5.0000, 89.0000, 5.000)
print(' new_Rotation =', set_Rotation)
Plane1.setRotation(set_Rotation)
Plane1.setPivotRotation(set_Rotation)

# -------- set new rotation to Plane2 ------
Plane2 = scene.getObject('Plane2')
Plane2_Rotation = Plane2.getRotation()[0]
print('\n objName =', Plane2)
print('Plane2_Rotation =', Plane2_Rotation)
set_Rotation = Cvector(91.0000, 91.0000, 91.000)
print(' new_Rotation =', set_Rotation)
Plane2.setRotation(set_Rotation)
Plane2.setPivotRotation(set_Rotation)

# -------- set new rotation to Cube1 ------
Cube1 = scene.getObject('Cube1')
Cube1_Rotation = Cube1.getRotation()[0]
print('\n objName =', Cube1)
print(' Cube1_Rotation =', Cube1_Rotation)
set_Rotation = Cvector(4.0000, 91.0000, 21.000)
print(' new_Rotation =', set_Rotation)
Cube1.setRotation(set_Rotation)
Cube1.setPivotRotation(set_Rotation)

# -------- set new rotation to Cube2 ------
Cube2 = scene.getObject('Cube2')
Cube2_Rotation = Cube2.getRotation()[0]
print('\n objName =', Cube2)
print(' Cube2_Rotation =', Cube2_Rotation)
set_Rotation = Cvector(180.0000, 230.0000, 360.000)
print(' new_Rotation =', set_Rotation)
Cube2.setRotation(set_Rotation)
Cube2.setPivotRotation(set_Rotation)

# -------- save to new file ------
scene.writeMXS(outputFile)

print("Done.")
You do not have the required permissions to view the files attached to this post.

...and 3 Days later, 82.528 Views !!! ...NL, every[…]

Hello dear customers, We have just released a new[…]

grass generator extension

Just downloaded MWR5 for Rhino 6 and want to use g[…]

Hello everyone, I have a new bug with the latest M[…]