Salome HOME
Merge branch 'V7_dev'
[modules/paravis.git] / test / VisuPrs / imps / B1.py
1 # Copyright (C) 2010-2016  CEA/DEN, EDF R&D
2 #
3 # This library is free software; you can redistribute it and/or
4 # modify it under the terms of the GNU Lesser General Public
5 # License as published by the Free Software Foundation; either
6 # version 2.1 of the License, or (at your option) any later version.
7 #
8 # This library is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 # Lesser General Public License for more details.
12 #
13 # You should have received a copy of the GNU Lesser General Public
14 # License along with this library; if not, write to the Free Software
15 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 #
17 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 #
19
20 # This case corresponds to: /visu/imps/B1 case
21
22 from paravistest import datadir, texturesdir
23 from presentations import *
24 import pvsimple
25
26 # Import MED file
27 file_path = datadir + "fra.med"
28 pvsimple.OpenDataFile(file_path)
29 med_reader = pvsimple.GetActiveSource()
30
31 entity = EntityType.NODE
32 field_name = "VITESSE"
33 timestamp_id = 1
34
35 # Create Scalar Map
36 scalarmap = ScalarMapOnField(med_reader, entity, field_name, timestamp_id)
37
38 scalarmap.Visibility = 1
39 reset_view()
40
41 # Set representation type to Point Sprite
42 scalarmap.Representation = 'Point Sprite'
43
44 # Set texture
45 scalarmap.RenderMode = 'Texture'
46 # COMMENTED OUT! Currently this does not work as Point Sprite ParaView plugin is not correctly wrapped to Python.
47 # As soon as problem is fixed, below code probably need to be modified, but it should be something similar.
48 #import vtk
49 #texture = vtk.vtkTexture()
50 #pngReader = vtk.vtkPNGReader()
51 #pngReader.SetFileName(os.path.join(texturesdir, "texture1.png"))
52 #texture.SetInputConnection(pngReader.GetOutputPort())
53 #texture.InterpolateOn()
54 #scalarmap.Texture = texture
55
56 pvsimple.Render()