<!doctype HTML public "-//W3C//DTD HTML 4.0 Frameset//EN">
<html xmlns:v="urn:schemas-microsoft-com:vml"
xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:w="urn:schemas-microsoft-com:office:word"
xmlns="http://www.w3.org/TR/REC-html40">
<!--(==============================================================)-->
<!--(Document created with RoboEditor. )============================-->
<!--(==============================================================)-->

<head>
<meta http-equiv=Content-Type content="text/html; charset=windows-1252">
<meta name=ProgId content=Word.Document>
<meta name=Generator content="Microsoft Word 9">
<meta name=Originator content="Microsoft Word 9">
<link rel=File-List href="./examples_files/filelist.xml">
<link rel=Edit-Time-Data href="./examples_files/editdata.mso">
<!--[if !mso]>
<style>
v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style>
<![endif]-->
<title>examples</title>
<!--[if gte mso 9]><xml>
 <o:DocumentProperties>
  <o:Author> </o:Author>
  <o:LastAuthor> </o:LastAuthor>
  <o:Revision>8</o:Revision>
  <o:TotalTime>34</o:TotalTime>
  <o:Created>2005-03-15T16:37:00Z</o:Created>
  <o:LastSaved>2005-04-13T19:00:00Z</o:LastSaved>
  <o:Pages>4</o:Pages>
  <o:Words>1366</o:Words>
  <o:Characters>7788</o:Characters>
  <o:Company> </o:Company>
  <o:Lines>64</o:Lines>
  <o:Paragraphs>15</o:Paragraphs>
  <o:CharactersWithSpaces>9564</o:CharactersWithSpaces>
  <o:Version>9.6926</o:Version>
 </o:DocumentProperties>
</xml><![endif]-->
<style>
<!--
 /* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
	{mso-style-parent:"";
	margin:0in;
	margin-bottom:.0001pt;
	mso-pagination:widow-orphan;
	font-size:12.0pt;
	font-family:"Times New Roman";
	mso-fareast-font-family:"Times New Roman";}
h2
	{margin-right:0in;
	mso-margin-top-alt:auto;
	mso-margin-bottom-alt:auto;
	margin-left:0in;
	mso-pagination:widow-orphan;
	mso-outline-level:2;
	font-size:18.0pt;
	font-family:"Times New Roman";
	font-weight:bold;}
h3
	{margin-right:0in;
	mso-margin-top-alt:auto;
	mso-margin-bottom-alt:auto;
	margin-left:0in;
	mso-pagination:widow-orphan;
	mso-outline-level:3;
	font-size:13.5pt;
	font-family:"Times New Roman";
	font-weight:bold;}
p.MsoBodyTextIndent, li.MsoBodyTextIndent, div.MsoBodyTextIndent
	{margin-top:0in;
	margin-right:0in;
	margin-bottom:0in;
	margin-left:.5in;
	margin-bottom:.0001pt;
	mso-pagination:widow-orphan;
	font-size:12.0pt;
	font-family:"Times New Roman";
	mso-fareast-font-family:"Times New Roman";}
a:link, span.MsoHyperlink
	{color:blue;
	text-decoration:underline;
	text-underline:single;}
a:visited, span.MsoHyperlinkFollowed
	{color:blue;
	text-decoration:underline;
	text-underline:single;}
p
	{margin-right:0in;
	mso-margin-top-alt:auto;
	mso-margin-bottom-alt:auto;
	margin-left:0in;
	mso-pagination:widow-orphan;
	font-size:12.0pt;
	font-family:"Times New Roman";
	mso-fareast-font-family:"Times New Roman";}
code
	{mso-ascii-font-family:"Courier New";
	mso-fareast-font-family:"Courier New";
	mso-hansi-font-family:"Courier New";
	mso-bidi-font-family:"Courier New";}
@page Section1
	{size:8.5in 11.0in;
	margin:1.0in 1.25in 1.0in 1.25in;
	mso-header-margin:.5in;
	mso-footer-margin:.5in;
	mso-paper-source:0;}
div.Section1
	{page:Section1;}
 /* List Definitions */
@list l0
	{mso-list-id:46270638;
	mso-list-type:hybrid;
	mso-list-template-ids:1997994382 -447157048 67698713 67698715 67698703 67698713 67698715 67698703 67698713 67698715;}
