Localhost in webdialog - bridge to everywhere?
-
I have to say I got pretty disillusioned with webdialogs. I thought I would try a different route by first making a web machine to automate and reuse information and then look for a way to generate 3D models. In doing so I belated discovered localhost (with Apache and PHP). All my stuff is based on generating instructions from plain text (json) records; these instructions link to script devices (the simplest to produce listings). The localhost easily copes with reading and writing files, works with any browser and most importantly does not have to have Sketchup present.
Just today I wondered what would happen if I opened the localhost in a webdialog. Surprisingly (to me) the localhost worked just as before. I closed Sketchup and added a link in the localhost to a .skp file in the same directory. Clicking on the link launched Sketchup and opened the file. I also added a simple skp:callback which worked OK once I had opened the webdialog from the plugins menus.
It would be good if when the file is opened it could also open the webdialog. The file is really just a space to lay out components so it does not have to be saved. There are questions about having two instances of the localhost on screen and what happens when Sketchup is closed (can a Ruby launch the standalone localhost?)
I guess there are many if and buts but I very much like the idea of having a universal interface that can call up Sketchup as a kind of plugin and then transform iself into a plug in to Sketchup. So I think it is worth pursuing.
edit: 'adjusted' subject may 12 2011
-
What's exactly the question?
http://localhost/ is just an alias for http://127.0.0.1/ - when WAMP/LAMP/*AMP is installed it makes localhost act just the same as any other website...
-
@thomthom said:
What's exactly the question?
http://localhost/ is just an alias for http://127.0.0.1/ - when WAMP/LAMP/*AMP is installed it makes localhost act just the same as any other website...
My point is that if you use localhost rather than a local file (file.html) you can work outside SU locally (and via a server I guess) and then plug SU in as and when required. I didn't ask any direct question but was rather hoping for some discussion of the points in the penultimate para:-
@unknownuser said:
It would be good if when the file is opened it could also open the webdialog. The file is really just a space to lay out components so it does not have to be saved. There are questions about having two instances of the localhost on screen and what happens when Sketchup is closed (can a Ruby launch the standalone localhost?)
-
hi Chris,
hope your well, local host is great on the mac.
You can run it in custom webveiws that have can more local privileges than WebDialog.I've played round with it using node.js and chrome V8 serving json into SU.
The other avenue for your stuff is to combine 'local hosted' webdialogs with html5 local and session storage.
I've been trying to get sceneMachineMac to store a Template skp that opens 'selected' from my model in a new 'temporary' drawing for setting up an export animation.
I know there are SU ruby ways of achieving what I'm doing but they can bog down on large models so this is an attempt to move some of the load to other processes on my system. It seems promising
BTW. how the website going?
john
-
@chrisglasier said:
My point is that if you use localhost rather than a local file (file.html) you can work outside SU locally (and via a server I guess) and then plug SU in as and when required. I didn't ask any direct question but was rather hoping for some discussion of the points in the penultimate para:-
@unknownuser said:
It would be good if when the file is opened it could also open the webdialog. The file is really just a space to lay out components so it does not have to be saved. There are questions about having two instances of the localhost on screen and what happens when Sketchup is closed (can a Ruby launch the standalone localhost?)
Open standalone localhost - open the URL in a normal web browser?
UI.open_url
http://code.google.com/apis/sketchup/docs/ourdoc/ui.html#openURL -
-
@thomthom said:
Open standalone localhost - open the URL in a normal web browser?
UI.open_url
http://code.google.com/apis/sketchup/docs/ourdoc/ui.html#openURLThat's great thanks
-
Now I have got to the stage where I can pop my freestanding php file into a web dialog but so I can run Sketchup either via my localhost or website I need to have a ruby version of this php:
class IP{ public function Iptrue() { if ($_SERVER['REMOTE_ADDR'] == "127.0.0.1"){ echo true; } } }
Can this be done with Sketchup ruby API?
Thanks
Thanks
Advertisement