4

Okay, a little background here. I made a script that plots a dataset as 3d line plots using mlab.plot3d(), multiple times in Mayavi, after reading it from an xlsx file. Now, I am trying to make a web app to see the created 3d models in a web browser interactively. After some search, I found xtk and thought about saving the Mayavi output as a .vtk file, and viewing it online using xtk.

Question 1: is it a stupid plan? are there easier ways? Question 2: if it's feasible, how do I output all the components of a mlab scene into a single vtk file?

I searched and found the save_output() function from the mayavi pipeline children using record, but that only seems to work for single objects. Any idea how to do it for the whole scene?

  • Mayavi doesn't offer an API that I know of to write directly to vtk. However, it does offer true vtk scenes -- you can convert the mayavi scene to a vtk scene directly. Therefore you can do vtk programming directly. Alternately there are some packages (that I dont otherwise know anything about) that attempt to provide layers to manipulating vtk images in python, like pyvtk. – aestrivex Jun 24 '14 at 21:00
  • Hello, did you ever work out how to do this? – Razor Robotics May 06 '16 at 21:26

1 Answers1

0

If you have installed mayavi, then you'll have included the tvtk python library, which is one of its dependencies. The documentation gives some examples how you can write your structures to a vtk file using the write_data function.

DaveP
  • 6,952
  • 1
  • 24
  • 37