@list l1
	{mso-list-id:663438084;
	mso-list-type:hybrid;
	mso-list-template-ids:1713246562 -447157048 67698713 67698715 67698703 67698713 67698715 67698703 67698713 67698715;}
@list l2
	{mso-list-id:1138841280;
	mso-list-type:hybrid;
	mso-list-template-ids:1996624740 -447157048 67698713 67698715 67698703 67698713 67698715 67698703 67698713 67698715;}
@list l3
	{mso-list-id:1838886188;
	mso-list-type:hybrid;
	mso-list-template-ids:1954593486 -447157048 67698713 67698715 67698703 67698713 67698715 67698703 67698713 67698715;}
ol
	{margin-bottom:0in;}
ul
	{margin-bottom:0in;}
-->
</style>
<!--(Meta)==========================================================-->
<meta name=generator-major-version content=0.1>
<meta name=generator-minor-version content=1>
<meta name=filetype content=kadov>
<meta name=filetype-version content=1>
<meta name=page-count content=1>
<meta name=layout-height content=3139>
<meta name=layout-width content=933>
</head>

<!--(Body)==========================================================-->

<body lang=EN-US link=blue vlink=blue style='tab-interval:.5in'>
<!--kadov_tag{{<implicit_p>}}--><?xml version=1.0           encoding=UTF-8           ?>

<!doctype html>

<div class=Section1>

<p class=MsoNormal><!--kadov_tag{{<spaces>}}-->&nbsp; <!--(Table)=========================================================--><o:p></o:p></p>

<table border=0 cellpadding=0 width="100%" bgcolor="#8080ff" style='width:100.0%;
 mso-cellspacing:1.5pt;background:#8080FF;mso-padding-alt:0in 0in 0in 0in;
 x-cell-content-align: Center' x-use-null-cells>
 <tr>
  <td style='padding:7.5pt 7.5pt 7.5pt 7.5pt;x-cell-content-align: center'>
  <p class=MsoNormal><span style='font-size:36.0pt;color:black'>SketchUp Ruby
  Examples</span><span style='font-size:36.0pt;color:white'> </span></p>
  </td>
 </tr>
</table>

<p><!--kadov_tag{{<implicit_p>}}-->SketchUp ships with a number of simple
examples to help you get started programming with Ruby. The examples illustrate
some of the techniques that you can use in a script. <!--begin!kadov{{--><o:p></o:p></p>

<table border=0 cellspacing=0 cellpadding=0 width="100%" style='width:100.0%;
 mso-cellspacing:0in;mso-padding-alt:0in 0in 0in 0in;x-cell-content-align: Center;
 border-spacing: 0px;border-spacing: 0px;left:0px;top:220px' x-use-null-cells
 height=20>
 <col style="width: 100%;">
 <tr style='height:6.0pt;x-cell-content-align: center'>
  <td width="100%" style='width:100.0%;background:#8080FF;padding:.75pt 7.5pt .75pt 7.5pt;
  height:6.0pt;x-cell-content-align: center'>
  <h2 style='mso-line-height-alt:6.0pt'><span style='color:black'>Location of
  Example Scripts<o:p></o:p></span></h2>
  </td>
 </tr>
</table>

<p><br>
<!--}}end!kadov--><!--kadov_tag{{<implicit_p>}}-->When SketchUp starts up, it will
automatically load any scripts that it finds in the <span style='font-family:
"Courier New"'>Plugins</span> folder. Ruby scripts have the extension <span
style='font-family:"Courier New"'>.rb</span>. Additional example scripts are
located in a sub-folder of the <span style='font-family:"Courier New"'>Plugins</span>
folder called <span style='font-family:"Courier New"'>Examples</span>. </p>

<p>The location of the <span style='font-family:"Courier New"'>Plugins</span>
folder varies depending on whether you are running on OS X or Windows. </p>

<h3>On OS X</h3>

<p class=MsoNormal>On OS X,<span style="mso-spacerun: yes">  </span>the plugins
are installed in the <span style='font-family:"Courier New"'>Plugins</span>
directory within the application bundle. The scripts that ship with SketchUp
are installed in: </p>

