sketchucation logo sketchucation
    • Login
    πŸ€‘ SketchPlus 1.3 | 44 Tools for $15 until June 20th Buy Now

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

      I have a url sitting in a webdialog. It makes a call to a callback to get a component file from a url. This works testing using localhost/subdir for skp file but not using the subdir in the online url in the webdialog (Of course later I want to use any url to collect definitions).

      I thought using dialog.allow_actions_from_host(url) was the obvious solution but I get Error: #<IOError: Invalid component URL>.

      Please help me to see what's wrong. 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

        Isn't it the URL that's incorrect? A typo or something?

        dialog.allow_actions_from_host(url) won't be affecting load_from_url - since they are two unrelated classes.

        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:

          Isn't it the URL that's incorrect? A typo or something?

          dialog.allow_actions_from_host(url) won't be affecting load_from_url - since they are two unrelated classes.

          I don't think it's a typo because I can do it with localhost and the url for the wd is the same online host (glasier.hk) ... but it could be of course "or something".

          Couldn't one class block a url so that another cannot use it - or is that muddled thinking?

          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

            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
                                            • 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