ovito
¶
This module mainly provides the Scene
class, which serves as a “universe” or context for all actions
performed by a script. The scene object is accessible through the module-level ovito.scene
variable.
The scene manages a list of Pipeline
objects, which will be visible in images and videos
when rendering the scene through a Viewport
. Futhermore, you can save the entire
scene to a .ovito
state file, which can be viewed in the graphical OVITO application or stored for later use.
-
ovito.
scene
¶ This module-level variable points to the global
Scene
object, which serves as context for all operations performed by the script. TheScene
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()
-
ovito.
version
¶ A module-level attribute reprting the OVITO program version number (as a tuple of three ints).
-
ovito.
version_string
¶ Module-level attribute reporting 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 manages the list of objects (i.e.Pipeline
instances) that are part of the three-dimensional scene and which will show up in rendered images.From a script’s point of view, there exists exactly one universal instance of this class at any time, which is accessible through the
ovito.scene
module-level variable. A script cannot create anotherScene
instance by itself.-
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 itsadd_to_scene()
orremove_from_scene()
methods or by directly manipulating this list using the standard Pythonappend()
anddel
statements:from ovito import scene from ovito.io import import_file pipeline = import_file('input/simulation.dump') # Insert the pipeline into the visualization scene. pipeline.add_to_scene() # It's now part of the 'scene.pipelines' list. assert(pipeline in scene.pipelines) # If needed, we can take it out again. pipeline.remove_from_scene()
-
save
(filename)¶ 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.
- Parameters
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 objects that were part of the scene when it was saved. See also this section for more information.
-
property
selected_pipeline
¶ Returns the
Pipeline
that is currently selected in the graphical OVITO application, orNone
if no pipeline is selected. Typically, this is the last pipeline that was added to the scene usingPipeline.add_to_scene()
.This field can be useful for scripts running in the context of the graphical OVITO application which want to perform some action on the currently selected pipeline, e.g. insert a new modifier.
-
property