Viewer
- class Viewer[source]
Bases:
Scene
The Viewer class is the main entry of compas_viewer. It organizes the scene and create the GUI application.
- Parameters:
- titlestr, optional
The title of the viewer window. It will override the value in the config file.
- fullscreenbool, optional
The fullscreen mode of the viewer window. It will override the value in the config file.
- widthint, optional
The width of the viewer window at startup. It will override the value in the config file.
- heightint, optional
The height of the viewer window at startup. It will override the value in the config file.
- rendermodeLiteral[‘shaded’, ‘ghosted’, ‘wireframe’, ‘lighted’], optional
The display mode of the OpenGL view. It will override the value in the config file.
- viewmodeLiteral[‘front’, ‘right’, ‘top’, ‘perspective’], optional
The view mode of the OpenGL view. It will override the value in the config file. In ‘ghosted’ mode, all objects have a default opacity of 0.7.
- show_gridbool, optional
Show the XY plane. It will override the value in the config file.
- configpathstr, optional
The path to the config folder.
See also
Notes
The viewer has a (main) window with a central OpenGL widget, and a menubar, toolbar, and statusbar. The menubar provides access to all supported ‘actions’. The toolbar is meant to be a ‘quicknav’ to a selected set of actions. The viewer supports rotate/pan/zoom, and object selection via picking or box selections. Currently the viewer uses OpenGL 2.2 and GLSL 120 with a ‘compatibility’ profile.
Examples
from compas_viewer import Viewer viewer = Viewer() viewer.show()
- Attributes:
- render
compas_viewer.components.render.Render
The render component of the viewer.
- controller
compas_viewer.controller.Controller
The controller component of the viewer.
- layout
compas_viewer.layout.Layout
The layout component of the viewer.
- render
Methods
Add an item to the scene.
Add a custom action to the viewer.
Clear the scene.
Decorator for callbacks of a dynamic drawing process.
Show the viewer window.
Inherited Methods
Converts the instance to a string.
Clear all objects inside the scene.
Make an independent copy of the data object.
Draw the scene.
Construct an object of this type from a JSON file.
Construct an object of this type from a JSON string.
Print the hierarchy of the scene.
Remove a scene object from the scene.
Compute a hash of the data for comparison during version control using the sha256 algorithm.
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.
Validate the data against the object's data schema.