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