home *** CD-ROM | disk | FTP | other *** search
/ Freelog 100 / FreelogNo100-NovembreDecembre2010.iso / Graphisme / GoogleSketchUp / GoogleSketchUpWFR.exe / GoogleSketchUp8.msi / SketchUpMeta.cab / examples.rb.78D17A5F_0E0A_44D2_877D_2C56D45D16B7 < prev    next >
Encoding:
Text File  |  2010-08-26  |  2.3 KB  |  50 lines

  1. # Copyright 2005-2008, Google, Inc.
  2.  
  3. # This software is provided as an example of using the Ruby interface
  4. # to SketchUp.
  5.  
  6. # Permission to use, copy, modify, and distribute this software for 
  7. # any purpose and without fee is hereby granted, provided that the above
  8. # copyright notice appear in all copies.
  9.  
  10. # THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
  11. # IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  12. # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  13. #-----------------------------------------------------------------------------
  14.  
  15. # This file includes a number of examples of how to use the Ruby interface
  16. # to access a SketchUp model and perform various kinds of operations.
  17.  
  18. # To test the examples you must first load the files.
  19. # There are two ways that you can do this.
  20.  
  21. # The first way is to manually load it from the Ruby console.  You can show
  22. # the Ruby console by selecting View/Ruby Console. (This is actually added
  23. # to the View menu when the Ruby script sketchup.rb is loaded.)  In the
  24. # Ruby console, type the following line:
  25. # load 'examples/examples.rb'
  26. # If there are no syntax errors in the file, it will display "true" in the
  27. # Ruby console.  Otherwise it will show error messages and information about
  28. # the line on which errors were found.
  29.  
  30. # The second way to load this file is to copy it into the SketchUp plugins
  31. # directory.  Any files with the extension .rb that are in the plugins
  32. # directory are automatically loaded when you start SketchUp.
  33.  
  34. # The following line includes some common useful scripts.  The file
  35. # sketchup.rb is automatically put in the SketchUp plugins directory
  36. # when SketchUp is installed, so it should always get automatically
  37. # loaded anyway, but it is good practice to explicitly require any
  38. # files that you have dependencies on to make sure that they are loaded.
  39. require 'sketchup.rb'
  40. require 'extensions.rb'
  41. require 'LangHandler.rb'
  42.  
  43. $exStrings = LanguageHandler.new("Examples.strings")
  44.  
  45. examplesExtension = SketchupExtension.new $exStrings.GetString("Ruby Script Examples"), "examples/exampleScripts.rb"
  46.                     
  47. examplesExtension.description=$exStrings.GetString("Adds examples of tools created in Ruby to the SketchUp interface.  The example tools are Draw->Box, Plugins->Cost and Camera->Animations.")
  48.                         
  49. Sketchup.register_extension examplesExtension, false
  50.