sketchup4architect
Follow us at Facebook Follow us at Linkedin Follow us at Twitter Follow StumbleUpon Follow Google Plus
Mail: enquiry@sketchup4architect.com | Call: 866 - 493 - 4944
Join Our Email List
Email:  
Home | Services | Components | Plugins | JOBS |Magazine | Advertising | Media kit | Articles | Blog|Contact Sketchup Samples | Video | Get Quote
sketechup ur space
SKETCHUP
Sketchup Components Sketchup Components
Sketchup Plugins Sketchup Plugins
Buy AR Media Plugin Buy Plugins
Sketchup Podium Sketchup Podium
3D Sketchup model Sketchup Models
Sketchup Style Builder Sketchup Style Builder
Sketchup Tutorial Sketchup Tutorial
Sketchup Videos Sketchup Videos
Sketchup Articles Sketchup Articles
Google Sketchup Pro 7 Google Sketchup Pro 7
Graphic Card for Sketchup Graphic Card for
 Sketchup
Sketchup Help Sketchup Help
Sketchup with linux Sketchup with linux
Sketchup Jobs Sketchup Jobs
Sketchup mobile application Sketchup for mobile
  application
Advertisement
 
SKETCHUP SERVICES
sketchupfireservice SketchUp Fire Service
sketchupforsolardesign Sketchup for Solar
  design
3d modeling 3D Modeling
Architecture icon Architectural design
3D Construction design 3D Construction design
Interior Design Interior design
Landscape Architecture Landscape Architecture
Film & Stage visualizing Film & Stage visualizing
GIS sketching GIS sketching
Mechanical Design Mechanical Design
BIM Modeling BIM Modeling
Sketchup for furniture design Sketchup for furniture
  design
geomodelling Geo-modeling with   SketchUp
sketchup4D Sketchup 4D scheduling
designdocument Design Docs with   sketchup
sketchup3dprinting Sketchup 3D printing   plugin

SketchUp Ruby

20th March 2010

By Global Assocaites SketchUp Team

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:- http://www.ruby-doc.org/docs/ProgrammingRuby

"The "Ruby user's guide" online at:-http://www.ruby-doc.org/docs/UsersGuide/rg/

"Introduction to Ruby" online at:-http://www.ruby-doc.org/docs/Tutorial/

"Learn to Program - on line at:-http://pine.fm/LearnToProgram

SketchUp Using Ruby:-http://aecbytes.com/tipsandtricks/2009/issue42-sketchup.html

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

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 (www.sketchup.com) 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 Plug-in

In the SketchUp world, "plugins" are identical to ruby scripts. Scripts belong to text files with an .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.

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.


Loading

Sketchup Pro 2016


SKETCHUP MATERIALS
SketchUp 8 Materials
Sketchup Textures
Vray SketchUp Material
Sketchup Materials Wood


SKETCHUP NEWS


SKETCHUP JOBS


SKETCHUP ARTICLES
Download Sketchup Material
Sketchup Material Library
SU Podium for Sketchup
Sketchup with Skatter
Download Sketchup 2013
Sketchup for mobile App
How to add people in SKP
SketchUp with Linux
RoundCorner 2.5a for SKP
Sketchup Photorealistic


USEFUL LINKS
Valid HTML 4.01 Transitional All right reserved. All site content copyright
Site Developed by
GlobalAssociates
Valid CSS!
sketchupmagazine