1 # -*- coding: utf-8 -*-
4 ### This script is intended to be launched in a new SALOME study
8 if sys.platform == "win32":
9 from MEDCouplingCompat import *
11 from MEDCoupling import *
13 coordsArr=DataArrayDouble(range(3))
14 mesh1=MEDCouplingCMesh("mesh")
15 mesh1.setCoords(coordsArr,coordsArr,coordsArr[:1])
16 mesh1 = mesh1.buildUnstructured()
24 x = r * math.cos( math.radians( i*a )) - r
25 z = r * math.sin( math.radians( i*a ))
26 coords.extend([ x, 0, z ])
28 m2=MEDCouplingCurveLinearMesh("myCurveLinearMesh")
29 m2.setNodeGridStructure([1,nb])
30 coo=DataArrayDouble(coords,nb,3)
32 m2 = m2.buildUnstructured()
34 m3=mesh1.buildExtrudedMesh(m2,1)
38 ortho = skin.buildOrthogonalField()
39 ortho.setName("ortho_field")
41 from MEDLoader import WriteField, WriteMesh
43 WriteMesh(medfile,ortho.getMesh(),True)
44 WriteField(medfile,ortho,False)
51 theStudy = salome.myStudy
54 ipar = iparameters.IParameters(salome.myStudy.GetCommonParameters("Interface Applicative", 1), True)
56 #Set up visual properties:
57 ipar.setProperty("AP_ACTIVE_VIEW", "ParaView_0_0")
58 ipar.setProperty("AP_WORKSTACK_INFO", "00000001000000000000000201000000010000038f000000040000000100000001000000080000001800500061007200610056006900650077005f0030005f00300000000102")
59 ipar.setProperty("AP_ACTIVE_MODULE", "ParaViS")
60 ipar.setProperty("AP_SAVEPOINT_NAME", "GUI state: 1")
62 # fill list AP_VIEWERS_LIST
63 ipar.append("AP_VIEWERS_LIST", "ParaView_1")
64 # fill list ParaView_1
65 ipar.append("ParaView_1", "ParaView scene:7 - viewer:1")
66 ipar.append("ParaView_1", "empty")
67 # fill list AP_MODULES_LIST
68 ipar.append("AP_MODULES_LIST", "ParaViS")
76 pvsimple.ShowParaviewView()
77 #### import the simple module from the paraview
78 from pvsimple import *
79 #### disable automatic camera reset on 'Show'
80 pvsimple._DisableFirstRenderCameraReset()
82 # create a new 'MED Reader'
83 mesh1med = MEDReader(FileName=medfile)
86 renderView1 = GetActiveViewOrCreate('RenderView')
87 # uncomment following to set a specific view size
88 # renderView1.ViewSize = [897, 531]
91 mesh1medDisplay = Show(mesh1med, renderView1)
93 # reset view to fit data
94 renderView1.ResetCamera()
96 # update the view to ensure updated data information
99 # change representation type
100 mesh1medDisplay.SetRepresentationType('Surface With Edges')
102 # create a new 'Glyph'
103 glyph1 = Glyph(Input=mesh1med,GlyphType='Arrow')
105 # Properties modified on glyph1
106 glyph1.Vectors = ['CELLS', 'ortho_field']
109 glyph1Display = Show(glyph1, renderView1)
111 # trace defaults for the display properties.
112 glyph1Display.Representation = 'Surface'
114 # update the view to ensure updated data information
117 # Properties modified on glyph1
118 glyph1.GlyphMode = 'All Points'
120 # update the view to ensure updated data information
123 # Properties modified on glyph1
124 glyph1.ScaleFactor = 0.7071067811865466
126 # update the view to ensure updated data information
130 SetActiveSource(mesh1med)
132 # Properties modified on renderView1
133 renderView1.Background = [1.0, 1.0, 1.0]
135 #### saving camera placements for all active views
137 # current camera placement for renderView1
138 renderView1.CameraPosition = [-9.40023601342297, -11.82197473872875, 6.269507101837803]
139 renderView1.CameraFocalPoint = [-3.714211157684638, -4.502747059961789, 3.6997577635620735]
140 renderView1.CameraViewUp = [0.6941544280720486, -0.3114076799016199, 0.6489798817268972]
141 renderView1.CameraParallelScale = 2.4893170029349183
144 if salome.sg.hasDesktop():
145 salome.sg.updateObjBrowser(True)
146 iparameters.getSession().restoreVisualState(1)