1 # Copyright (C) 2017-2020 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
19 # Author : Anthony Geay (EDF R&D)
21 #### import the simple module from the paraview
22 from paraview.simple import *
23 #### disable automatic camera reset on 'Show'
24 paraview.simple._DisableFirstRenderCameraReset()
26 # create a new 'Wavelet'
29 # Properties modified on wavelet1
30 wavelet1.WholeExtent = [0, 10, 0, 10, 0, 10]
33 renderView1 = GetActiveViewOrCreate('RenderView')
34 # uncomment following to set a specific view size
35 # renderView1.ViewSize = [1168, 582]
38 wavelet1Display = Show(wavelet1, renderView1)
40 # trace defaults for the display properties.
41 wavelet1Display.Representation = 'Outline'
42 wavelet1Display.ColorArrayName = ['POINTS', '']
43 wavelet1Display.OSPRayScaleArray = 'RTData'
44 wavelet1Display.OSPRayScaleFunction = 'PiecewiseFunction'
45 wavelet1Display.SelectOrientationVectors = 'None'
46 wavelet1Display.SelectScaleArray = 'RTData'
47 wavelet1Display.GlyphType = 'Arrow'
48 wavelet1Display.GlyphTableIndexArray = 'RTData'
49 wavelet1Display.DataAxesGrid = 'GridAxesRepresentation'
50 wavelet1Display.PolarAxes = 'PolarAxesRepresentation'
51 wavelet1Display.ScalarOpacityUnitDistance = 1.7320508075688779
52 wavelet1Display.Slice = 5
53 wavelet1Display.GaussianRadius = 0.5
54 wavelet1Display.SetScaleArray = ['POINTS', 'RTData']
55 wavelet1Display.ScaleTransferFunction = 'PiecewiseFunction'
56 wavelet1Display.OpacityArray = ['POINTS', 'RTData']
57 wavelet1Display.OpacityTransferFunction = 'PiecewiseFunction'
58 wavelet1Display.InputVectors = [None, '']
59 wavelet1Display.SelectInputVectors = [None, '']
60 wavelet1Display.WriteLog = ''
62 # init the 'PiecewiseFunction' selected for 'ScaleTransferFunction'
63 wavelet1Display.ScaleTransferFunction.Points = [-16.577068328857422, 0.0, 0.5, 0.0, 260.0, 1.0, 0.5, 0.0]
65 # init the 'PiecewiseFunction' selected for 'OpacityTransferFunction'
66 wavelet1Display.OpacityTransferFunction.Points = [-16.577068328857422, 0.0, 0.5, 0.0, 260.0, 1.0, 0.5, 0.0]
68 # reset view to fit data
69 renderView1.ResetCamera()
71 # update the view to ensure updated data information
74 # create a new 'Slice'
75 slice1 = Slice(Input=wavelet1)
76 slice1.SliceType = 'Plane'
77 slice1.SliceOffsetValues = [0.0]
79 # init the 'Plane' selected for 'SliceType'
80 slice1.SliceType.Origin = [5.0, 5.0, 5.0]
82 # toggle 3D widget visibility (only when running from the GUI)
83 Show3DWidgets(proxy=slice1.SliceType)
85 # Properties modified on slice1
86 slice1.SliceType = 'Cylinder'
89 slice1Display = Show(slice1, renderView1)
91 # get color transfer function/color map for 'RTData'
92 rTDataLUT = GetColorTransferFunction('RTData')
94 # trace defaults for the display properties.
95 slice1Display.Representation = 'Surface'
96 slice1Display.ColorArrayName = ['POINTS', 'RTData']
97 slice1Display.LookupTable = rTDataLUT
98 slice1Display.OSPRayScaleArray = 'RTData'
99 slice1Display.OSPRayScaleFunction = 'PiecewiseFunction'
100 slice1Display.SelectOrientationVectors = 'None'
101 slice1Display.SelectScaleArray = 'RTData'
102 slice1Display.GlyphType = 'Arrow'
103 slice1Display.GlyphTableIndexArray = 'RTData'
104 slice1Display.DataAxesGrid = 'GridAxesRepresentation'
105 slice1Display.PolarAxes = 'PolarAxesRepresentation'
106 slice1Display.GaussianRadius = 0.5
107 slice1Display.SetScaleArray = ['POINTS', 'RTData']
108 slice1Display.ScaleTransferFunction = 'PiecewiseFunction'
109 slice1Display.OpacityArray = ['POINTS', 'RTData']
110 slice1Display.OpacityTransferFunction = 'PiecewiseFunction'
111 slice1Display.InputVectors = [None, '']
112 slice1Display.SelectInputVectors = [None, '']
113 slice1Display.WriteLog = ''
115 # init the 'PiecewiseFunction' selected for 'ScaleTransferFunction'
116 slice1Display.ScaleTransferFunction.Points = [-14.761041641235352, 0.0, 0.5, 0.0, 232.8310546875, 1.0, 0.5, 0.0]
118 # init the 'PiecewiseFunction' selected for 'OpacityTransferFunction'
119 slice1Display.OpacityTransferFunction.Points = [-14.761041641235352, 0.0, 0.5, 0.0, 232.8310546875, 1.0, 0.5, 0.0]
121 # show color bar/color legend
122 slice1Display.SetScalarBarVisibility(renderView1, True)
124 # update the view to ensure updated data information
127 # create a new 'Developed Surface'
128 developedSurface1 = DevelopedSurface(Input=slice1)
130 #### saving camera placements for all active views
132 # current camera placement for renderView1
133 renderView1.CameraPosition = [5.0, 5.0, 38.46065214951232]
134 renderView1.CameraFocalPoint = [5.0, 5.0, 5.0]
135 renderView1.CameraParallelScale = 8.660254037844387
137 #### uncomment the following to render all views
139 # alternatively, if you want to write images, you can use SaveScreenshot(...).