<p style='text-indent:.5in'><span style='font-family:"Courier New"'>/Contents/Resources/Plugins</span>
</p>

<p>The examples are in: </p>

<p style='text-indent:.5in'><span style='font-family:"Courier New"'>/Contents/Resources/Plugins/Examples</span>
</p>

<h3>On Windows</h3>

<p class=MsoNormal>On Windows, the plugins are installed into the same folder
where you install SketchUp. This location may vary depending on where you
installed SketchUp. The default location is: </p>

<p style='text-indent:.5in'><span style='font-family:"Courier New"'>C:\Program
Files\@Last Software\SketchUp 5\Plugins</span> </p>

<p>The examples are in: </p>

<p style='text-indent:.5in'><span style='font-family:"Courier New"'>C:\Program
Files\@Last Software\SketchUp 5\Plugins\Examples</span> <!--begin!kadov{{--><br>
<!--}}end!kadov--><!--kadov_tag{{<implicit_empty_p>}}-->&nbsp;<o:p></o:p></p>

<table border=0 cellspacing=0 cellpadding=0 width="100%" style='width:100.0%;
 mso-cellspacing:0in;mso-padding-alt:0in 0in 0in 0in;x-cell-content-align: Center;
 border-spacing: 0px;border-spacing: 0px;left:0px;top:220px' x-use-null-cells
 height=20>
 <col style="width: 100%;">
 <tr style='height:6.0pt;x-cell-content-align: center'>
  <td width="100%" style='width:100.0%;background:#8080FF;padding:.75pt 7.5pt .75pt 7.5pt;
  height:6.0pt;x-cell-content-align: center'>
  <h2 style='mso-line-height-alt:6.0pt'><span style='color:black'>Loading
  Scripts<o:p></o:p></span></h2>
  </td>
 </tr>
</table>

<p><br>
<!--}}end!kadov--><!--kadov_tag{{<implicit_p>}}-->You must load Ruby scripts
before you can test them. Scripts can be loaded manually through the Ruby
console, automatically using the <span style='font-family:"Courier New"'>Plugins</span>
folder, automatically using the <span style='font-family:"Courier New"'>require</span>
Ruby command, and automatically using the <span style='font-family:"Courier New"'>require_all</span>
Ruby command.</p>

<h3>Manually Loading a Ruby Script</h3>

