Esempio n. 1
0
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())