Returning values from spinner and manipulate with them in real time
Hello everyone, I would like to develop an tool, which will place car wheels from middle of the scene to correct positions.
There is an example, what I want to do:
http://i.imgur.com/m9SXXZr.png
I want the script to place wheels on the correct location (yellow dots) with one click after the values to the spinner are inserted.
This is the rollout I have:
rollout WheelPlacerTool "WheelPlacer" width:878 height:247 ( --- Rollout Style --- GroupBox WheelParametersGroup "Wheel Parameters" pos:[11,5] width:843 height:138 spinner WheelDistance "" pos:[20,96] width:125 height:16 range:[0,4,0] type:#worldunits scale:0.001 spinner FrontValue "" pos:[160,96] width:125 height:16 range:[0,3,0] type:#worldunits scale:0.001 spinner RearValue "" pos:[300,96] width:125 height:16 range:[0,3,0] type:#worldunits scale:0.001 spinner FrontSupressionLimit "" pos:[440,96] width:125 height:16 range:[0,1,0] type:#worldunits scale:0.001 spinner RearSupressionLimit "" pos:[580,96] width:125 height:16 range:[0,1,0] type:#worldunits scale:0.001 spinner WheelDepth "" pos:[720,96] width:125 height:16 range:[0,0.5,0] type:#worldunits scale:0.001 ) createdialog WheelPlacerTool
WheelDistance - distance between center of front and rear wheel axis.
FrontValue - distance between front wheels
RearValue - distance between rear wheels
FrontSupressionLimit - center of front wheel in Z-axis.
RearSupressionLimit - center of rear wheel in Z-axis.
WheelDepth - correction for wheel pivot (0,000) will mean center.
The main question is how do I get current value from spinner and use it as :
$myObject.pos = [ ValuefromSpinner1, ValuefromSpinner2, ValuefromSpinner3]
Thanks for any help with my project :)
Comments
.
To get the spinner value use:
WheelDistance.value
For example:
$myObject.pos = [ WheelDistance.value, FrontValue.value, RearValue.value]
Tools and Scripts for Autodesk 3dsMax
real time update
and this is small sample how to get position update in real time...
positioning function is only sample, you have to replace it with your own:
Thank you! Its working but I
Thank you! Its working but I have an issue, exactly the same I had during I was developing it. Even if scene units are set to meters and spinner too it place wheels by maxunits. For example wheen the wheelbase is 2 it moves the wheels by two maxunits. How to make it working with meters. (Works well when values are multiplied by 39). 1m = 39maxunits