sketchucation logo sketchucation
    • Login
    ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info

    2 issues; inheritance & require ?

    Scheduled Pinned Locked Moved Developers' Forum
    10 Posts 3 Posters 187 Views 3 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.
    • T Offline
      tomot
      last edited by

      I just did a new install of SU an a Netbook to check if a ruby I'm writing will work correctly.

      =begin
      # Name ; tool
      =end
      require 'sketchup.rb'
      require 'linetool.rb'
      
      class WallSectionTool < LineTool
      

      I found linetool.rb was not by default in the plugins dir rather in the Examples dir hence my ruby would not run. It did run when I moved linetool.rb to the plugins dir.
      Which makes me wonder if inheritance in Ruby of the Linetool is still a valid option?

      commenting out, I thought would cause my script not to run .... but it did!...why?

      #require 'sketchup.rb'
      #require 'linetool.rb'
      

      [my plugins](http://thingsvirtual.blogspot.ca/)
      tomot

      1 Reply Last reply Reply Quote 0
      • TIGT Offline
        TIG Moderator
        last edited by

        Perhaps other code already required them ?
        require 'linetool.rb'
        could be also
        require 'examples/linetool.rb'???

        TIG

        1 Reply Last reply Reply Quote 0
        • Dan RathbunD Offline
          Dan Rathbun
          last edited by

          Yes don't move files from the "Examples" dir.

          The reason you did not need the require() statements, in the second case, was that Sketchup loads ALL files in the "Plugins" dir at startup.

          The Examples are ONLY loaded, if the user checks the option, in Window > Preferences > Extensions.

          OK ? so... Those files are "examples".. NOT Library files.

          1. The LineTool class does not belong at the toplevel !!1. Cut and paste the code into your OWN module, and modify / rename the class name.
          • like: class Tomot::LineTool1. then inherit from YOUR copy

          • like: class Tomot::WallSectionTool < Tomot::LineTool

          I'm not here much anymore.

          1 Reply Last reply Reply Quote 0
          • T Offline
            tomot
            last edited by

            @tig said:

            Perhaps other code already required them ?
            require 'linetool.rb'
            could be also
            require 'examples/linetool.rb'???

            I was looking at some example code for a ruby written by RickW dated 2005 called parking .rb, perhaps back then linetool.rb was residing in the plugins dir however your require 'examples/linetool.rb' works!

            There is also something quite insidious in the Windows 7 OS, its the VirtualStore dir, which keeps files that are never uninstalled by the uninstall program process, also the latest save version remains there, while the unaltered version remains in c:\ProgramFiles\ Google\GoogleSketchUp8\Plugins

            You will find the virtual store dir: c:\UsersYour name\AppData\Local\VirtualStore
            Its only after the uninstall and deleting any left over files in both of these dir's that you have done a complete uninstall.

            [my plugins](http://thingsvirtual.blogspot.ca/)
            tomot

            1 Reply Last reply Reply Quote 0
            • Dan RathbunD Offline
              Dan Rathbun
              last edited by

              Yes... the security on Win 6+ if a pain!

              Even a User cannot see his own AppData folders without going thru several confusing nested dialogs.

              THIS ISSUE is why users should be smart, and install their plugins to a directory that THEY control.

              I have my plugins in:
              "C:/Users/#{ENV['USERNAME']}/Documents/Google Sketchup/Common/Plugins"
              or
              "C:/Users/#{ENV['USERNAME']}/Documents/Google Sketchup/Sketchup ${Sketchup.version.to_i}/Plugins"

              see this code post: [Code] !autoload.rb loads "!_autoload" folders - v1.1.0

              I'm not here much anymore.

              1 Reply Last reply Reply Quote 0
              • T Offline
                tomot
                last edited by

                @dan rathbun said:

                Cut and paste the code into your OWN module, and modify / rename the class name.

                • like: class Tomot::LineTool[*]then inherit from YOUR copy

                • like: class Tomot::WallSectionTool < Tomot::LineTool[/list]

                The Module stuff is still on my do list! 👍 Yes I did the reverse, I felt since there was no additional information I wanted to convey to the user, using the inheritance of the linetool.rb was adequate, hence I cut all linetool stuff out of my script.

                [my plugins](http://thingsvirtual.blogspot.ca/)
                tomot

                1 Reply Last reply Reply Quote 0
                • T Offline
                  tomot
                  last edited by

                  I have not played around with that for a few years now: and I don't know if its still possible under Win 7 OS. I used to install each program I used to another totally independent HDD. such as drive e:/sketchup.
                  I would never use the default offered by the installer. It was also a lot faster to make a bootable backup HDD, while all my programs and data still ran from my HDD drive e: and could not be accessed by a hacker.
                  Unfortunately some addons today wont run anywhere else than from c:\Program Files

                  [my plugins](http://thingsvirtual.blogspot.ca/)
                  tomot

                  1 Reply Last reply Reply Quote 0
                  • Dan RathbunD Offline
                    Dan Rathbun
                    last edited by

                    @tomot said:

                    Unfortunately some addons today wont run anywhere else than from c:\Program Files

                    That's not your fault.. it's the fault of the plugin author.

                    If they are not scrambled, you can tweak them... if they are, you can try to ask the author to fix the plugin.

                    I'm not here much anymore.

                    1 Reply Last reply Reply Quote 0
                    • Dan RathbunD Offline
                      Dan Rathbun
                      last edited by

                      @tomot said:

                      The Module stuff is still on my do list!

                      Really... it's not that hard.. and you will be much better off having all you code running within your protected namespace.

                      I'm not here much anymore.

                      1 Reply Last reply Reply Quote 0
                      • T Offline
                        tomot
                        last edited by

                        @dan rathbun said:

                        @tomot said:

                        Unfortunately some addons today wont run anywhere else than from c:\Program Files

                        That's not your fault.. it's the fault of the plugin author.

                        If they are not scrambled, you can tweak them... if they are, you can try to ask the author to fix the plugin.

                        A friend of mine recently said " if I want an appliance I'll buy a MAC if I want a computer I'll buy a PC. I think Microsoft is heading down the same road as Apple. A pay for everything, the user wants, freeway!

                        So I saved $350.00 by NOT having Apple install a new HDD, on my wife's iMac, I did it my way!


                        imac.jpg

                        [my plugins](http://thingsvirtual.blogspot.ca/)
                        tomot

                        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