[Closed] Maxscript code not working???
Hi,
I am a student and have been given some programming coursework to do using maxscript.
I have to create a rollout to put primitive objects into the scene and also rotate and translate selected objects.
I have written this code but for some reason when I run it there appears to be a problem with the spinners for translating selected objects. I can get the rollout to come up and input values into the spinners but when I click the translate button it comes up with the following message:
– unable to convert:SpinnerControl:translateSpinnerx to type: Float
Here is the code I have wrtten:
resetMaxFile #noprompt
rollout myrollout “Create Stuff”
(
–Button that resets the Max File
button ResetFile “Reset Scene”
on ResetFile pressed do
(
resetMaxFile #noprompt
)
– Button that creates a default box
button boxButton “Box”
on boxButton pressed do
(
mybox = box()
mybox.pos = [0,0,0]
)
– Button that creates a default plane
button planeButton “Plane”
on planeButton pressed do
(
myplane = plane()
)
– Button that creates a default sphere
button sphereButton “Sphere”
on sphereButton pressed do
(
mysphere = sphere()
)
– Button that creates a default cylinder
button cylinderButton “Cylinder”
on cylinderButton pressed do
(
mycylinder = cylinder()
)
– spinners to translate the selcted objects xyz
spinner translateSpinnerx “x”
spinner translateSpinnery “y”
spinner translateSpinnerz “z”
– Button that executes the translation
button translateSelectionButton “Translate”
on translateSelectionButton pressed do
(
move selection [translateSpinnerx, translateSpinnery, translateSpinnerz]
)
)
createdialog myrollout
The error is actually very helpful, it tells you it can’t give you a (float) number to make the point 3 value, because you’re giving it the variable that points to the spinner. But you need/want the value of the spinner.
Try using translateSpinnerx.value instead.
Cheers,
-Johan