1 # Copyright (C) 2010-2016 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 *
26 cell_entity = EntityType.CELL
27 node_entity = EntityType.NODE
30 print("**** Step1: Import MED file")
32 print('Import "ResOK_0000.med"...............', end=' ')
33 file_path = datadir + "ResOK_0000.med"
34 pvsimple.OpenDataFile(file_path)
35 med_reader = pvsimple.GetActiveSource()
37 if med_reader is None:
45 print("**** Step2: Mesh creation")
47 print("Creating mesh.............", end=' ')
48 mesh = MeshOnEntity(med_reader, mesh_name, cell_entity)
54 # 3. Changing type of presentation of mesh
55 print("**** Step3: Changing type of presentation of mesh")
57 view = pvsimple.GetRenderView()
58 display_only(mesh, view)
61 mesh.Representation = 'Wireframe'
63 prs_type = mesh.Representation
64 print("Presentation type..", prs_type)
66 mesh.Representation = 'Points'
68 prs_type = mesh.Representation
69 print("Presentation type..", prs_type)
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)
76 display_only(mesh, view)
77 mesh.Representation = 'Surface With Edges'
79 prs_type = mesh.Representation
80 print("Presentation type..", prs_type)
82 # 4. Changing Cell color of mesh
83 print("**** Step4: Changing Cell color of mesh")
85 color = mesh.DiffuseColor
86 print("Mesh Cell color in RGB....(", color[0], ",", color[1], ",", color[2], ")")
89 mesh.DiffuseColor = color
90 color = mesh.DiffuseColor
91 print("Mesh Cell color in RGB....(", color[0], ",", color[1], ",", color[2], ")")
94 # 5. Changing Node color of mesh
95 print("**** Step4: Changing Node color of mesh")
97 color = mesh.AmbientColor
98 print("Mesh Node color in RGB....(", color[0], ",", color[1], ",", color[2], ")")
101 mesh.AmbientColor = color
102 color = mesh.AmbientColor
103 print("Mesh Node color in RGB....(", color[0], ",", color[1], ",", color[2], ")")
106 ## Note: no special property for edge color in PARAVIS; skip link color changing ( SetLinkColor()/GetLinkColor() methods )