sketchucation logo sketchucation
    • Login
    ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info

    WebDialogs - The Lost Manual — R1 09 November 2009

    Scheduled Pinned Locked Moved Developers' Forum
    43 Posts 13 Posters 22.1k Views 13 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.
    • chrisglasierC Offline
      chrisglasier
      last edited by

      @unknownuser said:

      Finally, there is a difference in the way that the Mac boots up SketchUp that you should be cautious about: there is no Sketchup.active_model when the Ruby scripts are first loaded. So if your script is making changes to the active_model at load time, it will not work on the Mac. The answer? Ensure code that references the active model is part of a UI event handler, responding to the user selecting a tool or a menu item. You can also use an AppObserver to get a callback whenever a new model is opened, at which point it's safe to talk to the active_model.

      I didn't see this anywhere. I don't remember where it comes from.

      How about marking topics and posts with [WebDialog]?

      Good work - most generous with your time.

      Chris

      With TBA interfaces we can analyse what is to be achieved so that IT can help with automation to achieve it.

      1 Reply Last reply Reply Quote 0
      • thomthomT Offline
        thomthom
        last edited by

        I hope that people will point out things that are not clear. Writing has never been my strongest skill, actually - its one of my poor, so please point out the weaknesses.

        Thomas Thomassen — SketchUp Monkey & Coding addict
        List of my plugins and link to the CookieWare fund

        1 Reply Last reply Reply Quote 0
        • T Offline
          tomasz
          last edited by

          Thank you!

          Author of [Thea Render for SketchUp](http://www.thearender.com/sketchup)

          1 Reply Last reply Reply Quote 0
          • J Offline
            Jernej Vidmar
            last edited by

            Hi Thom,

            thanks for sharing this really usefull information!

            Just as a side note:
            We have found a bug, which cuts decimal value sent from SketchUp to WebDialog (only in SU6 on Mac). If we i.e. want to update the value of some input box like this:
            web_dialog.execute_script("updateInputBox('varName', '12,345')")
            only 12 is shown in the varnName inputbox, everything behind (and including) comma is being cut off. But it works in SU7 on Mac and on both, 6 and 7 versions of SU on Windows.

            1 Reply Last reply Reply Quote 0
            • thomthomT Offline
              thomthom
              last edited by

              Ah, is that whatæs being mentioned in the release notes: http://code.google.com/apis/sketchup/docs/releases.html

              @unknownuser said:

              Fixed Mac support for WebDialogs execute_script

              WebDialog.execute_script('alert("Bug is Fixed!")');
              

              Does it work if you escape the comma? If not, replace it with another character?

              Thomas Thomassen — SketchUp Monkey & Coding addict
              List of my plugins and link to the CookieWare fund

              1 Reply Last reply Reply Quote 0
              • J Offline
                Jernej Vidmar
                last edited by

                No, escaping doesn't seem to help. Only way to pass the float value is to write it using dot (1.12) not comma (1,12)...
                For now we have not found a workaround, but we intend to make some more tests to see if the problem can be bypassed.

                1 Reply Last reply Reply Quote 0
                • thomthomT Offline
                  thomthom
                  last edited by

                  I wonder, if you make a special receiving javascript function, and send all command base64 encoded to that function and have it decode and eval it..?

                  
                  # made up methods - haven't checked the real methods
                  jscall = base64encode("updateInputBox('varName', '12,345')") 
                  WebDialog.execute_script("decode(#{jscall})");
                  
                  
                  
                  function decode(base64str)
                    eval(decode64(base64str));
                  end
                  
                  

                  Thomas Thomassen — SketchUp Monkey & Coding addict
                  List of my plugins and link to the CookieWare fund

                  1 Reply Last reply Reply Quote 0
                  • D Offline
                    DIEGO-RODRIGUEZ
                    last edited by

                    interesting applications for html

                    html 5
                    http://html5demos.com/

                    and

                    Link Preview Image
                    www.dhtmlgoodies.com has expired

                    favicon

                    (www.dhtmlgoodies.com)

                    1 Reply Last reply Reply Quote 0
                    • thomthomT Offline
                      thomthom
                      last edited by

                      You won't be able to use HTML5 in webdialogs - not until IE adds support for it. Think I read somewhere that they where adding support for it in IE9. Being able to use CANVAS sure would be nice.

                      Thomas Thomassen — SketchUp Monkey & Coding addict
                      List of my plugins and link to the CookieWare fund

                      1 Reply Last reply Reply Quote 0
                      • T Offline
                        tbleicher
                        last edited by

                        @thomthom said:

                        You won't be able to use HTML5 in webdialogs - not until IE adds support for it.

                        I am using excanvas http://code.google.com/p/explorercanvas/ which provides a canvas object in IE.

                        Thomas

                        1 Reply Last reply Reply Quote 0
                        • thomthomT Offline
                          thomthom
                          last edited by

                          @tbleicher said:

                          @thomthom said:

                          You won't be able to use HTML5 in webdialogs - not until IE adds support for it.

                          I am using excanvas http://code.google.com/p/explorercanvas/ which provides a canvas object in IE.

                          Thomas

                          That's very interesting! I've been wanting for a good solution to dynamically draw graphics in webdialogs. Probably be of interest for Whaat as well... ...thinking Profile Builder...

                          Thomas Thomassen — SketchUp Monkey & Coding addict
                          List of my plugins and link to the CookieWare fund

                          1 Reply Last reply Reply Quote 0
                          • J Offline
                            Jim
                            last edited by

                            And just to have more options, there is also chrome frame.

                            Hi

                            1 Reply Last reply Reply Quote 0
                            • thomthomT Offline
                              thomthom
                              last edited by

                              @jim said:

                              And just to have more options, there is also chrome frame.

                              Yea, but this requires the user to install a browser plugin.
                              explorercanvas is a simple JS library which the developer includes in the project without the user ever having to install any browser extension. That's what's appeal to me.

                              Thomas Thomassen — SketchUp Monkey & Coding addict
                              List of my plugins and link to the CookieWare fund

                              1 Reply Last reply Reply Quote 0
                              • P Offline
                                Pout
                                last edited by

                                this seems to be very interesting
                                Have to dig into this.

                                1 Reply Last reply Reply Quote 0
                                • chrisglasierC Offline
                                  chrisglasier
                                  last edited by

                                  One thing driven discovered was that if for some reason there is whitespace as here -

                                  cmd = "fImportReturn('#{array}');"
                                  @dlg.execute_script (cmd)
                                  
                                  instead of
                                  
                                  @dlg.execute_script(cmd)
                                  
                                  
                                  

                                  it is OK on PCs but not Macs. This maybe of interest to coders who use this style (Jim).

                                  With TBA interfaces we can analyse what is to be achieved so that IT can help with automation to achieve it.

                                  1 Reply Last reply Reply Quote 0
                                  • J Offline
                                    Jim
                                    last edited by

                                    Would a kind Mac user (or 2) open the Ruby Console, and give the result from entering:

                                    $VERBOSE

                                    and

                                    $DEBUG

                                    and

                                    $-w

                                    Hi

                                    1 Reply Last reply Reply Quote 0
                                    • thomthomT Offline
                                      thomthom
                                      last edited by

                                      @jim said:

                                      Would a kind Mac user (or 2) open the Ruby Console, and give the result from entering:

                                      $VERBOSE

                                      and

                                      $DEBUG

                                      and

                                      $-w

                                      
                                      > $VERBOSE
                                      false
                                      > $DEBUG
                                      false
                                      > $-w
                                      false
                                      
                                      

                                      SU 7.1.6859
                                      OSX 10.4

                                      Thomas Thomassen — SketchUp Monkey & Coding addict
                                      List of my plugins and link to the CookieWare fund

                                      1 Reply Last reply Reply Quote 0
                                      • Dan RathbunD Offline
                                        Dan Rathbun
                                        last edited by

                                        By the way.. we have no control over C-implemented Ruby objects, that incorrectly call the wrong C 'warn'/'warning' function, ie: don't respond to the setting of $VERBOSE ( called ruby_verbose in C.)

                                        If you find one, it would need to be reported on RubyForge.net

                                        I'm not here much anymore.

                                        1 Reply Last reply Reply Quote 0
                                        • chrisglasierC Offline
                                          chrisglasier
                                          last edited by

                                          @mmyoung said:

                                          I was never able to get Matt666's PointTool.rb to work on my Mac. I opened it in a text editor and removed the "=begin" and "=end" lines at the beginning and placed a "#" at the beginning of each comment.

                                          Now it runs on Mac.

                                          This may be relevant here as well.

                                          With TBA interfaces we can analyse what is to be achieved so that IT can help with automation to achieve it.

                                          1 Reply Last reply Reply Quote 0
                                          • D Offline
                                            driven
                                            last edited by

                                            @chrisglasier said:

                                            This may be relevant here as well.

                                            hi,
                                            some Mac bits...

                                            @Jim I get false, false, false

                                            @Dan #!ruby warn_ovr.rb returns nil

                                            whitespace handling is strange, not consistent from script to script, some work with whitespace , but all work without it...

                                            the =begin; =end seems to be dependent on what editor the file was last saved in....

                                            I never had a problem if I had a look with xCode, but when I first used Smultron the syntax colouring for '=' commenting is off by default, and very oddly appears to effect how SU then sees some of the files saved from this state...

                                            It took a while to figure out, but all affected files worked after changing the syntax colouring option to on and re-saving. Re-saving from xCode also 'fixed' them, which was my only 'clue' of what was happening.

                                            Something that came up proof positive last week (and I'm trying to find a test for), is that not all Macs are handle syntax the same

                                            there was an issue with one of TIG's scripts and it seems that Mac's running Developer Tools have much stricter syntax prerequisite.

                                            I did a mini survey of systems 'failing' and we all had different mixes of OSX, Ruby, Gems, editors but all had DevTools

                                            a Variety of Macs without were fine but those with Xcode were failing to run the script, TIG found a solution for his script, but the consistency of the Pass/Fail leads me to think it may make a good test tool... when I know how...

                                            On another point anyone know of a .json to/from .skp or collada convertor for Mac?

                                            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
                                            • 1
                                            • 2
                                            • 3
                                            • 3 / 3
                                            • First post
                                              Last post
                                            Buy SketchPlus
                                            Buy SUbD
                                            Buy WrapR
                                            Buy eBook
                                            Buy Modelur
                                            Buy Vertex Tools
                                            Buy SketchCuisine
                                            Buy FormFonts

                                            Advertisement