day2/MEDIA/m2/data/test.py
changeset 22 492017122355
equal deleted inserted replaced
21:844b81ad2a3c 22:492017122355
       
     1 # Recorded script from Mayavi2
       
     2 from numpy import array
       
     3 try:
       
     4     engine = mayavi.engine
       
     5 except NameError:
       
     6     from enthought.mayavi.api import Engine
       
     7     engine = Engine()
       
     8     engine.start()
       
     9 if len(engine.scenes) == 0:
       
    10     engine.new_scene()
       
    11 # ------------------------------------------- 
       
    12 scene = engine.scenes[0]
       
    13 vtkxml_file_reader = engine.open(u'/Users/prabhu/work/MEDIA/m2/data/solution.vtp', scene)
       
    14 from enthought.mayavi.modules.surface import Surface
       
    15 surface = Surface()
       
    16 engine.add_filter(surface, vtkxml_file_reader)
       
    17 scene.scene.camera.position = [-7.8710042803035831, -23.270734468965951, 26.848457084803901]
       
    18 scene.scene.camera.focal_point = [-0.30313491821289062, 0.0, 1.4027749300003052]
       
    19 scene.scene.camera.view_angle = 30.0
       
    20 scene.scene.camera.view_up = [-0.18791276028283388, 0.75198808427818908, 0.63182490899497246]
       
    21 scene.scene.camera.clipping_range = [21.722908882245918, 52.482070417945934]
       
    22 scene.scene.camera.compute_view_plane_normal()
       
    23 scene.scene.render()
       
    24 scene.scene.camera.position = [-29.36388986802725, -16.258291095191616, 13.125528963969458]
       
    25 scene.scene.camera.focal_point = [-0.30313491821289062, 0.0, 1.4027749300003052]
       
    26 scene.scene.camera.view_angle = 30.0
       
    27 scene.scene.camera.view_up = [0.17522011839126639, 0.35024314762581926, 0.92012371323214404]
       
    28 scene.scene.camera.clipping_range = [16.803351361631922, 58.674779759221536]
       
    29 scene.scene.camera.compute_view_plane_normal()
       
    30 scene.scene.render()
       
    31 surface.actor.property.edge_visibility = True
       
    32 surface.actor.property.line_width = 1.1832000017166138
       
    33 surface.actor.property.line_width = 1.1831999999999998
       
    34 vtkxml_file_reader1 = engine.open(u'/Users/prabhu/work/MEDIA/m2/data/shuttle_flow_vel.vti', scene)
       
    35 from enthought.mayavi.filters.extract_vector_norm import ExtractVectorNorm
       
    36 extract_vector_norm = ExtractVectorNorm()
       
    37 engine.add_filter(extract_vector_norm, vtkxml_file_reader1)
       
    38 from enthought.mayavi.modules.streamline import Streamline
       
    39 streamline = Streamline()
       
    40 engine.add_filter(streamline, extract_vector_norm)
       
    41 from enthought.mayavi.modules.outline import Outline
       
    42 outline = Outline()
       
    43 module_manager1 = extract_vector_norm.children[0]
       
    44 engine.add_filter(outline, module_manager1)
       
    45 scene.scene.camera.position = [-35.527291132838059, 1.5271766756373661, 3.1941487321866866]
       
    46 scene.scene.camera.focal_point = [-0.30313491821289062, 0.0, 1.4027749300003052]
       
    47 scene.scene.camera.view_angle = 30.0
       
    48 scene.scene.camera.view_up = [0.061459962287939186, 0.30146804029963314, 0.9514934018233987]
       
    49 scene.scene.camera.clipping_range = [16.205447930141609, 60.499114495812179]
       
    50 scene.scene.camera.compute_view_plane_normal()
       
    51 scene.scene.render()
       
    52 streamline.seed.widget.center = array([-0.25031545, -0.70449392, -2.82145082])
       
    53 streamline.seed.widget.handle_direction = array([ 1.,  0.,  0.])
       
    54 scene.scene.camera.position = [-18.768485102212434, -27.67378446387562, 13.212726909551698]
       
    55 scene.scene.camera.focal_point = [-0.30313491821289062, 0.0, 1.4027749300003052]
       
    56 scene.scene.camera.view_angle = 30.0
       
    57 scene.scene.camera.view_up = [0.43630018818630739, 0.090909067630530527, 0.89519701027826293]
       
    58 scene.scene.camera.clipping_range = [12.911509899232243, 64.852594297042543]
       
    59 scene.scene.camera.compute_view_plane_normal()
       
    60 scene.scene.render()
       
    61 streamline.seed.widget.center = array([-4.35750409,  1.91665121, -3.10118704])
       
    62 streamline.seed.widget.handle_direction = array([ 1.,  0.,  0.])
       
    63 streamline.seed.widget.center = array([-4.35750409,  1.91665121, -3.10118704])
       
    64 streamline.seed.widget.handle_direction = array([ 1.,  0.,  0.])
       
    65 # ------------------------------------------- 
       
    66 from enthought.mayavi.tools.show import show
       
    67 show()