Enums's index of an inputbox return
-
hi,
I was wondering if I could get the index of an enums selection directly.
In my example below, I want to choose between "2D" & "3D" for one variable. The return is either "2D" or "3D". But I want the index number instead, that is "0" for "2D", "1" for "3D".
How could I get the "0" or "1" if I don't compare the return with the list of the enums.
Thanks in advance
Cean
def hw_inputbox iaxi=1 t_iaxi = ["2D","3D"] enums = [t_iaxi.join("|")] values = [t_iaxi[iaxi]] prompts = ["Geo type; "] results = inputbox prompts, values, enums, "my Geo" return nil if not results $iaxi = results[0] your_slection=$iaxi UI.messagebox(your_slection) end UI.menu("Plugins").add_item("hw_inputbox") { hw_inputbox } -
your_selection = t_iaxi.index( results[0] )
-
By the way Cean.. have you downloaded the CHM Reference for Standard Ruby 1.8.6 ??
It's posted here:
http://forums.sketchucation.com/viewtopic.php?f=180&t=10142&p=266725#p266725 -
all good now.
I'll download the ruby book.
Thanks dan.
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better π
Register LoginAdvertisement