SketchUcation Plugin Store

 

 

[Request] Testing on a Mac

Re: [Request] Testing on a Mac

Postby Jim » Sat Jun 20, 2009 6:36 pm

viewtopic.php?f=315&t=19831&st=0&sk=t&sd=a&start=45#p165464

ScottLininger wrote:On the WebDialog topic...

We wrote a somewhat generic bridge between JS and Ruby that we used for Dynamic Components. I learned a lot from that and would have some thoughts on how to build a new one that's truly generic and easy to use. That's almost worthy of its own big thread. ;)

One note: I think it would be work for the JS code side of a bridge to be stored in the ruby and then dumped into the WebDialog via execute_script, so JS code side of things would call something like this:

Code: Select all
window.location.href='skp:initialize_bridge';

...and then from there would have access to whatever JS methods we implement.


It doesn't sound like Google wants to open their code, but Scott says he is willing to help design a better bridge.
Jim
Global Moderator
 
Posts: 4126
Joined: Mon Nov 12, 2007 10:13 pm
Location: NEOH
Name: Jim
Operating system: Windows
SketchUp version: 8
License type: Pro
SketchUp use: other
Level of SketchUp: Intermediate

Re: [Request] Testing on a Mac

Postby chrisglasier » Sun Jun 21, 2009 1:43 am

Thanks for all your help. In the end with the constraints of machinery and time, I decided to resort to the good old 1995 solution:

Start.png


Code: Select all

function start(){

if(navigator.appName == 'Microsoft Internet Explorer') browserStart()

else{

confirmPanel = document.getElementById("confirm")

confirmPanel.innerHTML = "START"  }   }



function receiveSceneCount(x){
count = x    }



