diff --git a/scripts/sidedock.py b/scripts/sidedock.py index c1e17b93bd..db4173ade7 100644 --- a/scripts/sidedock.py +++ b/scripts/sidedock.py @@ -1,11 +1,13 @@ from compas.geometry import Box +from compas.geometry import Translation from compas_viewer import Viewer from compas_viewer.components import Button from compas_viewer.components import Slider +box = Box(1) + viewer = Viewer() -box = Box(1, 1, 1) boxobj = viewer.scene.add(box) @@ -23,8 +25,7 @@ def slider_changed(slider: Slider, value: int): v = (value - vmin) / (vmax - vmin) - boxobj.item.frame.point.x = v * 10 - + boxobj.transformation = Translation.from_vector([10 * v, 0, 0]) boxobj.update() viewer.renderer.update() @@ -32,4 +33,5 @@ def slider_changed(slider: Slider, value: int): viewer.ui.sidedock.show = True viewer.ui.sidedock.add(Button(text="Toggle Box", action=toggle_box)) viewer.ui.sidedock.add(Slider(title="test", min_val=0, max_val=100, action=slider_changed)) + viewer.show()