• Login
sketchucation logo sketchucation
  • Login
⚠️ Libfredo 15.4b | Minor release with bugfixes and improvements Update

[Tutorial] Beginning Ruby 2 - Writing a Script

Scheduled Pinned Locked Moved Developers' Forum
6 Posts 4 Posters 327 Views 4 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.
  • C Offline
    Chris Fullmer
    last edited by 24 Jun 2009, 16:14

    All right, I finally put together a second tutorial on script writing in Ruby. It is located here (the advanced tutorial section of the main sketchucation site):

    Link Preview Image
    SketchUcation

    3D SketchUp Community for Design and Engineering Professionals.

    favicon

    (www.sketchucation.com)

    The first one is here .

    Anyhow, look it over. Its a pretty baic script that iterates through a model, finds all the faces, then pushpulls them to a specified distance. It shows how to use the undo stack, safety wrap a scipt inside a module, use the inputbox, and add the script to the menu system.

    One of the coolest things about the tutorial is Coen's new Ruby feature in the tutorials section. So instead of screenshots of ruby, it actually has ruby code that you can copy and paste.

    Chris

    Lately you've been tan, suspicious for the winter.
    All my Plugins I've written

    1 Reply Last reply Reply Quote 0
    • C Offline
      CadFather
      last edited by 24 Jun 2009, 16:29

      Thanks Chris, this is great - who knows one day even i.. 😄

      1 Reply Last reply Reply Quote 0
      • T Offline
        thomthom
        last edited by 24 Jun 2009, 17:13

        Nice one Chris.

        I'd like to point out some inconsistency though.

        Some places you use .typename and some places you use .is_a?.

        Interesting findings from this post, http://forums.sketchucation.com/viewtopic.php?f=180&t=19576&start=0#p162235 , shows that .typename is very slow. Best practice would be to use .is_a? or .kind_of? (they are aliases of the same method.) Or compare the .class .

        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
          Chris Fullmer
          last edited by 24 Jun 2009, 17:22

          Oops, I should fix that. Its a remnant of the old script where I used .typename regularly. I guess I forgot to update it in some places. I know the first tutorial still uses .typename because I did not get a chance to update that one. I'm planning on redoing the entire tutorial.

          So I'll look them both over for inconstiencies again. I also want to add more links back to the API in the 2nd one. There are a few methods I refer to but don't link back to them.

          Thanks Thom!

          Chris

          Lately you've been tan, suspicious for the winter.
          All my Plugins I've written

          1 Reply Last reply Reply Quote 0
          • T Offline
            thomthom
            last edited by 24 Jun 2009, 17:45

            I wonder if we should make a sticky thread that list some of these 'tricks' / 'best practices' that's scattered throughout the forum... ?

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

            1 Reply Last reply Reply Quote 0
            • 3 Offline
              3eighty
              last edited by 25 Jun 2009, 04:25

              Are the rubie scripts based in the old dBase manner. It's been years for me but it looks almost the same as I remember...

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

              Advertisement