• Login
sketchucation logo sketchucation
  • Login
🔌 Quick Selection | Try Didier Bur's reworked classic extension that supercharges selections in SketchUp Download

Beginning Ruby Tutorial

Scheduled Pinned Locked Moved Developers' Forum
16 Posts 11 Posters 728 Views 11 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.
  • P Offline
    pilou
    last edited by 4 May 2009, 07:02

    Neat presentation! 😎

    Frenchy Pilou
    Is beautiful that please without concept!
    My Little site :)

    1 Reply Last reply Reply Quote 0
    • M Offline
      MALAISE
      last edited by 4 May 2009, 07:14

      Yeah! An Ruby introduction for Sketchup fans .

      Thanks a lot Chris, for listening poor newbies ! 😆

      MALAISE

      La Connaissance n'a de valeur que partagée

      1 Reply Last reply Reply Quote 0
      • P Offline
        plot-paris
        last edited by 4 May 2009, 08:13

        thanks Chris. that's really great. hopefully I will have time soon to check it out. such a tutorial was dearly deeded for noobs like me to get started 👍

        1 Reply Last reply Reply Quote 0
        • M Offline
          mateo soletic
          last edited by 4 May 2009, 08:28

          Great work Chris, that kind of tutorial was really needed. 👍

          @unknownuser said:

          Small typo, second paragragh thats all

          James,you are slacking. 😆

          [Concept Illustrations](http://concept-illustrations.com/)

          1 Reply Last reply Reply Quote 0
          • S Offline
            sepo
            last edited by 4 May 2009, 13:12

            Looks very good. This might tip me finally to start doing something about it. 👍

            1 Reply Last reply Reply Quote 0
            • M Offline
              MALAISE
              last edited by 4 May 2009, 13:50

              Hi Chris

              Is-it possible to resize the Web console "window"? We hardly read the contain ( too small font)

              Thanks

              MALAISE

              La Connaissance n'a de valeur que partagée

              1 Reply Last reply Reply Quote 0
              • D Offline
                dale
                last edited by 4 May 2009, 14:09

                Thanks Chris
                I have really always wanted to give it a try, or at least understand Rubys in greater depth.
                Thanks for the effort.

                Just monkeying around....like Monsanto

                1 Reply Last reply Reply Quote 0
                • C Offline
                  Chris Fullmer
                  last edited by 4 May 2009, 16:41

                  Thanks for the great comments, I hope it gets more people interested in beginning. I'm sure there are other roads to take to get into Ruby, but thats how I did it, so its the only way I can explain. Hopefully it will be logical enough for others to use too.

                  Malaise, sorry the font is small. If you click on most of the images, it shows a full size image. But if the full size image is too small also...hmm. I don't know. I bet I could also provide a link to the .rb script for download right up front, for people who can't read the images very well.

                  But if I provide the link to the text script, its not a free pass to just 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
                    Chris Fullmer
                    last edited by 4 May 2009, 21:26

                    @BTM (and anyone interested) I did go ahead and write up a quick tool script that creates a tool, which is how you get the onmousemove and all other tool methods to work. Check it out here:

                    http://www.sketchucation.com/forums/scf/viewtopic.php?f=180&t=18801

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

                    1 Reply Last reply Reply Quote 0
                    • A Offline
                      Al Hart
                      last edited by 17 May 2009, 17:23

                      Chris,

                      Thanks for making a ruby tutorial.

                      Its always inspiring to look at someone else's code.

                      Here is a version which use a hash instead of arrays to count all entities types;

                      
                      def count_entities
                      	model = Sketchup.active_model
                      	entities = model.entities
                      	count = {} # start a new hash
                      	entities.each do |e|
                      		stype = e.typename
                      		# start new count, or add 1 to existing count
                      		count[stype] = count[stype] ? count[stype] + 1 ; 1
                      	end#loop
                      	sorted_keys = count.keys.sort
                      	sorted_keys.each do |key|
                      		printf("Total %-12s; %5d\n", key, count[key])
                      	end#loop
                      	return nil
                      end#def
                      
                      

                      The weird line:

                      count[stype] = count[stype] ? count[stype] + 1 : 1

                      would be easier to read as

                      
                      if (count[stype])
                          count[stype] = count[stype] + 1
                      else
                          count[stype] = 1
                      end#if
                      
                      

                      Keep up the good work

                      Al Hart

                      http:wiki.renderplus.comimageseefRender_plus_colored30x30%29.PNG
                      IRender nXt from Render Plus

                      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