• Login
sketchucation logo sketchucation
  • Login
🤑 SketchPlus 1.3 | 44 Tools for $15 until June 20th Buy Now

Help web dialog or buttons ruby

Scheduled Pinned Locked Moved Extensions & Applications Discussions
extensions
9 Posts 4 Posters 1.1k Views 4 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.
  • R Offline
    rodney1717
    last edited by 26 Jan 2015, 21:40

    Hi Guys

    I am trying to develop a simple plugin that does simple calculations and then use the output generated numbers to draw structural members. I am decent with excel and VBA. Ruby I sort of get it when I read it, but I cant create buttons or a GUI to insert input. I do really need help starting. I could buy someone who helps me out a drink. Please help.

    1 Reply Last reply Reply Quote 0
    • J Offline
      jiminy-billy-bob
      last edited by 26 Jan 2015, 22:00

      Default SU dialog boxes :
      http://www.sketchup.com/intl/en/developer/docs/ourdoc/ui#inputbox
      http://www.sketchup.com/intl/en/developer/docs/ourdoc/ui#messagebox

      Another alternative that simplifies the usage of webdialogs (you only need to wirte ruby code) :
      http://www.thomthom.net/thoughts/2013/07/skui-a-gui-framework-for-sketchup/

      25% off Skatter for SketchUcation Premium Members

      1 Reply Last reply Reply Quote 0
      • R Offline
        rodney1717
        last edited by 26 Jan 2015, 22:13

        Thanks for the links I have never used input box. I tried using Skui on sketch up ver.13 last year and I struggled passing variables into the objects inside Skui ie, buttons. I used to be able to see the code of most of the plugins in previous versions of sketch up, but the 2015 version I can't even see where most of the plugins are located. A few are in the IPCplugins folder.

        Would it be possible to have an example using input box UI to draw a cube, lets say I want to multiply two variables to get a dimension

        For example
        z x y = w
        where w = width

        b x e = h
        Where h= height

        e x f = d
        where d=depth

        1 Reply Last reply Reply Quote 0
        • R Offline
          rodney1717
          last edited by 26 Jan 2015, 22:21

          @jiminy-billy-bob said:

          Default SU dialog boxes :
          http://www.sketchup.com/intl/en/developer/docs/ourdoc/ui#inputbox
          http://www.sketchup.com/intl/en/developer/docs/ourdoc/ui#messagebox

          Another alternative that simplifies the usage of webdialogs (you only need to wirte ruby code) :
          http://www.thomthom.net/thoughts/2013/07/skui-a-gui-framework-for-sketchup/

          Thanks very much for the links. It would be great if get my head around using text boxes and find ways to have several input boxes on one menu or panel. I have had a look at Skui before and I couldnt pass my variables into the objects in SKui, i.e buttons.

          If possible could you or anyone show an example with textboxes that to calculate dimensions of a box.

          i.e.

          z x y = w
          where w is the width of the box

          q x m = l
          where q is the lenght of the box
          r x t = h
          where h is the height of the box.

          Thanks in advance.

          1 Reply Last reply Reply Quote 0
          • D Offline
            driven
            last edited by 26 Jan 2015, 23:18

                  prompts = ["Width", "Height"]
                 defaults = ['x,y,z', 'a,b,c']
                 input = UI.inputbox(prompts, defaults, "Enter Width and Height?")
            
            

            try it, and fill in your profile so we at least know what OS your on...

            john

            learn from the mistakes of others, you may not live long enough to make them all yourself...

            1 Reply Last reply Reply Quote 0
            • R Offline
              rodney1717
              last edited by 27 Jan 2015, 22:07

              @driven said:

                    prompts = ["Width", "Height"]
              >      defaults = ['x,y,z', 'a,b,c']
              >      input = UI.inputbox(prompts, defaults, "Enter Width and Height?")
              > 
              

              try it, and fill in your profile so we at least know what OS your on...

              john

              Thanks John. I will try it out. The whole day i never had chance to test anything. My os is a windows 7 ultimate.

              1 Reply Last reply Reply Quote 0
              • S Offline
                sdmitch
                last edited by 28 Jan 2015, 04:13

                @rodney1717 said:

                Thanks for the links I have never used input box. I tried using Skui on sketch up ver.13 last year and I struggled passing variables into the objects inside Skui ie, buttons. I used to be able to see the code of most of the plugins in previous versions of sketch up, but the 2015 version I can't even see where most of the plugins are located. A few are in the IPCplugins folder.

                Would it be possible to have an example using input box UI to draw a cube, lets say I want to multiply two variables to get a dimension

                For example
                z x y = w
                where w = width

                b x e = h
                Where h= height

                e x f = d
                where d=depth

                mod = Sketchup.active_model
                ent = mod.active_entities
                sel = mod.selection
                prompts = ["Width=(Z*Y)","Length=(G*M)","Height=(R*T)"]
                defaults = ['1*2','3*4','5*6']
                input = UI.inputbox(prompts, defaults, "Enter Width,Length,Height?")
                if input
                 width=eval(input[0]);
                 length=eval(input[1]);
                 height=eval(input[2])
                 p0=[0,0,0];p1=[0,length,0];p2=[width,length,0];p3=[width,0,0]
                 f=ent.add_face(p0,p1,p2,p3);f.pushpull -height
                end
                

                Nothing is worthless, it can always be used as a bad example.

                http://sdmitch.blogspot.com/

                1 Reply Last reply Reply Quote 0
                • R Offline
                  rodney1717
                  last edited by 4 Feb 2015, 16:35

                  Thank you guys. I have experimented with the code. And so far I have two plugins which I have attached. What I want to do is perform simple structural calculations of simple beams, columns and frames and generate an html report.

                  The first r.b file the beamdesign.rb, it draws a section and gives you options on certain design parameters of a beam. It creates a menu under the plugins tab. This sort of works,

                  The second r.b file drawbox.rb I want the user to draw a line/path then the program will execute addface and followme methods to draw a beam on the path. However when I run the drawbox,rb I dont get the beam with the defined length of some reason. Can anyone please help with the Inputpoint.view method in conjuction with a follow.me method. This plugin is not working.

                  Also if there are structural engineers out there who want to team up and develop a series of plugins to draw, calculate and document designs, please feel free to help. I am a nub but I am willing to devote a good chunk of my time to learn ruby. Thanks for the help so far, It did make a big difference.


                  beam design.rb


                  drawbox2.rb

                  1 Reply Last reply Reply Quote 0
                  • S Offline
                    sdmitch
                    last edited by 4 Feb 2015, 19:02

                    @rodney1717 said:

                    The first r.b file the beamdesign.rb, it draws a section and gives you options on certain design parameters of a beam. It creates a menu under the plugins tab. This sort of works,

                    I would use actual values for the defaults instead of the letters in case the user fails to enter all values and add a "if results" statement following the inputbox statement incase the user clicks Cancel.

                    The second r.b file drawbox.rb I want the user to draw a line/path then the program will execute addface and followme methods to draw a beam on the path. However when I run the drawbox,rb I dont get the beam with the defined length of some reason. Can anyone please help with the Inputpoint.view method in conjuction with a follow.me method. This plugin is not working.

                    this plugin had several coding errors which caused it to fail. I have made the necessary corrections plus others that made more sense to me.


                    drawbox2.rb

                    Nothing is worthless, it can always be used as a bad example.

                    http://sdmitch.blogspot.com/

                    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