Skip to content

compas_notebook.viewer ¤

Classes¤

Viewer ¤

Viewer(config: Config = None, controller: Controller = None)

Viewer for COMPAS geometry in Jupyter notebooks.

Parameters:

Name Type Description Default
config :class:`Config`

A configuration object.

None
configpath path - like or str

The path to a configuration file.

required
scene :class:`Scene`

A COMPAS scene, with context set to "Notebook".

required
controller :class:`Controller`

A custom action controller.

None

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()

Functions¤

init_ui ¤
init_ui() -> None

Initialize the user interface.

make_main ¤
make_main() -> HBox

Initialize the main section of the user interface.

make_sidebar ¤
make_sidebar() -> GridBox
make_statusbar ¤
make_statusbar() -> HBox

Initialize the status bar.

Returns:

Type Description
HBox
make_toolbar ¤
make_toolbar() -> HBox

Initialize the toolbar.

Returns:

Type Description
HBox
make_view3d ¤
make_view3d() -> Box
set_statustext ¤
set_statustext(text: str) -> None

Set the text of the status bar.

show ¤
show() -> None

Display the viewer in the notebook.

update ¤
update() -> None

Update an existing viewer instance.