Salome HOME
Update ParaVis non-regression test base in the following ways:
[modules/paravis.git] / test / VisuPrs / united / A5.py
1 # Copyright (C) 2010-2015  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/united/A5 case
21
22 from paravistest import datadir
23 from presentations import *
24 import pvsimple
25
26 cell_entity = EntityType.CELL
27 node_entity = EntityType.NODE
28
29 # 1. Import MED file
30 print "**** Step1: Import MED file"
31
32 print 'Import "ResOK_0000.med"...............',
33 file_path = datadir + "ResOK_0000.med"
34 pvsimple.OpenDataFile(file_path)
35 med_reader = pvsimple.GetActiveSource()
36
37 if med_reader is None:
38     print "FAILED"
39 else:
40     print "OK"
41
42 mesh_name = 'dom'
43
44 # 2. Creating mesh
45 print "**** Step2: Mesh creation"
46
47 print "Creating mesh.............",
48 mesh = MeshOnEntity(med_reader, mesh_name, cell_entity)
49 if mesh is None:
50     print "FAILED"
51 else:
52     print "OK"
53
54 # 3. Changing type of presentation of mesh
55 print "**** Step3: Changing type of presentation of mesh"
56
57 view = pvsimple.GetRenderView()
58 display_only(mesh, view)
59 reset_view(view)
60
61 mesh.Representation = 'Wireframe'
62 pvsimple.Render()
63 prs_type = mesh.Representation
64 print "Presentation type..", prs_type
65
66 mesh.Representation = 'Points'
67 pvsimple.Render()
68 prs_type = mesh.Representation
69 print "Presentation type..", prs_type
70
71 # make shrink, in PARAVIS it's not a representation type: use shrink filter
72 shrink = pvsimple.Shrink(med_reader)
73 mesh_shrinked = pvsimple.GetRepresentation(shrink)
74 display_only(mesh_shrinked, view)
75
76 display_only(mesh, view)
77 mesh.Representation = 'Surface With Edges'
78 pvsimple.Render()
79 prs_type = mesh.Representation
80 print "Presentation type..", prs_type
81
82 # 4. Changing Cell color of mesh
83 print "**** Step4: Changing Cell color of mesh"
84
85 color = mesh.DiffuseColor
86 print "Mesh Cell color in RGB....(", color[0], ",", color[1], ",", color[2], ")"
87
88 color = [0, 0, 1]
89 mesh.DiffuseColor = color
90 color = mesh.DiffuseColor
91 print "Mesh Cell color in RGB....(", color[0], ",", color[1], ",", color[2], ")"
92 pvsimple.Render()
93
94 # 5. Changing Node color of mesh
95 print "**** Step4: Changing Node color of mesh"
96
97 color = mesh.AmbientColor
98 print "Mesh Node color in RGB....(", color[0], ",", color[1], ",", color[2], ")"
99
100 color = [0, 1, 0]
101 mesh.AmbientColor = color
102 color = mesh.AmbientColor
103 print "Mesh Node color in RGB....(", color[0], ",", color[1], ",", color[2], ")"
104 pvsimple.Render()
105
106 ## Note: no special property for edge color in PARAVIS; skip link color changing ( SetLinkColor()/GetLinkColor() methods )