Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

When you first start TurboCAD, the Ruby Console opens as well.  

 

 
You can use the Ruby console to run functions, load ruby scripts, or even define new functions.

The top portion of the Ruby console is the Output Panel. This is where Ruby scripts will put text output, and where the Ruby engine will notify you of any errors that it has encountered, or provide other notifications. It is possible to copy text from the Output Panel to the clipboard for reuse in the Input Panel or elsewhere.

The bottom panel of the Ruby console is the Input Panel. Here you can type in any functions that you want to call, or define new values or even functions.

The Load… button allows you to open a ruby script using a standard "Open" dialog box.

The Save… button allows you to save the contents of the input panel as a ruby script using a standard "Save As" dialog box.

The Evaluate button tells Ruby to evaluate the text that you have typed into the Input Panel.

The Close button closes the Ruby Console. After you close the Ruby console you can re-open it at any time from the Scripts/Toggle Ruby Console menu command.

The Multiline checkbox allows you to turn Multiline input off or on.

...

To load a ruby script, click on the Load… button in the Ruby Console. This opens a dialog box that lets you browse to a ruby script and load its functions and other definitions into memory.

...

Note, however, that loading a script in this way will not automatically execute any of the methods in the script – you'll have to do that from the Ruby console as well. For example, if you want to execute a function draw_stuff which is contained in the ruby script ConsoleLoadSample.rb you would do the following:

...

Any time you want to clear the accumulated text in the console's Output Panel, use the cls command in the Input Panel:
cls
press Enter

More Ruby

Examples of Ruby scripts can be found in the RubyScripts folder within the Programs folder where you installed TurboCAD.
Looking at these examples is the best way to familiarize yourself with Ruby in TurboCAD. For more advanced information there are several online sights dedicated to programming in Ruby, and there are many books available. You

 You will also want to familiarize yourself with the TurboCAD SDK for a better grasp of TurboCAD's functions. Some of the Ruby functions available emulate the functions of Ruby as used in Google SketchUp. Therefore it is advisable to look at the documentation of Ruby scripting in SketchUp as well.