Skip to content

Commit 08930e7

Browse files
committed
Merge branch 'main' of https://github.com/compas-dev/compas
2 parents 210e105 + 25213f5 commit 08930e7

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1414
* Added `compas_rhino.install_with_pip`.
1515
* Added `before_draw` pluggable to `compas.scene.Scene.draw`.
1616
* Added `after_draw` pluggable to `compas.scene.Scene.draw`.
17+
* Added description in tutorial about `compas.scene.context`.
1718

1819
### Changed
1920

docs/userguide/basics.visualisation.rst

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,3 +114,31 @@ To use a different scene object as the parent, the parent attribute of the scene
114114
>>> boxobj = scene.add(box, parent=pointobj)
115115
>>> boxobj.parent
116116
PointObject
117+
118+
119+
Scene Context
120+
=============
121+
122+
Depending on where the code is executed, the "scene" will detect the current visualisation context.
123+
If the code is executed in the Rhino, the scene context will be automatically set as "Rhino".
124+
125+
>>> from compas.scene import Scene
126+
>>> from compas.geometry import Box
127+
>>> scene = Scene()
128+
>>> scene.context
129+
Rhino
130+
131+
For every context, the appropriate scene object implementations will be used automatically.
132+
133+
>>> box = Box.from_width_height_depth(1, 1, 1)
134+
>>> scene.add(box)
135+
<compas_rhino.scene.BoxObject>
136+
137+
Users can also set the scene context manually:
138+
139+
>>> scene = Scene(context="MyContextName")
140+
>>> scene.context
141+
MyContextName
142+
143+
The currently supported contexts are: "Viewer", "Rhino", "Grasshopper", "Blender" and None.
144+
For working with different contexts please refer to the next section "Tutorial: Working in CAD".

0 commit comments

Comments
 (0)