To indicate that you wish to use the Python Scripting Engine you need to put '#python' at the first
line of the script.
The Python implementation of the K-3D API has the same functionallity as the JavaScript one.
#python
Application.UI.Message( "I will now open a new document.", "Hello, World!")
document = Application.NewDocument()
result = Application.UI.QueryMessage( "Do you wish to keep the document open?", "Question", ["Yes", "No"] )
if result == 2:
Application.CloseDocument(document)
To find a complete reference to the whole language please visit http://www.python.org.
ScriptEnginesClass ScriptEngine
Return the script engines class.
Return a list of open documents.
Return the basepath of the running application.
string DialogTemplatesPath
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.
CommandNodeClass ChildName, same as : CommandNodeClass GetNode("ChildName")
Return node child (from the Command Node Inspector Tree).
value PropertyName, same as : value GetProperty("PropertyName")
Return node property (from the Command Node Inspector Tree).
PropertyName = value, same as : SetProperty("PropertyName", value)
Set node property.
Return node children as a string list (from the Command Node Inspector Tree).
Return node properties as a string list (from the Command Node Inspector Tree).
ApplicationClass GetApplication()
Return the application that owns document.
Returns the filepath to the 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 )
Create a new K-3D object.
Return set of objects as list.
ObjectClass GetObject( string name )
Return named K-3D object.
bool DeleteObject( string name )
Delete 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.
Show the camera viewport.
Hide the camera viewport.
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( tuple vector )
Set object position. Tuple contain three (3) values.
Get object orientation. Tuple contain four (4) values. The first is the angle and the rest XYZ values.
bool SetOrientation( tuple vector )
Set object orientation. Tuple contain four (4) values. The first is the angle and the rest XYZ values.
Get object scale. Tuple contain three (3) values.
bool SetScale( tuple vector )
Set object scale. Tuple contain three (3) values.
Called to request that the object open its user interface.
Return mesh that own path.
Retrn points in path as a list.
bool AddPoint( PointClass point )
Add point to collection.
bool RemovePoint( PointClass point )
Remove point from collection.
bool Local = tuple vector
Set local XYZ. Tuple contain three (3) values.
Get local XYZ. Tuple contain three (3) values.
bool Animated = tuple vector
Set animated XYZ. Tuple contain three (3) values.
Get animated XYZ. Tuple contain three (3) values.
bool World = tuple vector
Set world XYZ. Tuple contain three (3) values.
Get world XYZ. Tuple contain three (3) values.
bool Camera = tuple vector
Set camera XYZ. Tuple contain three (3) values.
Get camera XYZ. Tuple contain three (3) values.
bool Screen = tuple vector
Set screen XYZ. Tuple contain three (3) values.
Get screen XYZ. Tuple contain three (3) values.
bool Normal = tuple vector
Set normal XYZ. Tuple contain three (3) values.
Get normal XYZ. Tuple contain three (3) values.
bool Texture = tuple vector
Set texture XYZ. Tuple contain three (3) values.
Get texture XYZ. Tuple contain three (3) values.
bool ImplicitTexture = tuple vector
Set implicit texture XYZ. Tuple contain three (3) values.
Get implicit texture XYZ. Tuple contain three (3) values.