def show_mesh(file_name, ndim): mayavi_engine = Engine() mayavi_engine.start() mayavi_engine.new_scene() # View the MayaVi pipeline engine_view = EngineView(engine=mayavi_engine) ui = engine_view.edit_traits() # Setup MayaVi pipeline src = TriangleReader() if (ndim == 2): src.initialize(file_name+'.edge') # Load the 2D .edge file else: src.initialize(file_name+'.face') # Load the 3D .face file mayavi_engine.add_source(src) # Add any filters, modules here in the order that they are to appear in the pipeline mayavi_engine.add_module(Surface())
def new_engine(self): """ Creates a new engine, envisage or not depending on the options. """ check_backend() if options.backend == 'envisage': from enthought.mayavi.plugins.app import Mayavi m = Mayavi(start_gui_event_loop=False) m.main() process_ui_events() window = m.application.workbench.active_window engine = window.get_service(Engine) elif options.backend == 'test': engine = NullEngine(name='Null Mlab Engine') engine.start() else: if options.offscreen: engine = OffScreenEngine(name='Mlab offscreen Engine') engine.start() else: engine = Engine(name='Mlab Engine') engine.start() self.current_engine = engine return engine
def __engine_default(self): e = Engine() e.start() e.new_scene(self._scene) return e