16 posts • Page 1 of 1
I am trying to write a plugin that can control Sketchup objects from a web dialog that is on a website, not a local HTML file.
I see from this video, http://www.youtube.com/watch?v=FALvwBN5 ... re=related (If you fast forward to 6:08) that you can grab data off of a website and render it in Sketchup....
Does anyone out there have a sample of this code? I'd like to see it in action... I have searched for that plugin that Scott demonstrated on there, but I can't seem to find it...
I just wanted to point out the engineering toolbox page does something similar.
They have a minimal ruby plugin that is installed, which opens a WebDialog poited to their server.
Then, they send some Ruby code to the dialog, and 'eval' it; but that is only one way to do it. You could have all of your callbacks defined in the plugin, for example.
View the source code of the plugin, and the source of one of the HTML pages to see how it works.
So I checked that out, its a pretty neat web page.
In some of the models, you can configure options of the model right on the web page, and then insert it into Sketchup, pre-configured.
There is a Javaspript that runs when you configure the model.
I am confused when the actual configuring happens though.... Does the user configure the model, then the model gets sent to Sketchup, where Sketchup then receives the configuration choices from the script, the changes are made, and then the model is dropped in? (That is a long sentence, and my only guess!)
Anyone else have any insights? I am just learning Ruby, and I have just about zero Java experience.
If you edit their plugin and add the line just before the eval statement
Open the Ruby Console to see the Ruby code that the site is sending, and their plugin is eval'ing.
So that's what I get in the Ruby console.
Where would I go to learn how to get Java to talk to ruby? I think if I see it in its most basic example, I could build from there...
PS I'm interested in doing this remotely as well
Ok, so here's what I have up and running..........
http://sketchupapi.blogspot.com/2008/02 ... y-and.html
What I am a little fuzzy on here is how that "refresh" button actually sends the command to Ruby. I see part of the command in the HTML file, but I am not sure exactly how it works....
I would assume that somehow the command is created by variables being pieced together, eventually creating a command, based on user input.
I think if I could just understand how the command is created in the HTML file, I could then create buttons that could do anything that I want in the web dialog....
What I am fuzzy on is what you have done and really what you want to do. This is mainly because youTube and blogSpot are not available in China right now. But anyway in the forums posters normally post their code or whatever directly in the post using links for backup; this makes it easier to respond to requests.
I don't know if you are referring to my refresh function; it refreshes the web dialog content after the cursor returns from the SU display. The parts that are relevant are:
Then of course there's rotations.
It all can get a little fraught but then what we are both (I think) trying to achieve is novel (i.e. not openly technically supported, and not only about finding technical solutions).
I believe this to be true and a solid base for Sketchup to become as normal part of daily work as word processing has been.
Write some more if I have read you right.
Please, register (free) to access all the attachments on the forums.
I think you are on the right track here....
Let me outline what exactly I am trying to do, and what I have learned so far...
What I want is a simple Ruby script that loads a web page right in Sketchup. I've got that worked out already....
I want models to be available on the web page.
I want the user to be able to set options on the models.
After the user has set options, they can insert the model into their model.
I also want the web page to be able to gather information about the model (like part counts, materials, stuff like that)
What I would like to do is build this in its most basic form. Say a webpage with one model, with one option that can be configured, and work from there. I just don't have the technical knowledge to get even that basic example started. Once I get that, I should really be able to get a handle on things and start to build it out...
OK let me come back to the detail after you have watched this short video. You could let me know if it works (I cannot see it from here) but more importantly whether the part about selecting SU versions of models from remote sites and manipulating them is closer to your concept. Tell me which parts differ. I think this is less confusing.
maybe this can be interesting for you:
besides that, i don't know if it is possible to load a php instead of a html file in a webdialog?
This is basically the functionality I am trying to duplicate.....
The example you cited from the SketchUp Blog has everything you need.
In the html of the WebDialog there is a button:
callRuby shows how to pass a value from the WebDialog to the SketchUp plugin that created the dialog. The Ruby script needs a callback named 'get_data'.
window.location = 'skp:get_data@' + data;
Hope that helps a little.
16 posts • Page 1 of 1