1 # Copyright (C) 2010-2013 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.
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/bugs3/D6 case
22 from paravistest import datadir
23 from presentations import *
27 my_paravis = paravis.myParavis
30 med_file_path = datadir + "fra.med"
32 my_paravis.ImportFile(med_file_path)
33 med_reader = pvsimple.GetActiveSource()
35 # 2. Creation of CutSegment presentations, based on time stamps of "VITESSE" field
36 point1 = [0.0, 0.0, 0.0]
37 point2 = [0.4, 0.05, 1.0]
38 cut_segment1 = CutSegmentOnField(med_reader, EntityType.NODE, "VITESSE", 1,
40 if cut_segment1 == None:
41 raise RuntimeError, "ERROR!!! The first CutSegment presentation is not built!"
43 # 3. Creation of CutSegment presentations, based on time stamps of "TAUX_DE_VIDE" field
45 point2 = [0.2055, 0.0685, 0.541]
46 cut_segment2 = CutSegmentOnField(med_reader, EntityType.NODE, "TAUX_DE_VIDE", 1,
48 if cut_segment2 == None:
49 raise RuntimeError, "ERROR!!! The second CutSegment presentation is not built!"
51 # 4. Creation of Table based on CutSegment presentation
53 # TODO: it's possible to display CutSegment (PlotOverLine in terms of ParaViS) presentation
54 # as a table in GUI, but it seems that there is no possibility to create table view
55 # (spreadsheet view in terms of ParaViS) from in Python script
57 # 5. Creation of curve based on Table
58 xy_view = pv.CreateXYPlotView()
60 curve1 = pv.Show(cut_segment1.Input, xy_view)
62 raise RuntimeError, " ERROR!!! Curve based on the first CutSegment is not built!"
64 curve2 = pv.Show(cut_segment2.Input, xy_view)
66 raise RuntimeError, " ERROR!!! Curve based on the second CutSegment is not built!"
68 curves = [curve1, curve2]
70 c.AttributeType = 'Point Data'
71 c.UseIndexForXAxis = 0
72 c.XArrayName = 'arc_length'
74 pvsimple.SetActiveSource(cut_segment1.Input)
75 set_visible_lines(curve1, ['VITESSE (Magnitude)'])
77 pvsimple.SetActiveSource(cut_segment2.Input)
78 set_visible_lines(curve2, ['TAUX_DE_VIDE'])
80 pvsimple.ResetCamera(xy_view)