• Login
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
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.
  • C Offline
    chrisglasier
    last edited by 20 Apr 2012, 02:14

    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
    • T Offline
      thomthom
      last edited by 20 Apr 2012, 07:27

      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
      • C Offline
        chrisglasier
        last edited by 20 Apr 2012, 08:03

        @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
        • T Offline
          thomthom
          last edited by 20 Apr 2012, 08:13

          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
          • T Offline
            thomthom
            last edited by 20 Apr 2012, 08:18

            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
            • C Offline
              chrisglasier
              last edited by 20 Apr 2012, 08:38

              @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
              • T Offline
                thomthom
                last edited by 20 Apr 2012, 08:46

                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
                • T Offline
                  thomthom
                  last edited by 20 Apr 2012, 08:49

                  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
                  • C Offline
                    chrisglasier
                    last edited by 20 Apr 2012, 09:02

                    @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
                    • C Offline
                      chrisglasier
                      last edited by 20 Apr 2012, 09:10

                      @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
                      • C Offline
                        chrisglasier
                        last edited by 20 Apr 2012, 09:21

                        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
                        • T Offline
                          thomthom
                          last edited by 20 Apr 2012, 09:25

                          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
                          • C Offline
                            chrisglasier
                            last edited by 20 Apr 2012, 10:54

                            @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
                            • T Offline
                              thomthom
                              last edited by 20 Apr 2012, 11:32

                              @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
                              • D Offline
                                Dan Rathbun
                                last edited by 20 Apr 2012, 13:52

                                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
                                • C Offline
                                  chrisglasier
                                  last edited by 20 Apr 2012, 23:32

                                  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
                                  • C Offline
                                    chrisglasier
                                    last edited by 21 Apr 2012, 09:54

                                    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
                                    • D Offline
                                      Dan Rathbun
                                      last edited by 21 Apr 2012, 12:31

                                      @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
                                      • C Offline
                                        chrisglasier
                                        last edited by 21 Apr 2012, 19:17

                                        @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
                                        • T Offline
                                          TIG Moderator
                                          last edited by 21 Apr 2012, 19:35

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

                                          Advertisement