1 # This Python script creates three custom views for the three display types of
2 # the filter 'Rosettes de contrainte'.
4 from paraview.simple import *
7 view1 = FindViewOrCreate('RenderView1', viewtype='RenderView')
13 layout.SplitVertical(0,0.5)
14 view2 = CreateView('RenderView')
15 AssignViewToLayout(view=view2, layout=layout)
18 layout.SplitHorizontal(2,0.5)
19 view3 = CreateView('RenderView')
20 AssignViewToLayout(view=view3, layout=layout)
22 # Link cameras of new views to the initial one
23 AddCameraLink(view2, view1, 'CameraLink2')
24 AddCameraLink(view3, view1, 'CameraLink3')
26 # Retrieve active source
27 source = GetActiveSource()
33 # Apply 'Rosettes de contrainte' filter
34 rosette1 = Rosettesdecontrainte(Input=source)
36 # Show filter output and hide initial source
40 # Set NaN color to black
41 rosette1LUT = GetColorTransferFunction('CompressionOrTraction')
42 rosette1LUT.NanColor = [0.0, 0.0, 0.0]
48 # Apply 'Rosettes de contrainte' filter
49 rosette2 = Rosettesdecontrainte(Input=source)
51 # Change type of display
52 rosette2.TypeOfDisplay = 'T1 only'
55 rosette2Display = Show(rosette2, view2)
57 # Change representation type
58 rosette2Display.SetRepresentationType('Surface With Edges')
60 # Set edge color to black
61 rosette2Display.EdgeColor = [0.0, 0.0, 0.0]
63 # Show scalar color bar
64 rosette2Display.SetScalarBarVisibility(view2, True)
66 # Retrieve lookup table
67 rosette2LUT = GetColorTransferFunction('Contraintespecifique1')
69 # Change number of discrete colors
70 rosette2LUT.NumberOfTableValues = 10
72 # Change color map preset
73 rosette2LUT.ApplyPreset('Rainbow Uniform', True)
75 # Retrieve scalar color bar
76 rosette2ColorBar = GetScalarBar(rosette2LUT, view2)
79 rosette2ColorBar.AutomaticLabelFormat = 0
80 rosette2ColorBar.LabelFormat = '%-#6.1e'
82 # Remove unwanted tick marks and labels
83 rosette2ColorBar.DrawTickMarks = 0
84 rosette2ColorBar.DrawTickLabels = 0
85 rosette2ColorBar.AddRangeLabels = 0
86 rosette2ColorBar.AutomaticAnnotations = 1
88 # Change color bar size
89 rosette2ColorBar.ScalarBarLength = 0.6
95 # Apply 'Rosettes de contrainte' filter
96 rosette3 = Rosettesdecontrainte(Input=source)
98 # Change type of display
99 rosette3.TypeOfDisplay = 'T2 only'
102 rosette3Display = Show(rosette3, view3)
104 # Change representation type
105 rosette3Display.SetRepresentationType('Surface With Edges')
107 # Set edge color to black
108 rosette3Display.EdgeColor = [0.0, 0.0, 0.0]
110 # Show scalar color bar
111 rosette3Display.SetScalarBarVisibility(view3, True)
113 # Retrieve lookup table
114 rosette3LUT = GetColorTransferFunction('Contraintespecifique3')
116 # Change number of discrete colors
117 rosette3LUT.NumberOfTableValues = 10
119 # Change color map preset
120 rosette3LUT.ApplyPreset('Rainbow Uniform', True)
122 # Retrieve scalar color bar
123 ros3ColorBar = GetScalarBar(rosette3LUT, view3)
125 # Change label format
126 ros3ColorBar.AutomaticLabelFormat = 0
127 ros3ColorBar.LabelFormat = '%-#6.1e'
129 # Remove unwanted tick marks and labels
130 ros3ColorBar.DrawTickMarks = 0
131 ros3ColorBar.DrawTickLabels = 0
132 ros3ColorBar.AddRangeLabels = 0
133 ros3ColorBar.AutomaticAnnotations = 1
135 # Change color bar size
136 ros3ColorBar.ScalarBarLength = 0.6