function browserStart(){


//TO FIND IF ANY SCENES EXIST

....


function confirmDown(){

switch(confirmPanel.innerHTML){

case "START": browserStart();  break

....






I hope it works but it really doesn't seem right.

Also I think it is wrong to start off a major new excursion into automated interfaces with workarounds! I would really like to find a proper solution. Perhaps the evolution of SKX will help expose it - but I wonder how.

Anyway thanks again for your time; I will let you know what happened tonight tomorrow; I foresee some grief!

Kind regards

Chris
Please, register (free) to access all the attachments on the forums.
User avatar
chrisglasier
 
Posts: 1014
Joined: Tue Jun 03, 2008 9:11 am
Location: Hong Kong/Zhuhai
Name: Chris Glasier
Operating system: Windows
SketchUp version: 8
License type: Free/Make
SketchUp use: other
Level of SketchUp: Intermediate

Re: [Request] Testing on a Mac

Postby thomthom » Sun Jun 21, 2009 9:05 am

hmm... It might be that you try to do changes to the webpage before the DOM is ready. If you do things immediately as the webdialog is loaded you need to wait until all the HTML elements are built.
http://www.javascriptkit.com/dhtmltutors/domready.shtml
Thomas Thomassen — SketchUp Monkey & Coding addict
List of my plugins and link to the CookieWare fund
User avatar
thomthom
Global Moderator
 
Posts: 17925
Joined: Tue Nov 13, 2007 12:47 pm
Location: Trondheim, Norway
Name: Thomas Thomassen
Operating system: Windows
SketchUp version: 2013
License type: Pro
SketchUp use: architecture
Level of SketchUp: Advanced

Re: [Request] Testing on a Mac

Postby chrisglasier » Sun Jun 21, 2009 9:44 am

I think I will look at that deeply if the thing fails tonight because everything now seems to work with a PC; and I have loaded the page into Safari and there are no syntax errors (tested with FF as well) just complaints about skp of course. So I don't want to mess with what exists.

It seems to me this is much the same as loading the active_model business. Anyway thanks for the info. I just hope I don't need to re-jig everything!

Cheers

Chris
User avatar
chrisglasier
 
Posts: 1014
Joined: Tue Jun 03, 2008 9:11 am
Location: Hong Kong/Zhuhai
Name: Chris Glasier
Operating system: Windows
SketchUp version: 8
License type: Free/Make
SketchUp use: other
Level of SketchUp: Intermediate

Re: [Request] Testing on a Mac

Postby fredo6 » Sun Jun 21, 2009 12:58 pm

chrisglasier wrote:Could some kind person(s) have a look at this plugin code? I'm told it does not work on a Mac (I only have a PC). I have gone through all the javascript and transformed all IE only syntax. Perhaps a cursory look at the attached files is enough to expose the cause.

Many thanks

Chris

Chris,

You may just be facing a well-known synchronization issue with web dialogs on Mac. Unlike in Windows/IE, the windows.location callback verb called from HTML does NOT block, so that you continue execute JavaScript. Furthermore, most callbacks will be 'lost', as Sketchup uses only one buffer to communicate with Ruby, not a queue.

See that post: http://forums.sketchucation.com/viewtopic.php?f=180&t=13394&p=101428&hilit=+safari#p98793

You have to do the synchronization manually, which, I agree, is not a piece of cake.

Fredo
User avatar
fredo6
Top SketchUcator
 
Posts: 1727
Joined: Mon Nov 12, 2007 9:07 pm
Operating system: Windows
SketchUp version: 2013
License type: Pro
SketchUp use: interior design
Level of SketchUp: Intermediate

Re: [Request] Testing on a Mac

Postby chrisglasier » Mon Jun 22, 2009 5:47 am

Fredo6 wrote:You may just be facing a well-known synchronization issue with web dialogs on Mac. Unlike in Windows/IE, the windows.location callback verb called from HTML does NOT block, so that you continue execute JavaScript. Furthermore, most callbacks will be 'lost', as Sketchup uses only one buffer to communicate with Ruby, not a queue.


Thanks for replying Fredo. I am afraid I am quite new to Ruby, generally just using the callbacks to instruct SU to do things - "move component[x]" type of thing. I expected some hassle with Mac/PC compatibility but from the post you quoted it seems it is way beyond my ken, and the problems getting access to a Mac are fraught with frustration (as I predicted). I don't even know if the current version doesn't work but I suspect it won't.

You have to do the synchronization manually, which, I agree, is not a piece of cake.


Does this mean I have to make chains of javascript/ruby functions, viz

JS01 call ruby01; ruby01 call JS 02; JS02 call ruby 02 ... until the play is complete.

I have done something like this before with setInterval functions that control a number of different objects with different timing and paths, so if I have interpreted what you say correctly, I feel I would be still in with a chance (British stoicism and all that).

But there is still the problem, common on the forum I now know, of finding Mac owners willing to test. If anyone reading this will volunteer, I promise a mention in dispatches. Here, opportunistically, is the current "best chance" set of files.

cgScenes R1.033(white version with start).zip


Incidentally, Fredo, I did try to press for resolution of this well-known synchronization issue again in this reply to CMD - over optimistically perhaps.

My thanks and regards

Chris
Please, register (free) to access all the attachments on the forums.
User avatar
chrisglasier
 
Posts: 1014
Joined: Tue Jun 03, 2008 9:11 am
Location: Hong Kong/Zhuhai
Name: Chris Glasier
Operating system: Windows
SketchUp version: 8
License type: Free/Make
SketchUp use: other
Level of SketchUp: Intermediate

Re: [Request] Testing on a Mac

Postby chrisglasier » Thu Jun 25, 2009 6:01 am

thomthom wrote:If this Mac testing isn't too urgent I could have a look at it. But I don't have much spare time as I'm working on an architectural project besides work which is due on ~2 weeks. +pluss my involvement in other projects and various beta testings.
But I do have a Mac Mini at home that I've used to debug ruby plugins.


That's kind of you to offer. Considering the obstacles bought up here and in the SFX Bridge topic, I think time becomes subservient to finding some solution (even if temporary). Perhaps it could be lodged in the repository for the benefit of anyone else attempting such similar lunacy with web dialogs and Macs.

Two sets of files are attached. Any original files and directories should be deleted. For the Mac version, I have:

... introduced a START control to deal with the fact there is no Sketchup.active_model when the Ruby scripts are first loaded. This is not a tool or a menu item but I think the effect should be the same.

... rewritten the code so that no window.location call is followed by any javascript statements.

... opened the MAC files in FF and Safari to see if either reported syntax errors.

Opportunistically, I included the PC version which includes the makings of a javascript call - initiated by user action in SU's display and selection observer - as described here. A solution to this too might be a good addition to the SFX web dialog section.

Whilst there is hope I am very willing to rejig things, provided I have guidance, so please let me know what you think.

Double tak*

Chris

* Norwegian for thank you if I remember correctly from my time working with Snohetta
Please, register (free) to access all the attachments on the forums.
User avatar
chrisglasier
 
Posts: 1014
Joined: Tue Jun 03, 2008 9:11 am
Location: Hong Kong/Zhuhai
Name: Chris Glasier
Operating system: Windows
SketchUp version: 8
License type: Free/Make
SketchUp use: other
Level of SketchUp: Intermediate

Re: [Request] Testing on a Mac

Postby thomthom » Thu Jun 25, 2009 7:30 am

Close! :D
Tak = Roof
Takk = Thanks


OT (sorry but you got me curious) what work did you do with Snøhetta?
Thomas Thomassen — SketchUp Monkey & Coding addict
List of my plugins and link to the CookieWare fund
User avatar
thomthom
Global Moderator
 
Posts: 17925
Joined: Tue Nov 13, 2007 12:47 pm
Location: Trondheim, Norway
Name: Thomas Thomassen
Operating system: Windows
SketchUp version: 2013
License type: Pro
SketchUp use: architecture
Level of SketchUp: Advanced

Re: [Request] Testing on a Mac

Postby chrisglasier » Thu Jun 25, 2009 7:46 am

thomthom wrote:Close! :D
Tak = Roof
Takk = Thanks


OT (sorry but you got me curious) what work did you do with Snøhetta?


Alexandria Library (design time schedule and monitoring); also co-authored Atomic Architecture with Craig Dykers, one of the founders ... a long time ago!

Chris

Edit added AA link - now Google is working
User avatar
chrisglasier
 
Posts: 1014
Joined: Tue Jun 03, 2008 9:11 am
Location: Hong Kong/Zhuhai
Name: Chris Glasier
Operating system: Windows
SketchUp version: 8
License type: Free/Make
SketchUp use: other
Level of SketchUp: Intermediate

Re: [Request] Testing on a Mac

Postby TIG » Fri Jun 26, 2009 8:58 am

Can some one with a Mac tell me what they get returned when they use this snippet in the Ruby Console...
Code: Select all
ENV["TEMP"]
Is it 'nil' or a 'path_to_the_temp_folder' ?
Also with
Code: Select all
ENV["TMP"]
ditto ...
Also a Mac whole ENV listing, got thus...
Code: Select all
ENV.sort
would be helpful.
TIG
User avatar
TIG
Global Moderator
 
Posts: 14313
Joined: Mon Nov 12, 2007 7:24 pm
Location: Northumbria UK
Name: TIG
Operating system: Windows
SketchUp version: 2013
License type: Pro
SketchUp use: architecture
Level of SketchUp: Advanced

Re: [Request] Testing on a Mac

Postby tbd » Fri Jun 26, 2009 9:55 am

Code: Select all
ENV["TEMP"]
=> nil


Code: Select all
ENV["TMP"]
=>nil


Code: Select all
ENV.sort
=> [["COMMAND_MODE", "legacy"], ["DISPLAY", "/tmp/launch-jGxAIU/:0"], ["HOME", "/Users/TBD"], ["LOGNAME", "TBD"], ["PATH", "/usr/bin:/bin:/usr/sbin:/sbin"], ["PYTHONPATH", "/Applications/Quick Search Box.app/Contents/Frameworks/Vermilion.framework/Resources"], ["SHELL", "/bin/bash"], ["SSH_AUTH_SOCK", "/tmp/launch-4hMGhW/Listeners"], ["TMPDIR", "/var/folders/oo/oofmaDN7HfGByvhOdkcyck+++TI/-Tmp-/"], ["USER", "TBD"], ["__CF_USER_TEXT_ENCODING", "0x1F5:0:0"]]
SketchUp Ruby Consultant | Podium 1.x developer
http://plugins.ro
User avatar
tbd
 
Posts: 1018
Joined: Wed Nov 14, 2007 10:47 am
Location: Romania
Name: TBD

Re: [Request] Testing on a Mac

Postby TIG » Fri Jun 26, 2009 9:58 am

Thanks TBD, so your temp folder is called "TMPDIR" :D
TIG
User avatar
TIG
Global Moderator
 
Posts: 14313
Joined: Mon Nov 12, 2007 7:24 pm
Location: Northumbria UK
Name: TIG
Operating system: Windows
SketchUp version: 2013
License type: Pro
SketchUp use: architecture
Level of SketchUp: Advanced

SketchUcation One-Liner Adverts

by Ad Machine » 5 minutes ago

Keyframe Animation plugin - animate your SketchUp model by adding movement to any object.

Premium Members get 20% discount!

Ad Machine
Robot
 
Posts: 2012


Return to Plugins

Who is online

Users browsing this forum: alibaloc, Dave R, horskz, Ton Baeten, vicspa, ville_, yamanokuchi and 10 guests