1 # Copyright (C) 2017 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 'MED Reader'
27 multiTSmed = MEDReader(FileName='multiTS.med')
28 multiTSmed.AllArrays = ['TS0/Mesh/ComSup0/Pressure@@][@@P0']
29 multiTSmed.AllTimeSteps = ['0000', '0001', '0002', '0003', '0004', '0005', '0006', '0007', '0008', '0009']
32 animationScene1 = GetAnimationScene()
34 # update animation scene based on data timesteps
35 animationScene1.UpdateAnimationUsingDataTimeSteps()
38 renderView1 = GetActiveViewOrCreate('RenderView')
39 # uncomment following to set a specific view size
40 # renderView1.ViewSize = [1499, 582]
43 multiTSmedDisplay = Show(multiTSmed, renderView1)
45 # trace defaults for the display properties.
46 multiTSmedDisplay.Representation = 'Surface'
47 multiTSmedDisplay.ColorArrayName = [None, '']
48 multiTSmedDisplay.OSPRayScaleArray = 'FamilyIdNode'
49 multiTSmedDisplay.OSPRayScaleFunction = 'PiecewiseFunction'
50 multiTSmedDisplay.SelectOrientationVectors = 'FamilyIdNode'
51 multiTSmedDisplay.ScaleFactor = 0.07399989366531372
52 multiTSmedDisplay.SelectScaleArray = 'FamilyIdNode'
53 multiTSmedDisplay.GlyphType = 'Arrow'
54 multiTSmedDisplay.GlyphTableIndexArray = 'FamilyIdNode'
55 multiTSmedDisplay.DataAxesGrid = 'GridAxesRepresentation'
56 multiTSmedDisplay.PolarAxes = 'PolarAxesRepresentation'
57 multiTSmedDisplay.ScalarOpacityUnitDistance = 0.017316274962626298
58 multiTSmedDisplay.GaussianRadius = 0.03699994683265686
59 multiTSmedDisplay.SetScaleArray = ['POINTS', 'FamilyIdNode']
60 multiTSmedDisplay.ScaleTransferFunction = 'PiecewiseFunction'
61 multiTSmedDisplay.OpacityArray = ['POINTS', 'FamilyIdNode']
62 multiTSmedDisplay.OpacityTransferFunction = 'PiecewiseFunction'
63 multiTSmedDisplay.InputVectors = [None, '']
64 multiTSmedDisplay.SelectInputVectors = [None, '']
65 multiTSmedDisplay.WriteLog = ''
67 # init the 'PiecewiseFunction' selected for 'ScaleTransferFunction'
68 multiTSmedDisplay.ScaleTransferFunction.Points = [0.0, 0.0, 0.5, 0.0, 1.1757813367477812e-38, 1.0, 0.5, 0.0]
70 # init the 'PiecewiseFunction' selected for 'OpacityTransferFunction'
71 multiTSmedDisplay.OpacityTransferFunction.Points = [0.0, 0.0, 0.5, 0.0, 1.1757813367477812e-38, 1.0, 0.5, 0.0]
73 # reset view to fit data
74 renderView1.ResetCamera()
76 # update the view to ensure updated data information
79 # create a new 'Developed Surface'
80 developedSurface1 = DevelopedSurface(Input=multiTSmed)
81 developedSurface1.SliceType = 'Cylinder'
83 # init the 'Cylinder' selected for 'SliceType'
84 developedSurface1.SliceType.Center = [0.0, 0.0, 0.05000000074505806]
85 developedSurface1.SliceType.Radius = 0.3699994683265686
87 # Properties modified on developedSurface1.SliceType
88 developedSurface1.SliceType.Center = [0.0, 0.0, 0.05]
89 developedSurface1.SliceType.Axis = [0.0, 0.0, 1.0]
90 developedSurface1.SliceType.Radius = 0.07
92 # Properties modified on developedSurface1.SliceType
93 developedSurface1.SliceType.Center = [0.0, 0.0, 0.05]
94 developedSurface1.SliceType.Axis = [0.0, 0.0, 1.0]
95 developedSurface1.SliceType.Radius = 0.07
98 developedSurface1Display = Show(developedSurface1, renderView1)
100 # trace defaults for the display properties.
101 developedSurface1Display.Representation = 'Surface'
102 developedSurface1Display.ColorArrayName = [None, '']
103 developedSurface1Display.OSPRayScaleArray = 'FamilyIdNode'
104 developedSurface1Display.OSPRayScaleFunction = 'PiecewiseFunction'
105 developedSurface1Display.SelectOrientationVectors = 'FamilyIdNode'
106 developedSurface1Display.ScaleFactor = 0.043982297150257116
107 developedSurface1Display.SelectScaleArray = 'FamilyIdNode'
108 developedSurface1Display.GlyphType = 'Arrow'
109 developedSurface1Display.GlyphTableIndexArray = 'FamilyIdNode'
110 developedSurface1Display.DataAxesGrid = 'GridAxesRepresentation'
111 developedSurface1Display.PolarAxes = 'PolarAxesRepresentation'
112 developedSurface1Display.GaussianRadius = 0.021991148575128558
113 developedSurface1Display.SetScaleArray = ['POINTS', 'FamilyIdNode']
114 developedSurface1Display.ScaleTransferFunction = 'PiecewiseFunction'
115 developedSurface1Display.OpacityArray = ['POINTS', 'FamilyIdNode']
116 developedSurface1Display.OpacityTransferFunction = 'PiecewiseFunction'
117 developedSurface1Display.InputVectors = [None, '']
118 developedSurface1Display.SelectInputVectors = [None, '']
119 developedSurface1Display.WriteLog = ''
121 # init the 'PiecewiseFunction' selected for 'ScaleTransferFunction'
122 developedSurface1Display.ScaleTransferFunction.Points = [0.0, 0.0, 0.5, 0.0, 1.1757813367477812e-38, 1.0, 0.5, 0.0]
124 # init the 'PiecewiseFunction' selected for 'OpacityTransferFunction'
125 developedSurface1Display.OpacityTransferFunction.Points = [0.0, 0.0, 0.5, 0.0, 1.1757813367477812e-38, 1.0, 0.5, 0.0]
128 Hide(multiTSmed, renderView1)
130 # update the view to ensure updated data information
133 #change interaction mode for render view
134 renderView1.InteractionMode = '2D'
136 # toggle 3D widget visibility (only when running from the GUI)
137 Hide3DWidgets(proxy=developedSurface1.SliceType)
139 # set scalar coloring
140 ColorBy(developedSurface1Display, ('CELLS', 'Pressure'))
142 # rescale color and/or opacity maps used to include current data range
143 developedSurface1Display.RescaleTransferFunctionToDataRange(True, False)
145 # show color bar/color legend
146 developedSurface1Display.SetScalarBarVisibility(renderView1, True)
148 # get color transfer function/color map for 'Pressure'
149 pressureLUT = GetColorTransferFunction('Pressure')
151 #### saving camera placements for all active views
153 # current camera placement for renderView1
154 renderView1.InteractionMode = '2D'
155 renderView1.CameraPosition = [0.18935662797765695, 0.01726656182167085, 2.08092363470839]
156 renderView1.CameraFocalPoint = [0.18935662797765695, 0.01726656182167085, 0.05000000074505806]
157 renderView1.CameraParallelScale = 0.16748564967020724
159 #### uncomment the following to render all views
161 # alternatively, if you want to write images, you can use SaveScreenshot(...).