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

    Download skp files directly into Sketchup

    Scheduled Pinned Locked Moved Developers' Forum
    14 Posts 7 Posters 3.2k Views 7 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.
    • D Offline
      driven
      last edited by

      @Tig

      I tried the file you linked to to download from my Dropbox Public Folder, but I get this messageit is a valid component from the sampler in SU.
      and yes it ends in Grid.skp

      to get it to run at all, I changed line #32,
      any ideas?

       class LoadHandler
      
         def onPercentChange(p)
           Sketchup;;set_status_text("LOADING;    " + p.to_i.to_s + "%")
         end
      
         def cancelled?
           # You could, for example, show a messagebox after X seconds asking if the
           # user wants to cancel the download. If this method returns true, then
           # the download cancels.
           return false
         end
      
         def onSuccess
           Sketchup;;set_status_text('')
         end
      
         def onFailure(error_message)
           # A real implementation would probably not use a global variable,
           # but this demonstrates storing any error we receive.
           $last_error = error_message
           Sketchup;;set_status_text('')
         end
      
       end
      
       # Replace this with a real URL...
       url = "https://dl.dropboxusercontent.com/u/25114184/Dynamic Components Training/Tile Grid.skp"
       load_handler = LoadHandler.new
       Sketchup.active_model.definitions.load_from_url url, load_handler
      
       if $last_error == nil
         last_def_id = Sketchup.active_model.definitions.count - 1
         loaded_definition = Sketchup.active_model.definitions[last_def_id]
       else
         UI.messagebox("Error; " + $last_error.to_s)
       end
      

      it's an active link if you want to test against it...
      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
      • M Offline
        mwm5053
        last edited by

        So a quick question to TIG. Why couldn't you save a model as a component and use component browser to import like you would with say furniture or cabinets?

        2011 iMac
        SU 2015 Pro, 2017 Make
        V2 Twilight
        macOS Sierra 10.12.5

        1 Reply Last reply Reply Quote 0
        • S Offline
          slbaumgartner
          last edited by

          @driven said:

          @Tig

          I tried the file you linked to to download from my Dropbox Public Folder, but I get this message[attachment=0:2x8b9f01]<!-- ia0 -->2013-06-19 06.51.51 pm.png<!-- ia0 -->[/attachment:2x8b9f01]
          and yes it ends in Grid.skp

          to get it to run at all, I changed line #32,
          any ideas?

           class LoadHandler
          > 
          >    def onPercentChange(p)
          >      Sketchup;;set_status_text("LOADING;    " + p.to_i.to_s + "%")
          >    end
          > 
          >    def cancelled?
          >      # You could, for example, show a messagebox after X seconds asking if the
          >      # user wants to cancel the download. If this method returns true, then
          >      # the download cancels.
          >      return false
          >    end
          > 
          >    def onSuccess
          >      Sketchup;;set_status_text('')
          >    end
          > 
          >    def onFailure(error_message)
          >      # A real implementation would probably not use a global variable,
          >      # but this demonstrates storing any error we receive.
          >      $last_error = error_message
          >      Sketchup;;set_status_text('')
          >    end
          > 
          >  end
          > 
          >  # Replace this with a real URL...
          >  url = "https://dl.dropboxusercontent.com/u/25114184/Dynamic Components Training/Tile Grid.skp"
          >  load_handler = LoadHandler.new
          >  Sketchup.active_model.definitions.load_from_url url, load_handler
          > 
          >  if $last_error == nil
          >    last_def_id = Sketchup.active_model.definitions.count - 1
          >    loaded_definition = Sketchup.active_model.definitions[last_def_id]
          >  else
          >    UI.messagebox("Error; " + $last_error.to_s)
          >  end
          

          it's an active link if you want to test against it...
          john

          @john, the above ran ok for me - added the Tile Grid to the components in my model and did not raise any errors. Puzzling...why not for you?

          Steve

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

            @slbaumgartner said:

            Puzzling...why not for you?

            not sure, do you have a dropbox to check if there's a short circuit trying to use your own???

            does that even make sense?

            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
            • S Offline
              slbaumgartner
              last edited by

              @driven said:

              @slbaumgartner said:

              Puzzling...why not for you?

              not sure, do you have a dropbox to check if there's a short circuit trying to use your own???

              does that even make sense?

              john

              I don't have any experience with dropbox, so it's all guessing on my part. But it doesn't make sense to me that you would be blocked from accessing your own dropbox. Has that happened to you in any other context? Your code worked for me in both SU 8 and SU 2013 Make.

              Steve

              1 Reply Last reply Reply Quote 0
              • K Offline
                Kevin Fung
                last edited by

                Thanks Aerilius and TIG for your prompt reply.

                I would prefer to try the HTML5 drag and drop API.

                If there is any successful, I would post the photo for your reference.

                Thanks.

                Kevin Fung
                (Hong Kong)

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

                  I used HTML5 Drag and Drop API for my installer utility: http://sketchucation.com/forums/viewtopic.php?t=51330

                  But I found that it didn't work under OSX because the WebDialog hides when the parent SketchUp window loses focus.

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

                  1 Reply Last reply Reply Quote 0
                  • S Offline
                    slbaumgartner
                    last edited by

                    @thomthom said:

                    I used HTML5 Drag and Drop API for my installer utility: http://sketchucation.com/forums/viewtopic.php?t=51330

                    But I found that it didn't work under OSX because the WebDialog hides when the parent SketchUp window loses focus.

                    Yes, that is one of the frustrating aspects of OSX. When the app loses focus, its secondary windows all hide - they aren't merely invisible behind other windows, they actually cease to be displayed. If the app is set up for drag and drop, the main window and its secondary windows will pop back to the top when you drag onto the main window, at which point you can drag onto the secondary window. But, it does not appear that SU is set up for drag and drop, even as of 2013 - at least I can't get it to work.

                    Steve

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

                      @slbaumgartner said:

                      the main window and its secondary windows will pop back to the top when you drag onto the main window, at which point you can drag onto the secondary window. But, it does not appear that SU is set up for drag and drop, even as of 2013 - at least I can't get it to work.

                      this much works I use top left 'hot corner' to get back to SU, it's the actual loading that fails and even after disabling the virtual store messages I get

                       Creating Drop Zone Window...
                      >> Dialog Ready
                      [Callback;;Install_Ended]
                      > Params; ""
                      > Checking installed stack; 0
                      > Clearing installed stack...
                      > Cleared!
                      

                      learn from the mistakes of others, you may not live long enough to make them all yourself...

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

                        @slbaumgartner said:

                        @driven said:

                        @john, the above ran ok for me - added the Tile Grid to the components in my model and did not raise any errors. Puzzling...why not for you?

                        BTW. this is working for me now as well, I reset some of my outgoing request [Little Snitch] Filters, so I can download directly into SU from my 'dropbox' or iCloud, I might try Google drive next...
                        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
                        • thomthomT Offline
                          thomthom
                          last edited by

                          Yea, I also found awkward ways to drop files to the WebDialog - but it's so awkward that I won't bother making a public release for it. It'll just be confusing - and defeat the purpose of trying to make an easy drag and drop feature...

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

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

                          Advertisement