enthought / enthought/mayavi

What does this error mean and how can I fix it?

Open
#886 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
1.4k
Forks
316
Avg merge
7h 44m
Merged PRs (30d)
5

Description

Using `python3.7` and `mayavi 4.6.2` on `macOS 10.14.5`

Simply attempting to add multiple `VTK` files to the mayavi engine and plot their surfaces. Doing this in a `for` loop as I don't see any other way to add multiple files in.

When I run the code below I receive the following errors:
```
This scene is not managed by mayavi
Current object is not active, please select an active object.
This scene is not managed by mayavi
Current object is not active, please select an active object.
This scene is not managed by mayavi
Current object is not active, please select an active object.
```
**Code**
```
from mayavi import mlab
from mayavi.modules.surface import Surface
from mayavi.modules.outline import Outline
from mayavi.core.scene import Scene
from glob import glob

files = sorted(glob("/path/to/vtk/files/*.vtk"))

fig = mlab.figure()
engine = mlab.get_engine()
mayavi_viewer = engine.new_scene()

scene = Scene()
surface = Surface()
surface.actor.property.representation = 'surface'

q = [] #engine
p = [] #surface

for i, fyle in enumerate(files):
q.append(engine.open(fyle, scene))
p.append(Surface())
engine.add_filter(q[i], p[i])
```

**Note** I'm trying to use the output from the `Record` option in the mayavi GUI that shows the python code as you use the GUI. However, the GUI only allows files to be loaded one at a time, as well as surfaces and outlines plotted one at a time. I would like to do this all at once for multiple files. Thanks!

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.