PDA

View Full Version : Problem with Radio Buttons.


mrapelje
12-22-2004, 08:01 PM
Alright I have a problem with the script I am working on I would like the state of Radio Button to drop into an action that i latter run. I have tried a bunch of different things now, and nothing seems to work, I think my logic is week and would like some help. Thanks.

Maybe I am going about it the wrong way...



rollout ExportPrep "Export Prep" width:296 height:148
(
radiobuttons rdoXP "X pos" pos:[7,7] width:184 height:30 labels:#("X min", "X mid", "X max") default:1 columns:3
radiobuttons rdoYP "Y pos" pos:[7,40] width:184 height:30 labels:#("X min", "X mid", "X max") default:1 columns:3
radiobuttons rdoZP "Z pos" pos:[7,73] width:184 height:30 labels:#("X min", "X mid", "X max") default:1 columns:3
button btnApEP "Apply" pos:[7,110] width:241 height:32
spinner spnXOs "X Offset" pos:[191,22] width:98 height:16 range:[-10000,10000,0]
spinner spnYOs "Y Offset" pos:[193,55] width:96 height:16 range:[-10000,10000,0]
spinner spnZOs "Z Offset" pos:[193,88] width:96 height:16 range:[-10000,10000,0]
button btnAbout "About" pos:[253,110] width:37 height:32

-- ? Problem Starts here, I think I would like the states to equal min, center, or max?

Xspot = case rdoXP.state of
(
1: min
2: center
3: max
)

Yspot = case rdoYP.state of
(
1: min
2: center
3: max
)

Zspot = case rdoZP.state of
(
1: min
2: center
3: max
)

on btnAbout pressed do
(
resetxform $
collapsestack $
(
for i in selection do (i.pivot = [i.Xspot.x,i.Yspot.y,i.Zspot.z]) -- ? For example I would want the Xpot to represent one of the radio buttons i.e. "max"?
)
$.pos=[0,0,0]
)

on btnAbout pressed do
(
messageBox "Created by Matt Rapelje, www.polyleaf.com (http://www.polyleaf.com/), matt@polyleaf.com"
)

)createDialog ExportPrep

-- Thanks for any help.

magicm
12-22-2004, 09:19 PM
rollout ExportPrep "Export Prep" width:296 height:148
(

radiobuttons rdoXP "X pos" pos:[7,7] width:184 height:30 labels:#("X min", "X mid", "X max") default:1 columns:3
radiobuttons rdoYP "Y pos" pos:[7,40] width:184 height:30 labels:#("X min", "X mid", "X max") default:1 columns:3
radiobuttons rdoZP "Z pos" pos:[7,73] width:184 height:30 labels:#("X min", "X mid", "X max") default:1 columns:3
button btnApEP "Apply" pos:[7,110] width:241 height:32
spinner spnXOs "X Offset" pos:[191,22] width:98 height:16 range:[-10000,10000,0]
spinner spnYOs "Y Offset" pos:[193,55] width:96 height:16 range:[-10000,10000,0]
spinner spnZOs "Z Offset" pos:[193,88] width:96 height:16 range:[-10000,10000,0]
button btnAbout "About" pos:[253,110] width:37 height:32

on btnApEP pressed do
(
-- Local variables ONLY exist within this event (scope)
local mySpot = [0, 0, 0]

-- Process selection
-- I only changed i to obj to make it more clear we're processing objects
for obj in selection do
(
resetxform obj
collapsestack obj

-- Determine the value of "spot" by the radiobuttons
case rdoXP.state of
(
1:mySpot.x = obj.min.x
2:mySpot.x = obj.center.x
3:mySpot.x = obj.max.x
)
case rdoYP.state of
(
1:mySpot.y = obj.min.y
2:mySpot.y = obj.center.y
3:mySpot.y = obj.max.y
)
case rdoZP.state of
(
1:mySpot.z = obj.min.z
2:mySpot.z = obj.center.z
3:mySpot.z = obj.max.z
)

-- Apply!
obj.pivot = mySpot
obj.pos = [0, 0, 0]
)
)

on btnAbout pressed do
(
messageBox "Created by Matt Rapelje, www.polyleaf.com, matt@polyleaf.com"
)

)

createDialog ExportPrep

I think my modifications are pretty self explanatory, let me know if you need more help ;)

- Martijn

mrapelje
12-23-2004, 08:24 AM
Magicm:

Thank you so much, your comments were really helpful.

One thing though you need a space after the ":" other wise it does not compile.

Thanks again.

CGTalk Moderation
01-20-2006, 06:00 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.