compas-dev / compas-dev/compas_viewer

Init object automatically

Open
#202 0 comments 0 reactions 1 assignee Claimed by @Licini View on GitHub
Dominant language
Python
Stars
12
Forks
12
PR merge metrics
No merged PRs in 30d

Description

```python
from compas.geometry import Box
from compas_viewer import Viewer

viewer = Viewer()
box = Box(1)
boxobj = viewer.scene.add(box)

ticker = True


@viewer.on(interval=1000)
def reload(frame):

global boxobj, ticker

if ticker:
print("removing box")
viewer.scene.remove(boxobj)
else:
print("Adding box")
boxobj = viewer.scene.add(box)
boxobj.init() # This should not be necessary

ticker = not ticker
viewer.renderer.update()

viewer.show()
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.