Definitions.load_from_url failing when called from an HTMLDi
-
Hello,
I am trying to load a ComponentDefinition from a local file in my PC (shipped with the extension, actually), but it just freezes when done from an HTMLDialog callback.
The original call is made from HERE, and it freezes when gets to THIS point.
However, when I call the GH::Groundhog::Photosensor.add(arguments) function from the Ruby console, it works beautifully.
Any idea why this might be happening? I could not find any other information online
THANKS TO ALL IN ADVANCE!
EDIT::: This is happening in Sketchup Make 2017, in macOS High Sierra.
-
But
...load_from_url
only works with proper URL HTTP address paths etc.
And, since you are already shipping the SKP within a subfolder with your extension, then you can simply use:
defn = Sketchup.active_model.definitions.load('full_path_to_subfolder/MODEL.skp')
You can easily get the path to your subfolder from__FILE__
as your file loads...
perhaps testing with:
unless model.definitions['MODEL']
, to avoid reloading it ?? -
It worked wonderfully! I was using the load_from_url method with a file:// prefix before, and it also worked... but this makes more sense.
Thanks!
Advertisement