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

    Load_from_url

    Scheduled Pinned Locked Moved Developers' Forum
    22 Posts 4 Posters 666 Views 4 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.
    • thomthomT Offline
      thomthom
      last edited by

      The URL is misformed because of escape characters?

      Just guessing here. Got more info? Example etc?

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

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

        Made a small test:

        First to a non-existsing URL:
        model.definitions.load_from_url( 'http://www.thomthom.net/foo.skp' ) Error: #<IOError: (eval):155:inload_from_url': Invalid component URL>
        (eval):155
        (eval):155`

        Then to an existing URL:
        model.definitions.load_from_url( 'http://www.thomthom.net/bar.skp' ) #<Sketchup::ComponentDefinition:0xfcdf7bc>

        So it looks like your URL is simply wrong. Remember that URL's some times need special characters - for instance spaces are translated to %20 etc.

        If the URL fixed? Or is it generated? If it's generated - have you outputted it for inspection? Have you tried the same URL in a browser?

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

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

          @thomthom said:

          Made a small test:

          First to a non-existsing URL:
          model.definitions.load_from_url( 'http://www.thomthom.net/foo.skp' ) Error: #<IOError: (eval):155:inload_from_url': Invalid component URL>
          (eval):155
          (eval):155`

          Then to an existing URL:
          model.definitions.load_from_url( 'http://www.thomthom.net/bar.skp' ) #<Sketchup::ComponentDefinition:0xfcdf7bc>

          So it looks like your URL is simply wrong. Remember that URL's some times need special characters - for instance spaces are translated to %20 etc.

          If the URL fixed? Or is it generated? If it's generated - have you outputted it for inspection? Have you tried the same URL in a browser?

          Thanks for doing that.

          Have attached bridge.rb.

          Will do some more url sleuthing.


          bridge.zip

          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

            How do you trigger the "product" callback?

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

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

              I somehow managed to trigger it - clicking on "Kitchen".

              Output I got was this:

              true "Kitchen,0,0,0" "Kitchen.skp" "http://glasier.hk/Product/Kitchen.skp" Error: #<IOError: Invalid component URL> c:/Users/thm.ARC/Desktop/bridge/bridge.rb:68:inload_from_url'
              c:/Users/thm.ARC/Desktop/bridge/bridge.rb:68:in start'

              When I type http://glasier.hk/Product/Kitchen.skp into my browser I get a 404. So the problem is that your URLs leads to non-existing resources.

              404.png

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

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

                @thomthom said:

                How do you trigger the "product" callback?

                function suStart(node){
                	var fn, params;
                	fn = nset[node].Label; //WC in trial
                	params = [fn,0,0,0].toString();
                	window.location = "skp;product@" + params;
                }
                

                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
                • chrisglasierC Offline
                  chrisglasier
                  last edited by

                  @thomthom said:

                  ...

                  When I type http://glasier.hk/Product/Kitchen.skp into my browser I get a 404. So the problem is that your URLs leads to non-existing resources.


                  Wc skp prob.png

                  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
                  • chrisglasierC Offline
                    chrisglasier
                    last edited by

                    Also ...


                    Wc skp prob2.png


                    Wc skp prob3.png

                    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

                      It's your server configuration you need to address. Not your plugin.

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

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

                        @thomthom said:

                        It's your server configuration you need to address. Not your plugin.

                        Beyond my ken!

                        Anything like dialog.allow_actions_from_host(url)?

                        If not what does that do?

                        Any more help much appreciated!

                        Thanks

                        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

                          @chrisglasier said:

                          Anything like dialog.allow_actions_from_host(url)?

                          It's nothing related to SketchUp. As you can see - you cannot even access the files from a web browser. Don't know what you have to do because it all depend on what type of server and configuration you have.

                          @chrisglasier said:

                          If not what does that do?

                          webdialog.allow_actions_from_host(url) is allowing websites to send commands to SketchUp, via window.location = "skp:command@params"; type of commands.

                          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

                            Chris if it's a UNIX server, you would need to have the file permissions set correctly using chmod.

                            I'm not here much anymore.

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

                              Thanks T & D.

                              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
                              • chrisglasierC Offline
                                chrisglasier
                                last edited by

                                I put skp files into a zip file which I manually download and extract to a subdirectory named in bridge.rb. I can then open each component in its location.

                                Do you think it possible to automate the downloads and their extraction into a named folder? I have searched but have difficulty getting to grips with the results.

                                If I could do that then I could demonstrate the benefits of collecting skps and json data from multiple trusted/vetted sources. If required complex js/php analysis of the data to set design criteria for example could be done say in Chrome browser before the url is plopped into the web dialog to see what the various options look like.

                                Please bear with me!

                                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
                                • Dan RathbunD Offline
                                  Dan Rathbun
                                  last edited by

                                  @chrisglasier said:

                                  Do you think it possible to automate the downloads and their extraction into a named folder?

                                  Well the new rbz interface will do this. The "subfolder" must be wrapped inside the zip, and currently will only end up beneath the "plugins" dir. (Google has not yet given us the option to have the extraction go someplace else.)

                                  The other option is that if a user has a full Ruby install, the standard Ruby lib Zlib can be used to extract from several different archive formats.
                                  Then Ruby also has some other file moving modules, as well as the Dir class.

                                  Another option is to use platform dependent shell commands (backtick delimited, or %x delimited strings.)

                                  I'm not here much anymore.

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

                                    @dan rathbun said:

                                    @chrisglasier said:

                                    Do you think it possible to automate the downloads and their extraction into a named folder?

                                    Well the new rbz interface will do this. The "subfolder" must be wrapped inside the zip, and currently will only end up beneath the "plugins" dir. (Google has not yet given us the option to have the extraction go someplace else.)

                                    Thanks but I am not sure I understand how this automates the extraction to the plug in folder. It seems you have to click the install button in extensions?

                                    I was thinking to click a js link in my url (standalone or in wd) to pick up a plain zip file from any trusted url and extract it into one or more named local folders. Dreaming perhaps!

                                    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
                                    • TIGT Offline
                                      TIG Moderator
                                      last edited by

                                      There are new API methods with the latest v8M2 to extract files/subfolders [into Plugins] from zip/rbz files.
                                      However, if you already have ways of extracting them, then the moving to their new locations can be done with vanilla Ruby Dir and File commands...

                                      TIG

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

                                        @chrisglasier said:

                                        Thanks but I am not sure I understand how this automates the extraction to the plug in folder. It seems you have to click the install button in extensions?

                                        see: Sketchup.install_from_archive

                                        👊 (because we have no "slappin' ya' upside da' head" emoticon)

                                        @chrisglasier said:

                                        I was thinking to click a js link in my url (standalone or in wd) to pick up a plain zip file from any trusted url and extract it into one or more named local folders. Dreaming perhaps!

                                        Your link or html button can execute a callback to Ruby that does the install, moves files around etc.

                                        I'm not here much anymore.

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

                                          @tig said:

                                          There are new API methods with the latest v8M2 to extract files/subfolders [into Plugins] from zip/rbz files.
                                          However, if you already have ways of extracting them, then the moving to their new locations can be done with vanilla Ruby Dir and File commands...

                                          Or the extended library FileUtils

                                          FYI.. there is a Pure Ruby (beta) edition of the Zlib library that is cross-platfrom (no need to deal with compiled so/dll, Ruby version, compiler versions, etc. etc.) It is by Park Heesob (who is involved with Daniel Berger's win32-api project.)

                                          I'm not here much anymore.

                                          1 Reply Last reply Reply Quote 0
                                          • 1
                                          • 2
                                          • 1 / 2
                                          • First post
                                            Last post
                                          Buy SketchPlus
                                          Buy SUbD
                                          Buy WrapR
                                          Buy eBook
                                          Buy Modelur
                                          Buy Vertex Tools
                                          Buy SketchCuisine
                                          Buy FormFonts

                                          Advertisement