Sketchup Ruby Interference


Published on

This publication provides detailed information on Sketchup Ruby, an integrated scripting language in sketchup for improving the functionality of Sketchup

Published in: Technology
  • Be the first to comment

  • Be the first to like this

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Sketchup Ruby Interference

  1. 1. Keywords : SketchUp Ruby, Ruby Plugins, Ruby API, WebDialog Class, Ruby Observer Mechanism, Ruby Script Sketchup Ruby Ruby is an interpreted scripting language that SketchUp can understand via its SketchUp Ruby application programming interface (API). It was first introduced in SketchUp Version 4 with the intention to quick and easy object-oriented programming. With ruby script sketchup users can use to write plugins (scripts) for Google SketchUp and develop extra functionality by creating dozens of new tools & component generators for SketchUp beyond its built-in abilities in the Ruby programming language. Ruby scripts can be any thing from short snippets of code to more elaborate tool development. Benefits of Ruby • Produce custom advanced drawing tools which boost up the modeling speed and provide assistance to create complex objects with a few clicks. • Make 3d models that go ahead of geometry. The sketchup user can get the opportunity to add text or numeric attributes to any part of a SketchUp model and then produces reports. • The task of the SketchUp becomes automated with the API. It will be very helpful in the case of repetitive modeling requirements as a script can save time and money to a great extent. • Google produce free Ruby Scrambler, the sketchup users are able to protect their IP and sell thier plugins to this extensive user base. Resources for learning Ruby "Programming Ruby" online at "The "Ruby user's guide" online at "Introduction to Ruby" online at "Learn to Program - A Tutorial for the Future Programmer" on line at Bezier Splines in SketchUp Using Ruby Scripts at Sketchup Ruby interference Ruby Extensions The Sketchup extension is similar to other ruby script. It is known as ‘.rb’ and is applied at the end of a file name. The sketchup users have to create few extra code calls to make it easier to manage all of their rubies. To make use of plug-ins and other Ruby tools written by Google - like Sandbox and Dynamic Components - extensions must be enabled by clicking a checkbox under the SketchUp Preferences > Extensions menu. SketchUp Ruby API
  2. 2. The SketchUp Ruby API (Application Programmer's Interface) is a way that Ruby programmers can extend the capabilities of SketchUp to meet their needs. Create custom drawing tools, like a tool for creating windows. This API documentation includes sample code for each SketchUp Ruby method. There is one sample code file, also known as test file, for each SketchUp Ruby class file. All of the sample code is accessible in a .zip file on the SketchUp Web site ( under the Downloads tab. Unzip the test files in the Plugins folder within the SketchUp installation directory. These files end in the word “Tests,” such as “EdgeTests”. You should check each test file using a text editor. You may also accomplish the tests to make out how each API works within SketchUp. The Ruby API presents a binding to the TET C API. The API functionalities are included in a single Ruby module called as ‘Rbtet’. This module will have to be imported at the start of the test code require “Rbtet” The SketchUp Ruby API contains a series of SketchUp-specific Ruby modules known as classes in the object-oriented programming (OOP) world, and corresponding commands known as methods in the OOP world. These modules are utilized for formulating macros and controlling geometry in SketchUp. Classes are considered to be a mechanism for grouping related SketchUp ruby commands. Advantages with Ruby API • Attach attributes to drawing elements such as cost, supplier, etc. • Read attributes to generate reports, cut lists, or bills of material. • Automate common tasks like generating scenes from a set of rotations. • Animate stuff, from drawing elements to camera position. • Make games inside SketchUp by combining these activities. Ruby Plugin In the SketchUp world, "plugins" are identical to ruby scripts. Scripts belong to text files with a .rb (ruby) or .rbs (scrambled ruby) extension that includes Ruby programming code. WebDialog Class The Ruby WebDialog class supports DHTML webdialogs created with JavaScript. As for instance webdialogs can be formed from Ruby code to exhibit a web site or to recognize user input and utilize the results in your Ruby code. Ruby Observer Mechanism If any changes occur in the object of SketchUp application or model, it can be notified to Ruby script with the help of Ruby Observer Mechanism. For instance, an observer class can be created that "listens" to when SketchUp leaves and then makes some action. Make a Ruby class of an exact observer type, like AppObserver, prevail the desired methods, such as onQuit, and put in an example of the observer to the related objects in your Ruby script (applying the addobserver method for that object). Refer to individual observer edges for additional information.
  3. 3. Ruby Script Some complex scripts, like this version of BezierSpline, contain instructions inside its folder. For this purpose, the instructions are obtainable through a submenu entry exists in SketchUp. Other scripts may arise in the form of an easy, informational text file or no special document. While updating a script one should eliminate the older version to keep away from loading errors and inconsistencies. But if you wish to maintain copies of the older versions in the Plugins directory, then the file extensions must be renamed. In order to learn ruby script :- • Ruby Tutorial - Hello World • Ruby Tutorial - Accessing Entities Summary This publication provides detailed information on Sketchup Ruby, an integrated scripting language in sketchup for improving the functionality of Sketchup. Useful links Company Information: Global Associates has been providing sketchup services throught UK, USA, Canada and Australia for 2 years. Our services can be beneficial for furniture design, visual communication, google earth, interior design, landscape drawing, mechanical services, medical drawing and model development. Company Address P-100, Block-A, Lake Town Kolkata, India, Zip-700089 Phone - +91(033)2521-8508 Toll Free – 866-493-4944 Website : Email: