1 # Copyright (C) 2010-2015 CEA/DEN, EDF R&D
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.
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.
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
17 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 # This case corresponds to: /visu/united/A5 case
22 from paravistest import datadir
23 from presentations import *
24 import pvserver as paravis
27 my_paravis = paravis.myParavis
29 cell_entity = EntityType.CELL
30 node_entity = EntityType.NODE
33 print "**** Step1: Import MED file"
35 print 'Import "ResOK_0000.med"...............',
36 file_path = datadir + "ResOK_0000.med"
37 OpenDataFile(file_path)
38 med_reader = pvsimple.GetActiveSource()
40 if med_reader is None:
48 print "**** Step2: Mesh creation"
50 print "Creating mesh.............",
51 mesh = MeshOnEntity(med_reader, mesh_name, cell_entity)
57 # 3. Changing type of presentation of mesh
58 print "**** Step3: Changing type of presentation of mesh"
60 view = pvsimple.GetRenderView()
61 display_only(mesh, view)
64 mesh.Representation = 'Wireframe'
66 prs_type = mesh.Representation
67 print "Presentation type..", prs_type
69 mesh.Representation = 'Points'
71 prs_type = mesh.Representation
72 print "Presentation type..", prs_type
74 # make shrink, in PARAVIS it's not a representation type: use shrink filter
75 shrink = pvsimple.Shrink(med_reader)
76 mesh_shrinked = pvsimple.GetRepresentation(shrink)
77 display_only(mesh_shrinked, view)
79 display_only(mesh, view)
80 mesh.Representation = 'Surface With Edges'
82 prs_type = mesh.Representation
83 print "Presentation type..", prs_type
85 # 4. Changing Cell color of mesh
86 print "**** Step4: Changing Cell color of mesh"
88 color = mesh.DiffuseColor
89 print "Mesh Cell color in RGB....(", color[0], ",", color[1], ",", color[2], ")"
92 mesh.DiffuseColor = color
93 color = mesh.DiffuseColor
94 print "Mesh Cell color in RGB....(", color[0], ",", color[1], ",", color[2], ")"
97 # 5. Changing Node color of mesh
98 print "**** Step4: Changing Node color of mesh"
100 color = mesh.AmbientColor
101 print "Mesh Node color in RGB....(", color[0], ",", color[1], ",", color[2], ")"
104 mesh.AmbientColor = color
105 color = mesh.AmbientColor
106 print "Mesh Node color in RGB....(", color[0], ",", color[1], ",", color[2], ")"
109 ## Note: no special property for edge color in PARAVIS; skip link color changing ( SetLinkColor()/GetLinkColor() methods )