sketchucation logo sketchucation
    • Login
    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

    Scheduled Pinned Locked Moved Developers' Forum
    4 Posts 2 Posters 332 Views 2 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • S Offline
      shirazbj
      last edited by

      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 }
      
      1 Reply Last reply Reply Quote 0
      • Dan RathbunD Offline
        Dan Rathbun
        last edited by


        your_selection = t_iaxi.index( results[0] )


        I'm not here much anymore.

        1 Reply Last reply Reply Quote 0
        • Dan RathbunD Offline
          Dan Rathbun
          last edited by

          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

          I'm not here much anymore.

          1 Reply Last reply Reply Quote 0
          • S Offline
            shirazbj
            last edited by

            all good now.

            I'll download the ruby book.

            Thanks dan.

            1 Reply Last reply Reply Quote 0
            • 1 / 1
            • First post
              Last post
            Buy SketchPlus
            Buy SUbD
            Buy WrapR
            Buy eBook
            Buy Modelur
            Buy Vertex Tools
            Buy SketchCuisine
            Buy FormFonts

            Advertisement