Viewer

class compas_notebook.viewer.Viewer(config=None, controller=None)

Bases: object

Viewer for COMPAS geometry in Jupyter notebooks.

Parameters:
configConfig, optional

A configuration object.

configpathpath-like or str, optional

The path to a configuration file.

sceneScene, optional

A COMPAS scene, with context set to “Notebook”.

controllerController, optional

A custom action controller.

Examples

This example is meant to be run from within a Jupyter notebook.

>>> import compas
>>> from compas.datastructures import Mesh
>>> from compas_notebook.viewer import Viewer
>>> mesh = Mesh.from_obj(compas.get("tubemesh.obj"))
>>> viewer = Viewer()
>>> viewer.scene.add(mesh)  
>>> viewer.show()  

Methods

init_ui

Initialize the user interface.

init_webgl

make_main

Initialize the main section of the user interface.

make_sidebar

make_statusbar

Initialize the status bar.

make_toolbar

Initialize the toolbar.

make_view3d

set_statustext

Set the text of the status bar.

show

Display the viewer in the notebook.

update

Update an existing viewer instance.