v0.14.0
Loading...
Searching...
No Matches
paraview_deform_macro.py
Go to the documentation of this file.
1#### import the simple module from the paraview
2from paraview.simple import *
3#### disable automatic camera reset on 'Show'
4paraview.simple._DisableFirstRenderCameraReset()
5
6
7#reader = LegacyVTKReader('/Users/user/mofem/users_modules/fracture_mechanics/out_spatial0.vtk'
8
9# get active view
10renderView1 = GetActiveViewOrCreate('RenderView')
11# Properties modified on calculator1
12calculator1 = Calculator(Input=GetActiveSource())
13SetActiveSource(calculator1)
14if any("SINGULAR_DISP" in str for str in calculator1.PointData.keys()):
15 calculator1.Function = 'MESH_NODE_POSITIONS+SINGULAR_DISP-coords'
16else:
17 calculator1.Function = 'MESH_NODE_POSITIONS-coords'
18calculator1.ResultArrayName = 'Result1'
19
20# show nad hide data in view
21calculator1Display = Show(calculator1, renderView1)
22Hide(calculator1, renderView1)
23# SetActiveSource(calculator1)
24# create a new 'Warp By Vector'
25WarpByVector1 = WarpByVector(Input=calculator1)
26WarpByVector1.Vectors = [None, 'Result1']
27# create a new 'Calculator'
28calculator2 = Calculator(Input=WarpByVector1)
29
30
31# Properties modified on calculator2
32if any("SINGULAR_DISP" in str for str in calculator2.PointData.keys()):
33 calculator2.Function = 'SPATIAL_POSITION-MESH_NODE_POSITIONS-SINGULAR_DISP'
34else:
35 calculator2.Function = 'SPATIAL_POSITION-MESH_NODE_POSITIONS'
36calculator2.ResultArrayName = 'DISPLACEMENTS'
37SetActiveSource(calculator2)
38# create a new 'Warp By Vector'
39# update the view to ensure updated data information
40calculator2Display = Show(calculator2, renderView1)
41Hide(calculator2, renderView1)
42WarpByVector2 = WarpByVector(Input=calculator2)
43WarpByVector2.Vectors = [None, 'DISPLACEMENTS']
44WarpByVector2.ScaleFactor = 1.0
45WarpByVector2Display = Show(WarpByVector2, renderView1)