• Login
sketchucation logo sketchucation
  • Login
πŸ€‘ 30% Off | Artisan 2 on sale until April 30th Buy Now

Detect if an extenbsion is loaded?

Scheduled Pinned Locked Moved Developers' Forum
11 Posts 4 Posters 526 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.
  • T Offline
    thomthom
    last edited by 9 Dec 2010, 21:08

    Is there a way to detect if an Extension is loaded or not?

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

    1 Reply Last reply Reply Quote 0
    • T Offline
      thomthom
      last edited by 9 Dec 2010, 21:39

      Not exactly what I asked for, but I found this to be useful:
      $LOADED_FEATURES.join("\n")

      Lists all loaded files, even those loaded with Sketchup::require.

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

      1 Reply Last reply Reply Quote 0
      • J Offline
        Jim
        last edited by 9 Dec 2010, 21:43

        Could use defined?() to check for modules, variable, etc.

        Hi

        1 Reply Last reply Reply Quote 0
        • T Offline
          thomthom
          last edited by 9 Dec 2010, 23:40

          @thomthom said:

          Not exactly what I asked for, but I found this to be useful:
          $LOADED_FEATURES.join("\n")

          Lists all loaded files, even those loaded with Sketchup::require.

          Though, doesn't list loaded .rbs files.

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

          1 Reply Last reply Reply Quote 0
          • C Offline
            c.plassais
            last edited by 10 Dec 2010, 15:16

            $" This pre-defined variable, an array contains the module names loaded by require.

            @+

            1 Reply Last reply Reply Quote 0
            • T Offline
              thomthom
              last edited by 10 Dec 2010, 16:02

              That's the same as $LOADED_FEATURES isn't it?

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

              1 Reply Last reply Reply Quote 0
              • C Offline
                c.plassais
                last edited by 10 Dec 2010, 16:27

                in reality, I do not know
                but
                puts $LOADED_FEATURESreturn nil
                puts $" return that

                1.png

                By cons no return for files rbs 😞

                http://www.zenspider.com/Languages/Ruby/QuickRef.html#19

                ChrisP

                1 Reply Last reply Reply Quote 0
                • D Offline
                  Dan Rathbun
                  last edited by 10 Dec 2010, 17:51

                  @thomthom said:

                  That's the same as $LOADED_FEATURES isn't it?

                  YES.

                  Verify with .object_id

                  The problem with rbs loading is a bug. The rbs loader (Sketchup.require and/or Sketchup.load,) should upon sucessful load of an rbs file, push the path argument into the $" array, just as the Ruby native Kernel.require does.

                  I think the way they wrote it, you must not specify the file extension.
                  If you wish to require widget.rbs then you use:
                  Sketchup.require 'foldername/widget'
                  and then you might see 'foldername/widget' as one of the elements in the $" array.

                  I'm not here much anymore.

                  1 Reply Last reply Reply Quote 0
                  • D Offline
                    Dan Rathbun
                    last edited by 10 Dec 2010, 17:59

                    @thomthom said:

                    Is there a way to detect if an Extension is loaded or not?

                    Yes, but you need to modify the SketchupExtension class.
                    I did exactly that and a whole lot more (mods the class,) for my own personal use.

                    No point in me releasing it, as you guys generally don't like these sort of mods, and also Google will not use "unsolicited code contributions" (which is why I now understand why Jim gave up on the SKX project.)

                    I'm not here much anymore.

                    1 Reply Last reply Reply Quote 0
                    • T Offline
                      thomthom
                      last edited by 11 Dec 2010, 01:53

                      @dan rathbun said:

                      I think the way they wrote it, you must not specify the file extension.
                      If you wish to require widget.rbs then you use:
                      Sketchup.require 'foldername/widget'
                      and then you might see 'foldername/widget' as one of the elements in the $" array.

                      That's what I do - no file extension for .rbs files, but I've not found them listed anywhere.

                      @dan rathbun said:

                      No point in me releasing it, as you guys generally don't like these sort of mods,

                      I avoid it in released code as it's the same as not wrapping the code in modules - too much chance for conflicts. That's my reason for skipping out of the SKX project.

                      Though for debugging and experimenting I occasionally do it. Recently extended the Menu, Toolbar and Command class to intercept the creation of the UI elements - might be a way to make an UI manager.

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

                      1 Reply Last reply Reply Quote 0
                      • J Offline
                        Jim
                        last edited by 18 Dec 2010, 13:36

                        @dan rathbun said:

                        No point in me releasing it, as you guys generally don't like these sort of mods, and also Google will not use "unsolicited code contributions" (which is why I now understand why Jim gave up on the SKX project.)

                        I probably shouldn't have - it can still be a valuable project. I think if I/we had pushed through, people would have started to use it and we might have a quality piece of work by now.

                        Hi

                        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