Scene

class compas.scene.Scene[source]

Bases: Data

A scene is a container for hierarchical scene objects which are to be visualised in a given context.

Parameters:
namestr, optional

The name of the scene.

contextstr, optional

The context in which the scene is visualised. Will be automatically detected if not specified.

Examples

>>> from compas.scene import Scene
>>> from compas.geometry import Box
>>> scene = Scene()
>>> box = Box.from_width_height_depth(1, 1, 1)
>>> scene.add(box)
>>> scene.draw()
Attributes:
treecompas.scene.SceneTree

The underlying tree data structure of the scene.

objectslist[compas.scene.SceneObject]

All scene objects in the scene.

Methods

add

Add an item to the scene.

clear

Clear the current context of the scene.

clear_objects

Clear all objects inside the scene.

draw

Draw the scene.

print_hierarchy

Print the hierarchy of the scene.

remove

Remove a scene object from the scene.

Inherited Methods

ToString

Converts the instance to a string.

copy

Make an independent copy of the data object.

from_json

Construct an object of this type from a JSON file.

from_jsonstring

Construct an object of this type from a JSON string.

sha256

Compute a hash of the data for comparison during version control using the sha256 algorithm.

to_json

Convert an object to its native data representation and save it to a JSON file.

to_jsonstring

Convert an object to its native data representation and save it to a JSON string.

validate_data

Validate the data against the object's data schema.