This root module contains the Scene class, which serves as a “universe” for all actions performed by a script. The scene object is accessible through the module-level ovito.scene variable.


This module-level variable points to the global Scene object, which serves as context for all operations performed by the script. The Scene object represents the program state and provides access to the contents of the visualization scene:

import ovito

# Retrieve the output data of the pipeline that is currently selected in OVITO:
data = ovito.scene.selected_pipeline.compute()

This module-level attribute reports the OVITO program version number (as a tuple of three ints).


This module-level attribute reports the OVITO program version (as a string).

class ovito.Scene

This class encompasses all data of an OVITO program session (basically everything that gets saved in a .ovito state file). It provides access to the objects that are part of the three-dimensional scene.

From a script’s point of view, there exists exactly one universal instance of this class at any time, which can be accessed through the ovito.scene module-level variable. A script cannot create another Scene instance.

property pipelines

The list of Pipeline objects that are currently part of the three-dimensional scene. Only pipelines in this list will display their output data in the viewports and in rendered images. You can add or remove a pipeline either by calling its add_to_scene() and remove_from_scene() methods or by directly manipulating this list using standard Python append() and del statements:

from ovito import scene
from ovito.io import import_file

pipeline1 = import_file('input/first_file.dump')
pipeline2 = import_file('input/second_file.dump')

assert(pipeline1 in scene.pipelines)

assert(pipeline2 in scene.pipelines)
del scene.pipelines[scene.pipelines.index(pipeline2)]

Saves the scene including all data pipelines that are currently in it to an OVITO state file. This function works like the Save State As menu function of OVITO. Note that pipelines that have not been added to the scene will not be saved to the state file.


filename (str) – The output file path

The saved program state can be loaded again using the -o command line option of ovitos or in the graphical version of OVITO. After loading the state file, the pipelines list will contain again all Pipeline objects that were part of the scene when it was saved. See also here.

property selected_pipeline

The Pipeline that is currently selected in the graphical OVITO program, or None if no pipeline is selected. Typically, this is the last pipeline that was added to the scene using Pipeline.add_to_scene().

© 2019, Alexander Stukowski.
Close Menu