Help web dialog or buttons ruby
-
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.
-
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#messageboxAnother 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 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 = widthb x e = h
Where h= heighte x f = d
where d=depth -
@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#messageboxAnother 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 boxq 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.
-
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
-
@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.
-
@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 = widthb x e = h
Where h= heighte x f = d
where d=depthmod = 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
-
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.
-
@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.
Advertisement