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
21 if not ('servermanager' in dir()):
22 from pvsimple import *
27 """This method demonstrates an artificial data sources,
28 probes it with a line, etc"""
33 v = CreateRenderView()
34 v.CameraPosition = [-30, -20, -65]
35 v.CameraFocalPoint = [0.0, 0.0, 0.0]
36 v.CameraViewUp = [-0.65, -0.55, 0.5]
37 v.CameraViewAngle = [30]
41 # Get some information about the data. First, for the source to execute
44 di = src.GetDataInformation()
45 print "Data type:", di.GetPrettyDataTypeString()
46 print "Extent:", di.GetExtent()
48 ##src.Representation = 3 # outline
52 # Apply a contour filter
53 cf = Contour(Input = src)
54 cf.ContourBy = ['POINTS', 'RTData']
55 cf.Isosurfaces = [37.353099999999998, 63.961533333333335, 90.569966666666673, 117.1784, 143.78683333333333, 170.39526666666666,
56 197.00370000000001, 223.61213333333333, 250.22056666666668, 276.82900000000001]
60 SetViewProperties(Background = [.50, .20, .30])
63 # Reset the camera to include the whole thing
66 rv.CameraPosition = [-2.50, 60, -40]
67 rv.CameraFocalPoint = [1.25, 1.0, 1.35]
68 rv.CameraViewUp = [-0.955, 0.1, 0.25]
69 rv.CameraViewAngle = [30]
72 # Now, let's probe the data
73 probe = ResampleWithDataset(Input=src)
76 line = Line(Resolution=60)
78 # that spans the dataset
79 bounds = di.GetBounds()
81 print "Bounds: ", bounds
82 line.Point1 = bounds[0:6:2]
83 line.Point2 = bounds[1:6:2]
87 # Render with the line
90 WriteImage(filename = (impth + "demo3_1.png"), view=v, Magnification=2)
91 WriteImage(filename = (impth + "demo3_2.png"), view=rv, Magnification=2)
94 scriptdir = inspect.getframeinfo(inspect.currentframe())[0]
95 testdir = os.path.dirname( os.path.abspath(scriptdir) )
98 if __name__ == "__main__":
99 demo3(impth=testdir+"/Pic/")