To indicate that you wish to use the Ruby Scripting Engine you need to put '#ruby' at the first
line of the script.
The Ruby implementation of the K-3D API has the same functionallity as the JavaScript one.
#ruby
app = ApplicationClass.new()
app.getUI().message("Welcome to Ruby!","Hello, World!")
document = app.newDocument()
result = app.getUI().queryMessage("Do you want to keep the document open?", "Question", ["Yes", "No"])
if result == 2
app.closeDocument(document)
end
To find a complete reference to the whole language please visit http://www.ruby-lang.org.
ScriptEnginesClass ScriptEngine()
Return the script engine class.
Return an array of open documents.
Return the running applications base path.
string DialgoTemplatesPath()
Return the dialogtemplates path.
Return the tutorials path.
DocumentClass NewDocument()
Creates a new K-3D document.
DocumentClass OpenDocument( string file )
Opens a K-3D document.
bool CloseDocument( DocumentClass document )
Closes an open K-3D document.
CommandNodeClass CommandNode()
Return a commandnode.
bool BrowserNavigate( string url )
Displays a URL in the user's preffered web browser.
bool Message( string message, string title )
Displays an informational message in a modal dialog box.
int QueryMessage( string message, string title, list buttons )
Prompts the user to choose one of selections in a modal dialog box.
bool ErrorMessage( string message, string title )
Displays an error in a modal dialog box.
string GetFilePath(string type, string prompt, bool promptoverwrite, string oldpath)
Prompts the user for a filepath, checking for old choices, and storing the current choice for reuse.
Valid types:
- renderfarm
- script
- document
- geometry
- log
- font
- renderframe
bool playFile( string filename )
Execute the script file. Return true on success.
bool command( string command, string arguments )
Execute a command on the commandnode.
ApplicationClass GetApplication()
Return the application that owns document.
bool Import( string file, string format )
Imports a geometry file into the document, using the given file format.
bool Export( string file, string format )
Exports the document to a geometry file, using the given file format.
Save document to a given file.
Records an original state that should be restored when undo.
bool FinishChangeSet( string string )
Undocumented.
ObjectClass CreateObject( string name )
Creates a new K-3D object.
ObjectCollectionClass Objects()
Returns the collection of K-3D objects within this document.
ObjectClass GetObject( string name )
Return named K-3D object.
bool DeleteObject( string name )
Deletes named K-3D object.
DocumentClass getDocument()
Return document that owns camera.
string getSelectionMode()
Get the selection mode.
bool setSelectionMode( string mode )
Set the selection mode.
bool renderFrame( string outimage, bool viewimage )
Render a single frame.
bool renderAnimation( string outimage, bool viewimages )
Render the animation.
DocumentClass GetDocument()
Return document that own object.
bool SetName( string name )
Set object name.
Get object position. Tuple contain three (3) values.
bool SetPosition( array vector )
Set object position. Array contain three (3) values.
Get object orientation. Array contain four (4) values. The first is the angle and the rest XYZ values.
bool SetOrientation( array vector )
Set object orientation. Array contain four (4) values. The first is the angle and the rest XYZ values.
Get object scale. Array contain three (3) values.
bool SetScale( array vector )
Set object scale. Array contain three (3) values.
Called to request that the object open its user interface.
Return mesh that own path.
bool AddPoint( PointClass point )
Add point to path.
bool RemovePoint( PointClass point )
Remove point from path.
bool Local = array vector
Set local XYZ. Array contain three (3) values.
Get local XYZ. Array contain three (3) values.
bool Animated = array vector
Set animated XYZ. Array contain three (3) values.
Get animated XYZ. Array contain three (3) values.
bool World = array vector
Set world XYZ. Array contain three (3) values.
Get world XYZ. Array contain three (3) values.
bool Camera = array vector
Set camera XYZ. Array contain three (3) values.
Get camera XYZ. Array contain three (3) values.
bool Screen = array vector
Set screen XYZ. Array contain three (3) values.
Get screen XYZ. Array contain three (3) values.
bool Normal = array vector
Set normal XYZ. Array contain three (3) values.
Get normal XYZ. Array contain three (3) values.
bool Texture = array vector
Set texture XYZ. Array contain three (3) values.
Get texture XYZ. Array contain three (3) values.
bool ImplicitTexture = array vector
Set implicit texture XYZ. Array contain three (3) values.
Get implicit texture XYZ. Array contain three (3) values.