예제 #1
0
def view():
    from enthought.mayavi.sources.api import VTKDataSource, VTKFileReader
    
    from enthought.mayavi.modules.outline import Outline
    from enthought.mayavi.modules.surface import Surface
    from enthought.mayavi.modules.vectors import Vectors
    from enthought.mayavi.modules.api import TensorGlyph
    from enthought.mayavi.filters.api import WarpVector, ExtractTensorComponents

    mayavi.new_scene()
    # The single type one
    #src = VTKDataSource(data = '/home/jakub/simdata/spalling/sig_app9nodes_2.vtk')
    
    #src = VTKFileReader(base_file_name = '/home/jakub/simdata/spalling/nodes_0.vtk')
    src = VTKFileReader()
    VTKFileReader()
    mayavi.add_source(src) 
    #mayavi.open_vtk('/home/jakub/simdata/spalling/sig_app9nodes_2.vtk')
    #tg = TensorGlyph()
    #tg.glyph.glyph.scale_factor = 100.
    #mayavi.add_module(tg)
    #mayavi.add_module(Surface())
    #mayavi.add_module(Vectors())
    #wv = WarpVector()
    #tc = ExtractTensorComponents()
    #mayavi.add_filter(wv)
    #mayavi.add_filter(tc)
    mayavi.add_module(Surface())
    src.base_file_name = '/home/jakub/simdata/spalling/eps_app1nodes_0.vtk'
예제 #2
0
    def rebuild_pipeline( self, pd ):
        src = VTKFileReader( base_file_name = '%s_0.vtk' % self.position )
        self.engine.add_source( src )
        if self.warp:
            self.engine.add_filter( WarpVector() )

        if self.name in src._point_tensors_list:
            src.point_tensors_name = self.name
            self.engine.add_filter( ExtractTensorComponents() )
        elif self.name in src._point_vectors_list:
            src.point_vectors_name = self.name
            self.engine.add_filter( ExtractVectorComponents() )
        elif self.name in src._point_scalars_list:
            src.point_scalars_name = self.name
        s = Surface()
        s.actor.property.point_size = 5.
        self.engine.add_module( s )
        src.scene.z_plus_view()