1 # -*- coding: utf-8 -*-
4 ### This script is intended to be launched in a new SALOME study
11 theStudy = salome.myStudy
14 ipar = iparameters.IParameters(salome.myStudy.GetCommonParameters("Interface Applicative", 1), True)
16 #Set up visual properties:
17 ipar.setProperty("AP_ACTIVE_VIEW", "VTKViewer_0_0")
18 ipar.setProperty("AP_WORKSTACK_INFO", "0000000100000000000000020100000001000003a0000000040000000100000001000000080000001a00560054004b005600690065007700650072005f0030005f00300000000102")
19 ipar.setProperty("AP_ACTIVE_MODULE", "Mesh")
20 ipar.setProperty("AP_SAVEPOINT_NAME", "GUI state: 1")
22 # fill list AP_VIEWERS_LIST
23 ipar.append("AP_VIEWERS_LIST", "VTKViewer_1")
24 # fill list VTKViewer_1
25 ipar.append("VTKViewer_1", "VTK scene:1 - viewer:1")
26 ipar.append("VTKViewer_1", """<?xml version="1.0"?>
28 <Position X="6.72975" Y="50.5667" Z="-84.713"/>
29 <FocalPoint X="7.8892" Y="1.31555" Z="0.206316"/>
30 <ViewUp X="0.0209995" Y="-0.864725" Z="-0.501806"/>
31 <ViewScale Parallel="9.70821" X="1" Y="1" Z="1"/>
32 <DisplayCubeAxis Show="0"/>
33 <GraduatedAxis Axis="X">
34 <Title isVisible="1" Text="X" Font="0" Bold="0" Italic="0" Shadow="0">
35 <Color R="1" G="0" B="0"/>
37 <Labels isVisible="1" Number="3" Offset="2" Font="0" Bold="0" Italic="0" Shadow="0">
38 <Color R="1" G="0" B="0"/>
40 <TickMarks isVisible="1" Length="5"/>
42 <GraduatedAxis Axis="Y">
43 <Title isVisible="1" Text="Y" Font="0" Bold="0" Italic="0" Shadow="0">
44 <Color R="0" G="1" B="0"/>
46 <Labels isVisible="1" Number="3" Offset="2" Font="0" Bold="0" Italic="0" Shadow="0">
47 <Color R="0" G="1" B="0"/>
49 <TickMarks isVisible="1" Length="5"/>
51 <GraduatedAxis Axis="Z">
52 <Title isVisible="1" Text="Z" Font="0" Bold="0" Italic="0" Shadow="0">
53 <Color R="0" G="0" B="1"/>
55 <Labels isVisible="1" Number="3" Offset="2" Font="0" Bold="0" Italic="0" Shadow="0">
56 <Color R="0" G="0" B="1"/>
58 <TickMarks isVisible="1" Length="5"/>
60 <Trihedron isShown="0" Size="100"/>
61 <Background Value="bt=1;fn=;tm=0;ts=false;c1=#ffffff;c2=#000000;gt=-1;gr="/>
64 # fill list AP_MODULES_LIST
65 ipar.append("AP_MODULES_LIST", "Mesh")
68 from MEDCoupling import *
70 coordsArr=DataArrayDouble(range(6))
71 mesh1=MEDCouplingCMesh("mesh")
72 mesh1.setCoords(coordsArr,coordsArr[:3])
74 from MEDLoader import WriteMesh
75 WriteMesh("mesh1.med",mesh1,True)
77 mesh1.translate( [6.5,0] )
78 mesh2 = mesh1.buildUnstructured()
79 part = mesh2[1,2,4,5,7,8]
80 WriteMesh("part.med",part,True)
87 import SMESH, SALOMEDS
88 from salome.smesh import smeshBuilder
90 smesh = smeshBuilder.New(theStudy)
91 ([mesh_1], status) = smesh.CreateMeshesFromMED(r'mesh1.med')
92 ([mesh_2], status) = smesh.CreateMeshesFromMED(r'part.med')
95 ### Store presentation parameters of displayed objects
97 ipar = iparameters.IParameters(theStudy.GetModuleParameters("Interface Applicative", "SMESH", 1))
100 # set up entry SMESH_4 (mesh) parameters
101 ipar.setParameter("SMESH_4", "VTKViewer_0_Visibility", "On")
102 ipar.setParameter("SMESH_4", "VTKViewer_0_Representation", "2")
103 ipar.setParameter("SMESH_4", "VTKViewer_0_IsShrunk", "0")
104 ipar.setParameter("SMESH_4", "VTKViewer_0_Entities", "e:1:f:1:v:1:0d:1:b:1")
105 ipar.setParameter("SMESH_4", "VTKViewer_0_Colors", "surface:0:0.666667:1:backsurface:100:volume:1:0:0.666667:-100:edge:0:0.666667:1:node:1:0:0:outline:0:0.27451:0:elem0d:0:1:0:ball:0:0.333333:1:orientation:1:1:1")
106 ipar.setParameter("SMESH_4", "VTKViewer_0_Sizes", "line:1:outline:1:elem0d:5:ball:10:1:shrink:0.75:orientation:0.1:0")
107 ipar.setParameter("SMESH_4", "VTKViewer_0_PointMarker", "std:1:9")
108 ipar.setParameter("SMESH_4", "VTKViewer_0_Opacity", "1")
109 ipar.setParameter("SMESH_4", "VTKViewer_0_ClippingPlane", "Off")
110 # set up entry SMESH_3 (mesh) parameters
111 ipar.setParameter("SMESH_3", "VTKViewer_0_Visibility", "On")
112 ipar.setParameter("SMESH_3", "VTKViewer_0_Representation", "2")
113 ipar.setParameter("SMESH_3", "VTKViewer_0_IsShrunk", "0")
114 ipar.setParameter("SMESH_3", "VTKViewer_0_Entities", "e:1:f:1:v:1:0d:1:b:1")
115 ipar.setParameter("SMESH_3", "VTKViewer_0_Colors", "surface:0:0.666667:1:backsurface:100:volume:1:0:0.666667:-100:edge:0:0.666667:1:node:1:0:0:outline:0:0.27451:0:elem0d:0:1:0:ball:0:0.333333:1:orientation:1:1:1")
116 ipar.setParameter("SMESH_3", "VTKViewer_0_Sizes", "line:1:outline:1:elem0d:5:ball:10:1:shrink:0.75:orientation:0.1:0")
117 ipar.setParameter("SMESH_3", "VTKViewer_0_PointMarker", "std:1:9")
118 ipar.setParameter("SMESH_3", "VTKViewer_0_Opacity", "1")
119 ipar.setParameter("SMESH_3", "VTKViewer_0_ClippingPlane", "Off")
122 if salome.sg.hasDesktop():
123 salome.sg.updateObjBrowser(True)
124 iparameters.getSession().restoreVisualState(1)