• Login
sketchucation logo sketchucation
  • Login
Oops, your profile's looking a bit empty! To help us tailor your experience, please fill in key details like your SketchUp version, skill level, operating system, and more. Update and save your info on your profile page today!
⚠️ Important | Libfredo 15.6b introduces important bugfixes for Fredo's Extensions Update

Loading plugins only when needed

Scheduled Pinned Locked Moved Plugins
6 Posts 5 Posters 461 Views 5 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.
  • K Offline
    ktkoh
    last edited by 29 May 2011, 17:53

    After writing the Mortise & Tenon plugin I realized it could be the basis for other woodworking furniture joints ie. Dowels, Dovetails, Biscuits, etc. When starting to develop these additions it became useful to think of each program individually as this should make the logic and program easier to develop and follow. Then I thought that adding detail to joints in a sketchup furniture design is a very small part of what needs to be done and I didn't want these plugins taking up resources when not needed. So I devised a method of using a loading script that only populates the menu but waits for the first use to load the plugin. It seems to work well but I thought I would post the example to see if there are hidden problems I have not encountered or thought out. The included files are:"loadK2WS_Tools.rb" placed in the plugins directory to automatically load other files, "KK_MortiseTool_X.rb" this is the actual tool script, and "Test_MortiseTool2.rb" the file that creates the menu items and loads the tool plugin as needed (these files need to be placed in a K2WS_Tools directory in the plugins directory ). Note: as written only the Tenon and Mortise tools are available the M&T_Joint and LT_Joints do not function until the tool script is loaded the first time by the Tenon or Mortise tools. This was done to demonstrate that the main tool script file did not load until requested.

    Thanks for looking (comments +/- appreciated)
    Keith


    loadK2WS_Tools.rb


    KK_MortiseTool_X.rb


    Test_MortiseTool2.rb

    1 Reply Last reply Reply Quote 0
    • T Offline
      thomthom
      last edited by 30 May 2011, 08:02

      So "loading plugins only when needed" - is not for all plugins? Just for Mortise & Tenon?
      ❓

      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
        srx
        last edited by 30 May 2011, 09:03

        Well it would be very good plugin if it was for all.

        www.saurus.rs

        1 Reply Last reply Reply Quote 0
        • J Offline
          Jim
          last edited by 30 May 2011, 10:36

          Seems like a good idea. But wouldn't you instead have a long list of available plugins, instead of a long list of loaded plugins?

          Hi

          1 Reply Last reply Reply Quote 0
          • K Offline
            ktkoh
            last edited by 30 May 2011, 17:05

            The concept is usable on any plugin however the file loading and menu would need to be separated into a separate plugin. Yes it would be nice to have a list and load from a list but so far that has seemed to evaded the plugin writers. The way I made this the menu for the tool will exist which I think is handy for the user but only load as needed. I mainly put this out for comments and possibly starting some thinking on a different approach to the management problem. Also I wanted to know if there were any problems obvious to others that I overlooked as I am rather a newbe to SkethcUp & Ruby programing.

            Keith

            1 Reply Last reply Reply Quote 0
            • F Offline
              fredo6
              last edited by 30 May 2011, 20:41

              Keith,

              I think this is the way to do, because it speeds up the start of the Sketchup application.

              I introduced this approach for my own plugins with LibFredo6 3.6. I called it "two-phase loading" (only the files bootstrap_... are loaded at SU startup time). Actually, you may see a small message in the status bar indicating the file loading the first time you use the plugin. Also the time for the second phase is indicated in the About... box.

              I use a slightly different method but it does not matter.

              This save a few hundreds milliseconds for each plugin, so seconds at the end

              Fredo

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

              Advertisement