<p class=MsoNormal>The Ruby console can be used to load and test your Ruby
scripts. To load and test a Ruby script using the Ruby console: <!--begin!kadov{{--></p>

<p class=MsoNormal><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>

<ol style='margin-top:0in' start=1 type=1>
 <li class=MsoNormal style='mso-list:l3 level1 lfo3;tab-stops:list .5in'>Display
     the Ruby console by select View &gt; Ruby Console from the main SketchUp
     menu (The Ruby Console is actually added to the View menu when the Ruby
     script <span style='font-family:"Courier New"'>sketchup.rb</span> is
     loaded upon execution of SketchUp)<br style='mso-special-character:line-break'>
     <![if !supportLineBreakNewLine]><br style='mso-special-character:line-break'>
     <![endif]><o:p></o:p></li>
 <li class=MsoNormal style='mso-list:l3 level1 lfo3;tab-stops:list .5in'><!--begin!kadov{{-->Type
     <span style='font-family:"Courier New"'>load 'examples/box.rb'</span> in
     the Ruby Console's text entry box to load the <span style='font-family:
     "Courier New"'>box.rb</span> Ruby script from the <span style='font-family:
     "Courier New"'>Plugins/Examples</span> directory. The load command is used
     to load any ruby commands from within the Ruby Console and SketchUp adds
     the <span style='font-family:"Courier New"'>Plugins</span> folder to the
     path to look for Ruby scripts. <!--begin!kadov{{--><br>
<!--}}end!kadov--><!--kadov_tag{{<implicit_p>}}-->&nbsp; <!--begin!kadov{{--><o:p></o:p></li>
</ol>

<p class=MsoBodyTextIndent><!--begin!kadov{{-->The Ruby Console will display
&quot;true&quot; if there are no syntax errors in the file. Otherwise the Ruby
Console displays error messages and the associated line numbers where the
errors were found. Use these error messages to test and debug your script.</p>

<p class=MsoNormal><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>

<p class=MsoNormal>This method of loading Ruby scripts is the best method to
test and debug Ruby scripts. Use one of the following methods <!--kadov_tag{{<spaces>}}-->&nbsp;<!--kadov_tag{{</spaces>}}-->to
load your script automatically when SketchUp starts once you have tested and
debugged your script. </p>

<h3>Automatically Loading A Ruby Script from the Plugins Folder</h3>

<p class=MsoNormal>You can automatically load your Ruby scripts from the <span
style='font-family:"Courier New"'>Plugins</span> folder once they have been
tested and debugged. To automatically load a Ruby script from the <span
style='font-family:"Courier New"'>Plugins</span> folder: <!--begin!kadov{{--></p>

<p class=MsoNormal><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>

<ol style='margin-top:0in' start=1 type=1>
 <li class=MsoNormal style='mso-list:l0 level1 lfo6;tab-stops:list .5in'>Ensure
     that your script has the <span style='font-family:"Courier New"'>.rb</span>
     extension. Any files with the extension <span style='font-family:"Courier New"'>.rb</span>
     that are in the <span style='font-family:"Courier New"'>Plugins</span>
     folder are automatically loaded when you start SketchUp. <!--begin!kadov{{--></li>
 <li class=MsoNormal style='mso-list:l0 level1 lfo6;tab-stops:list .5in'>Copy
     the Ruby script into the SketchUp <span style='font-family:"Courier New"'>Plugins</span>
     folder. <!--kadov_tag{{<spaces>}}-->&nbsp;<!--kadov_tag{{</spaces>}}-->&nbsp;</li>
</ol>

<p class=MsoNormal style='margin-left:.25in'><span style="mso-spacerun:
yes"> </span><!--begin!kadov{{--></p>

<p class=MsoNormal>While this method easy automatically loading scripts, consider
one of the following loading methods to load multiple scripts at the same time
and avoid possible name conflicts. </p>

<h3>Automatically Loading a Ruby Script Using the &quot;require&quot; Ruby
Function</h3>

<p>The SketchUp installation might overwrite any script in the <span
style='font-family:"Courier New"'>Plugins</span> and <span style='font-family:
"Courier New"'>Plugins/Examples</span> directory with identically named scripts
in future releases of SketchUp. However, you can create a script that
auto-loads your Ruby scripts from locations that SketchUp will not touch. For
example:</p>

<p style='margin-left:.5in;text-indent:-.25in;mso-list:l2 level1 lfo8;
tab-stops:list .5in'><![if !supportLists]>1.<span style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span><![endif]>Create a script file that is named uniquely, such as <span
style='font-family:"Courier New"'>MyRubyScripts.rb</span>. This file will
contain a require command for each of the scripts you do not want overwritten
by the SketchUp installation program. For example, to ensure the <span
style='font-family:"Courier New"'>c:\myrubyscriptsdirectory\cylinder.rb</span> file
doesn't get overwritten by a newer copy, place the following command in the <span
style='font-family:"Courier New"'>MyRubyScripts.rb</span> file:</p>

<p style='margin-left:30.0pt;text-indent:6.0pt'><span style='font-family:"Courier New"'>require
'c:\myrubyscriptsdirectory\cylinder.rb'<o:p></o:p></span></p>

<p style='margin-left:30.0pt'>Note: You may also want to reference scripts in
the Example directory as a mechanism to auto load these scripts when SketchUp
loads. New versions of the examples that are overwritten by a future SketchUp
install will be auto loaded by the MyRubyScripts.rb file.</p>

<p style='margin-left:.5in;text-indent:-.25in;mso-list:l2 level1 lfo8;
tab-stops:list .5in'><![if !supportLists]>2.<span style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span><![endif]>Load SketchUp. SketchUp will read the <span style='font-family:
"Courier New"'>MyRubyScripts.rb</span> file in the <span style='font-family:
"Courier New"'>Plugins</span> directory and load any scripts that the file
references, such as box.rb.</p>

<h3>Automatically Loading a Ruby Script Using the &quot;require_all&quot;
Function</h3>

<p class=MsoNormal>The <span style='font-family:"Courier New"'>sketchup.rb</span>
file defines a <span style='font-family:"Courier New"'>require_all</span>
function which requires all files with the extension <span style='font-family:
"Courier New"'>.rb</span> in a given folder. Another good option for
automatically loading Ruby scripts is to create your own folder of Ruby scripts
(outside of the <span style='font-family:"Courier New"'>Plugins</span>
directory) and add that directory to the <span style='font-family:"Courier New"'>sketchup.rb</span>
file. For example, to load all scripts in the <span style='font-family:"Courier New"'>myrubyscripts</span>
directory: <!--begin!kadov{{--></p>

<ol style='margin-top:0in' start=1 type=1>
 <li class=MsoNormal style='mso-list:l1 level1 lfo11;tab-stops:list .5in'>Create
     a directory in a directory, such as C:\ (windows) or your home directory
     (OS X), called <span style='font-family:"Courier New"'>myrubyscriptsdirectory</span>.
     <!--begin!kadov{{--></li>
 <li class=MsoNormal style='mso-list:l1 level1 lfo11;tab-stops:list .5in'>Create
     file called <span style='font-family:"Courier New"'>myRubyScripts.rb</span>
     containing the following line of code on Windows: </li>
</ol>

<p style='margin-left:30.0pt;text-indent:6.0pt'><span style='font-family:"Courier New"'>require_all
(&quot;C:\myrubyscriptsdirectory&quot;)<o:p></o:p></span></p>

<p style='text-indent:30.0pt'>Or for the OS X:</p>

<p style='margin-left:30.0pt'><code><span style='font-size:10.0pt;font-family:
"Courier New"'>home = File.expand_path &quot;~&quot;</span></code><span
style='font-size:10.0pt;font-family:"Courier New";mso-fareast-font-family:"Courier New"'><br>
<code>myrubyscripts = File.join home, &quot;MyRubyScripts&quot;</code><br>
<code>require_all( myrubyscriptsdirectory )<o:p></o:p></code></span></p>

<table border=0 cellspacing=0 cellpadding=0 width="100%" style='width:100.0%;
 mso-cellspacing:0in;mso-padding-alt:0in 0in 0in 0in'>
 <tr style='height:6.0pt'>
  <td width="100%" style='width:100.0%;background:#8080FF;padding:.75pt 7.5pt .75pt 7.5pt;
  height:6.0pt'>
  <h2 style='mso-line-height-alt:6.0pt'><span style='color:black'>The Example
  Scripts (in the </span><span style='font-family:"Courier New";color:black'>Plugins</span><span
  style='color:black'> directory)<o:p></o:p></span></h2>
  </td>
 </tr>
</table>

<p class=MsoNormal>The following Ruby scripts are located in the <span
style='font-family:"Courier New"'>Plugins</span> directory and are loaded by
default.</p>

<p class=MsoNormal><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>

<h3>examples.rb</h3>

<p class=MsoNormal>This example contains three methods: <span style='font-family:
"Courier New"'>setLayer</span>, <span style='font-family:"Courier New"'>totalArea</span>,
and <span style='font-family:"Courier New"'>perimeter</span>. The <span
style='font-family:"Courier New"'>setLayer</span> method sets the layer of all
selected entities to a layer with a given name (you must provide the layer
name). The <span style='font-family:"Courier New"'>totalArea</span> method
computes the total area for all faces in a model. The <span style='font-family:
"Courier New"'>perimeter</span> method computes the perimeter of the selected
faces. Methods in this file can be loaded by typing the function name in the
Ruby console. For example: <!--begin!kadov{{--></p>

<p class=MsoNormal><span style='mso-tab-count:1'>            </span></p>

<p class=MsoNormal style='text-indent:.5in'><span style='font-family:"Courier New"'>setLayer
“layername”</span></p>

<h3>sketchup.rb</h3>

<p class=MsoNormal>This example contains several helpful methods and also adds
the Ruby Help menu items to the Help menu within SketchUp.</p>

<h3>utilities.rb</h3>

<p class=MsoNormal>This example creates three new tools in the <span
style='font-family:"Courier New"'>Utilities</span> sub-menu in the <span
style='font-family:"Courier New"'>Tools</span> menu: Create Face, Query Tool,
and Fix non-planar faces. The Create Face tool is used to recreate a face for
three intersecting, co-planar lines in the event that the face has been
deleted. You must select the three or more lines prior to selecting this menu
item.</p>

<p class=MsoNormal><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>

<p class=MsoNormal>The Query Tool displays mouse coordinates in the VCB as you move
the mouse around the screen.</p>

<p class=MsoNormal><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>

<p class=MsoNormal>The Fix non-planar faces tool is used to find and fix
non-planar faces in your model. </p>

<p class=MsoNormal><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>

<table border=0 cellspacing=0 cellpadding=0 width="100%" style='width:100.0%;
 mso-cellspacing:0in;mso-padding-alt:0in 0in 0in 0in;x-cell-content-align: Center;
 border-spacing: 0px;border-spacing: 0px;left:0px;top:220px' x-use-null-cells
 height=20>
 <col style="width: 100%;">
 <tr style='height:6.0pt;x-cell-content-align: center'>
  <td width="100%" style='width:100.0%;background:#8080FF;padding:.75pt 7.5pt .75pt 7.5pt;
  height:6.0pt;x-cell-content-align: center'>
  <h2 style='mso-line-height-alt:6.0pt'><span style='color:black'><!--(Table)=========================================================-->The
  Example Scripts (in the </span><span style='font-family:"Courier New";
  color:black'>Examples</span><span style='color:black'> directory)<o:p></o:p></span></h2>
  </td>
 </tr>
</table>

<p class=MsoNormal>The following Ruby scripts are located in the <span
style='font-family:"Courier New"'>Examples</span> directory within the <span
style='font-family:"Courier New"'>Plugins</span> directory and are not loaded
by default. Move these files to the <span style='font-family:"Courier New"'>Plugins</span>
directory if you want to load and use them.</p>

<h3>box.rb</h3>

<p class=MsoNormal>This example shows how to create simple geometry using Ruby.
Additionally, the <span style='font-family:"Courier New"'>box.rb</span> example
shows how to create a dialog box to prompt for user input and how to add an
item to a menu. <br>
<!--}}end!kadov--><!--kadov_tag{{<implicit_p>}}-->&nbsp; <!--begin!kadov{{--><br>
<!--}}end!kadov--><!--kadov_tag{{<implicit_p>}}-->This example will add a menu
item called Box at the end of the Camera menu when loaded. This menu item
displays a dialog where you input the size of the box you want to create and
then, after clicking OK, creates the box. </p>


<div class=MsoNormal align=center style='text-align:center'>

<hr size=2 width="100%" align=center>

</div>


<h3>selection.rb</h3>

<p class=MsoNormal>This example contains a number of examples of how to
traverse a model and select geometry. Methods in this file can be loaded by
typing the function name in the Ruby console. For example: <!--begin!kadov{{--></p>

<p style='margin-left:30.0pt'><span style='font-family:"Courier New"'>select_by_material<o:p></o:p></span></p>


<div class=MsoNormal align=center style='text-align:center'>

<hr size=2 width="100%" align=center>

</div>


<h3>contextmenu.rb</h3>

<p class=MsoNormal>This example shows how you can add new choices to context
menus. The <span style='font-family:"Courier New"'>contextmenu.rb</span>
example adds a <span style='font-family:"Courier New"'>Point at Center</span>
item to the context menu for arcs and circles to create a point at the center
of the arc or circle. To use this feature, create an arc or circle and context
click on the arc or circle to use <span style='font-family:"Courier New"'>Point
at Center</span> (bottom-most option). <!--kadov_tag{{<spaces>}}-->&nbsp;<!--kadov_tag{{</spaces>}}--></p>


<div class=MsoNormal align=center style='text-align:center'>

<hr size=2 width="100%" align=center>

</div>


<h3>linetool.rb</h3>

<p class=MsoNormal>This example shows how you can create tools that respond to
mouse events in Ruby. The linetool.rb example defines a simple tool that behaves
similar to the pencil tool in SketchUp except that it creates finite length
construction lines instead of regular SketchUp edges. <!--begin!kadov{{--><br>
<!--}}end!kadov--><!--kadov_tag{{<implicit_p>}}-->&nbsp; <!--begin!kadov{{--><br>
<!--}}end!kadov--><!--kadov_tag{{<implicit_p>}}-->The following command will
load the linetool.rb example: <!--begin!kadov{{--></p>

<p style='margin-left:30.0pt'><span style='font-family:"Courier New"'>Sketchup.active_model.select_tool
LineTool.new</span></p>


<div class=MsoNormal align=center style='text-align:center'>

<hr size=2 width="100%" align=center>

</div>


<h3>animation.rb</h3>

<p class=MsoNormal>This example shows how you can create animations in Ruby.
The <span style='font-family:"Courier New"'>animation.rb</span> example creates
a simple animation that spins the camera around. <!--begin!kadov{{--><br>
<!--}}end!kadov--><!--kadov_tag{{<implicit_p>}}-->&nbsp; <!--begin!kadov{{--><br>
<!--}}end!kadov--><!--kadov_tag{{<implicit_p>}}-->This example adds a menu item
called <span style='font-family:"Courier New"'>Animations</span> at the end of
the Camera menu. The Animations menu contains two options: <span
style='font-family:"Courier New"'>spin view</span> and <span style='font-family:
"Courier New"'>stop spinning</span>. Select <span style='font-family:"Courier New"'>spin
view</span> to rotate the camera continuously around your model. Select <span
style='font-family:"Courier New"'>stop spinning</span> to stop the spin view. </p>


<div class=MsoNormal align=center style='text-align:center'>

<hr size=2 width="100%" align=center>

</div>


<h3>attributes.rb</h3>

<p class=MsoNormal>This example shows how to attach arbitrary application
specific attribute data to SketchUp entities. The <span style='font-family:
"Courier New"'>attributes.rb</span> example also illustrates the use of input
boxes to get data from the user and how to query data on the model using cost
data information to compute a simple materials cost estimate. <!--begin!kadov{{--><br>
<!--}}end!kadov--><!--kadov_tag{{<implicit_p>}}-->&nbsp; <!--begin!kadov{{--><br>
<!--}}end!kadov--><!--kadov_tag{{<implicit_p>}}-->This example adds a <span
style='font-family:"Courier New"'>Cost</span> menu item to the <span
style='font-family:"Courier New"'>Plugins</span> menu. The <span
style='font-family:"Courier New"'>Cost</span> menu contains three items: <span
style='font-family:"Courier New"'>Assign Estimate to Material</span>, <span
style='font-family:"Courier New"'>Assign Estimate to Faces</span>, and <span
style='font-family:"Courier New"'>Computer Estimate</span>. Select <span
style='font-family:"Courier New"'>Assign Estimate to Material</span> to assign
a per/foot cost to all items with a specific material. Select <span
style='font-family:"Courier New"'>Assign Estimate to Faces</span> to assign a
per/foot cost to all selected faces. Select <span style='font-family:"Courier New"'>Compute
Estimate</span> to get a dollar amount for the currently calculated estimate. <!--begin!kadov{{--><br>
<!--}}end!kadov--><!--kadov_tag{{<implicit_p>}}--><!--kadov_tag{{<spaces>}}-->&nbsp;<!--kadov_tag{{</spaces>}}--><!Footer ------------------------------------------->
</p>


<div class=MsoNormal align=center style='text-align:center'>

<hr size=2 width="100%" align=center>

</div>


<table border=0 cellspacing=0 cellpadding=0 width="100%" bgcolor="#cccccc"
 style='width:100.0%;mso-cellspacing:0in;background:#CCCCCC;mso-padding-alt:
 0in 0in 0in 0in;border-spacing: 0px;border-spacing: 0px' x-use-null-cells>
 <tr>
  <td style='padding:.75pt .75pt .75pt .75pt'>
  <p class=MsoNormal><!--(Table)=========================================================-->SketchUp
  Ruby Reference: <i>Examples</i></p>
  </td>
  <td style='padding:.75pt .75pt .75pt .75pt'>
  <p class=MsoNormal align=right style='text-align:right'>© 2005 @Last
  Software, Inc. <a href="http://www.sketchup.com">www.sketchup.com</a> </p>
  </td>
 </tr>
</table>

<p><a href="classes.html">Contents:</a> </p>

</div>

</body>

</html>
