ViewerSceneObject

class ViewerSceneObject[source]

Bases: SceneObject, Base

Base class for all Viewer scene objects which also includes the GL buffer creation and drawing methods.

Parameters:
viewercompas_viewer.viewer.Viewer

The viewer object.

is_selectedbool, optional

Whether the object is selected. Default is False.

showbool, optional

Whether to show object. Default is True.

show_pointsbool, optional

Whether to show points/vertices of the object. Default is the value of show_points in viewer.config.

show_linesbool, optional

Whether to show lines/edges of the object. Default is the value of show_lines in viewer.config.

show_facesbool, optional

Whether to show faces of the object. Default is the value of show_faces in viewer.config.

linewidthfloat, optional

The line width to be drawn on screen. Default is the value of linewidth in viewer.config.

pointsizefloat, optional

The point size to be drawn on screen. Default is the value of pointsize in viewer.config.

opacityfloat, optional

The opacity of the object. Default is the value of opacity in viewer.config.

**kwargsdict, optional

Additional visualization options for compas.scene.SceneObject.

Attributes:
is_selectedbool

Whether the object is selected.

showbool

Whether to show object.

show_pointsbool

Whether to show points/vertices of the object.

show_linesbool

Whether to show lines/edges of the object.

show_facesbool

Whether to show faces of the object.

linewidthfloat

The line width to be drawn on screen

pointsizefloat

The point size to be drawn on screen.

opacityfloat

The opacity of the object.

backgroundbool

Whether the object is drawn on the background with depth test disabled.

bounding_boxlist[float], read-only

The min and max corners of object bounding box, as a numpy array of shape (2, 3).

bounding_box_centercompas.geometry.Point, read-only

The center of object bounding box, as a point.

Methods

draw

Draw the object from its buffers

draw_instance

Draw the object instance for picking

init

Initialize the object

make_buffer_from_data

Create buffers from point/line/face data.

make_buffers

Create all buffers from object's data

update

Update the object.

update_buffer_from_data

Update existing buffers from point/line/face data.

Inherited Methods

ToString

Converts the instance to a string.

add

Add a child item to the scene object.

clear

The main clearing method.

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.

remove

Remove a child node from this node.

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.

traverse

Traverse the tree from this node.

validate_data

Validate the data against the object's data schema.