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!
    πŸ›£οΈ Road Profile Builder | Generate roads, curbs and pavements easily Download

    [Question]how to load a tool from an external .rb file

    Scheduled Pinned Locked Moved Developers' Forum
    4 Posts 2 Posters 116 Views 2 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.
    • R Offline
      rvs1977
      last edited by

      Hi All πŸ˜„

      Once I made a simple linedrawing tool, capable of drawing straigt lines.
      Its saved in a file called mylinetool.rb in \Plugins\as_plugins\as_rubyeditor\snippets

      The question is, how do I make a small rubyscript that loads and runs the tool from Alex Schreyers Ruby Code Editor?

      Is it something like "load_file", "include" or "load(filename)"??

      Can it be loaded from a URL? eg. http://www.google.com/mylinetool.rb

      thanks in advance

      -Rasmus


      Get a Ruby

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

        If it is a plugin.. it is no longer a "snippet" ...

        Move it into YOUR author sub-directory of the "Plugins" directory.

        So.. example, say you use "Rasmus" as your author sub-directory:

        require('Rasmus/mylinetool.rb')
        This ensures the file is only loaded once.

        To load it again, regardless of whether it has been previously loaded, (say during debugging,) use:
        load('Rasmus/mylinetool.rb')

        ***** If you use double-quoted pathstrings, make sure you use slashes (/) and NOT backslashes (%(#BF0000)[]) !

        I'm not here much anymore.

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

          Your question is so basic, it marks you as a Ruby Newbie. So you need this advice:

          Ruby Newbie's Guide to Getting Started

          I'm not here much anymore.

          1 Reply Last reply Reply Quote 0
          • R Offline
            rvs1977
            last edited by

            Thank you Dan. It worked β˜€

            I have started to go through the Ruby Resource as you suggested. And I also found the answer for my own question in there. πŸ‘


            Get a Ruby

            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