• Login
sketchucation logo sketchucation
  • Login
ℹ️ GoFundMe | Our friend Gus Robatto needs some help in a challenging time Learn More

Definitions.load_from_url failing when called from an HTMLDi

Scheduled Pinned Locked Moved Developers' Forum
3 Posts 2 Posters 3.2k 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.
  • G Offline
    gmolina1
    last edited by 9 Aug 2018, 02:28

    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.

    1 Reply Last reply Reply Quote 0
    • T Offline
      TIG Moderator
      last edited by 9 Aug 2018, 17:19

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

      TIG

      1 Reply Last reply Reply Quote 0
      • G Offline
        gmolina1
        last edited by 9 Aug 2018, 20:11

        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!

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

        Advertisement