Scene
- class compas.scene.Scene[source]
Bases:
Tree
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:
- tree
compas.scene.SceneTree
The underlying tree data structure of the scene.
- objectslist[
compas.scene.SceneObject
] All scene objects in the scene.
- tree
Methods
Add an item to the scene.
Clear the current context of the scene.
Clear all objects inside the scene.
Draw the scene.
Inherited Methods
Converts the instance to a string.
Compute the axis-aligned bounding box of the datastructure.
Compute the oriented bounding box of the datastructure.
Make an independent copy of the data object.
Construct an object of this type from a JSON file.
Construct an object of this type from a JSON string.
Return string representation for the spatial hierarchy of the tree.
Get a node by its name.
Get all nodes by their name.
Remove a node from the tree.
Rotate the datastructure.
Returns a rotated copy of this geometry.
Scale the datastructure.
Returns a scaled copy of this geometry.
Compute a hash of the data for comparison during version control using the sha256 algorithm.
Convert the tree to a graph.
Convert an object to its native data representation and save it to a JSON file.
Convert an object to its native data representation and save it to a JSON string.
Transforms the data structure.
Transforms the data structure.
Returns a transformed copy of this data structure.
Returns a transformed copy of this data structure.
Translate the datastructure.
Returns a translated copy of this geometry.
Traverse the tree from the root node.
Validate the data against the object's data schema.