Oops, your profile's looking a bit empty! To help us tailor your experience, please fill in key details like your SketchUp version, skill level, operating system, and more. Update and save your info on your profile page today!
🛣️ Road Profile Builder | Generate roads, curbs and pavements easily Download
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.
Advertisement