Download skp files directly into Sketchup
-
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?
-
@driven said:
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 inGrid.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
-
@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
-
@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
-
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) -
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.
-
@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
-
@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.
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!
-
@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 -
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...
Advertisement