def main(): # Create the MayaVi engine and start it. e = Engine() # Starting the engine registers the engine with the registry and # notifies others that the engine is ready. e.start() # Do this if you need to see the MayaVi tree view UI. ev = EngineView(engine=e) ui = ev.edit_traits() # Create a new scene. scene = e.new_scene() # Now create a new scene just for kicks. scene1 = e.new_scene() # Now setup a normal MayaVi pipeline. src = VTKXMLFileReader() src.initialize(join(get_data_dir(abspath(__file__)), 'fire_ug.vtu')) e.add_source(src) e.add_module(Outline()) e.add_module(ScalarCutPlane()) e.add_module(Streamline()) return e, ui
def main(): # Create the MayaVi engine and start it. e = Engine() # Starting the engine registers the engine with the registry and # notifies others that the engine is ready. e.start() # Do this if you need to see the MayaVi tree view UI. ev = EngineView(engine=e) ui = ev.edit_traits() # Create a new scene. scene = e.new_scene() # Now create a new scene just for kicks. scene1 = e.new_scene() # Now setup a normal MayaVi pipeline. src = VTKXMLFileReader() src.initialize(join(get_data_dir(abspath(__file__)), 'fire_ug.vtu')) e.add_source(src) e.add_module(Outline()) e.add_module(ScalarCutPlane()) e.add_module(Streamline()) return e, ui
def main(): # Create the MayaVi engine and start it. e = Engine() # Starting the engine registers the engine with the registry and # notifies others that the engine is ready. e.start() # Do this if you need to see the MayaVi tree view UI. ev = EngineView(engine=e) ui = ev.edit_traits() # Create a new scene. #scene = e.new_scene() #renderLearningData('pattern.json') #scene = e.new_scene() #renderLearningData('pattern2.json') #renderLearningData('pattern3.json') scene = e.new_scene() ExampleRenderer('cluster.json', scene) scene = e.new_scene() ExampleRenderer('nocluster.json', scene) show() return e, ui
@author: Schmulius """ from mayavi.modules.scalar_cut_plane import ScalarCutPlane from pyface.timer.api import Timer from mayavi.core.api import Engine from mayavi.core.base import Base from mayavi.core.module import Module from mayavi.core.lut_manager import LUTManager from mayavi.core.common import handle_children_state, exception from mayavi.core.pipeline_info import PipelineInfo scp = Engine() scp.start() scene = scp.new_scene() scp = ScalarCutPlane() # set scp as ScalarCutPlane() module # add module to the scene scp.implicit_plane.normal = (1, 0, 0) # set normal to Ox axis # set origin to (i=10, j=25, k=25) i.e. integers for a structured grid scp.implicit_plane.origin = (10, 25, 25) # set origin to (x=1.0, y=2.5, z=2.5) i.e. reals for unstructured grids # scp.implicit_plane.origin = (1.0, 2.5, 2.5) scp.implicit_plane.widget.enabled = True scp.actor.property.diffuse = 0.0 # set some color properties scp.actor.property.ambient = 1.0 # scp.actor.property.opacity = 1.0 # #scp.module_manager.scalar_lut_manager.data_range = [0, 1]
import os from mayavi.core.api import Engine from mayavi.sources.vtk_file_reader import VTKFileReader from mayavi.modules.surface import Surface vtkFile = 'flow.vtk' # Create the MayaVi engine and start it. engine = Engine() engine.start() scene = engine.new_scene() # Read in VTK file and add as source reader = VTKFileReader() reader.initialize(vtkFile) engine.add_source(reader) # Add Surface Module surface = Surface() engine.add_module(surface) # Move the camera scene.scene.camera.elevation(-70) # Save scene to image file scene.scene.save_png('image.png') # Create a GUI instance and start the event loop. # This stops the window from closing from enthought.pyface.api import GUI gui = GUI()
@author: ethansolomon """ import os from mayavi.core.api import Engine from mayavi.sources.vtk_file_reader import VTKFileReader from mayavi.modules.surface import Surface vtkFile_l = 'lh.vtk' vtkFile_r = 'rh.vtk' # Create the MayaVi engine and start it. engine = Engine() engine.start() scene = engine.new_scene() # Read in VTK file and add as source reader1 = VTKFileReader() reader1.initialize(vtkFile_l) engine.add_source(reader1) # Add Surface Module surface = Surface() engine.add_module(surface) # Move the camera scene.scene.camera.elevation(90) scene.scene.camera.azimuth(-180) # Save scene to image file
from mayavi.core.pipeline_info import PipelineInfo from mayavi import mlab from mayavi import tools from numpy import array #--------------------------------------------------------------------------------------- #__________________________________ start mayavi engine _______________________________# #--------------------------------------------------------------------------------------- try: engine = mayavi.engine except NameError: from mayavi.api import Engine engine = Engine() engine.start() if len(engine.scenes) == 0: engine.new_scene() #--------------------------------------------------------------------------------------- #__________________________________ load data ____________________________________# #--------------------------------------------------------------------------------------- vtkxml_file_reader = engine.open( '/Volumes/esd01/docs/jloos/data_small/runs_elmerice_refined/Mesh20_5001000_0_0.1/Mesh/ForwardRemesh100M20L0011.pvtu' ) # Set time-step for visualisation; depending on simulation setting time-step cann range between # 0.1 and 0.5 = 2 (two time sizes 1a) from mayavi.modules.surface import Surface surface = Surface() engine.add_module(surface, obj=None)