Product Technology Blog

Feb 09

Creator: Automate Tasks with the new Creator Scripting Engine

Mon, February 09, 2009 - 13:49.
Posted by Yannick Lefebvre.  
Share/Save/Bookmark
Found under a new menu labeled "Scripts" in the Creator 3.5 interface, the OpenFlight Script Editor is a new way to automate repetitive or complex tasks in the Creator modeling environment.

It has been possible to code plugins for some time but the new Python-based scripting language alleviates the task of creating extensions to Creator because  the new scripts do not need to be compiled in an external development tool. They just need to be written, validated and executed within the Creator interface.

Through the use of scripts, users have full access to the power of the OpenFlight API. This allows you to create scripts that will parse the entire model tree, have access to information about parts of the model that are selected, and be able to make changes to any node of the model. For example, a script could be written to perform a massive rename of nodes across a model.

In the example below, a script has been written to identify which sections of the model have been selected by the user and print the names of the selected node and its children. When executed, we can see the results of the script printed in the output pane at the bottom of the window.

ofscripteditorsm

As you can also see, the script editor provides syntax highlighting reserved keywords and other elements of the syntax. It also provides auto-completion so that you get the right function names and displays help on the arguments for a given function.  

ofscripteditor2sm 

ofscripteditor3sm 

Finally, one last useful utility in the script editor is a set of menu items that can be used to automatically insert code snippets for common tasks that are typically done within a script. Once a script is created, it can be saved inside of the script repository under the Creator installation directory so that it gets displayed as a selectable item under the Scripts menu.

If you have already created a useful script using Creator 3.5, feel free to share it with other Creator users on our product forum.