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: 2")
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:2 - viewer:1")
26 ipar.append("VTKViewer_1", """<?xml version="1.0"?>
28 <Position X="-0.215292" Y="0.427652" Z="13.6094"/>
29 <FocalPoint X="-0.215292" Y="0.427652" Z="0"/>
30 <ViewUp X="0" Y="1" Z="0"/>
31 <ViewScale Parallel="1.64811" 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 if sys.platform == "win32":
69 from MEDCouplingCompat import *
71 from MEDCoupling import *
73 from MEDLoader import WriteMesh
75 XCoords=[-0.3,0.,0.1,0.3,0.45,0.47,0.49,1.,1.22] # 9 values along X
76 YCoords=[0.,0.1,0.37,0.45,0.47,0.49,1.007] # 7 values along Y
77 arrX=DataArrayDouble(XCoords)
78 arrX.setInfoOnComponent(0,"X [m]")
79 arrY=DataArrayDouble(YCoords)
80 arrY.setInfoOnComponent(0,"Y [m]")
81 mesh=MEDCouplingCMesh("My2D_CMesh")
82 mesh.setCoords(arrX,arrY)
83 WriteMesh("mesh1.med",mesh,True)
89 import SMESH, SALOMEDS
90 from salome.smesh import smeshBuilder
92 smesh = smeshBuilder.New(salome.myStudy)
93 ([mesh_1], status) = smesh.CreateMeshesFromMED(r'mesh1.med')
95 ### Store presentation parameters of displayed objects
97 ipar = iparameters.IParameters(theStudy.GetModuleParameters("Interface Applicative", "SMESH", 1))
100 # set up entry SMESH_3 (mesh) parameters
101 ipar.setParameter("SMESH_3", "VTKViewer_0_Visibility", "On")
102 ipar.setParameter("SMESH_3", "VTKViewer_0_Representation", "2")
103 ipar.setParameter("SMESH_3", "VTKViewer_0_IsShrunk", "0")
104 ipar.setParameter("SMESH_3", "VTKViewer_0_Entities", "e:0:f:1:v:0:0d:0:b:0")
105 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")
106 ipar.setParameter("SMESH_3", "VTKViewer_0_Sizes", "line:1:outline:1:elem0d:5:ball:10:1:shrink:0.75:orientation:0.1:0")
107 ipar.setParameter("SMESH_3", "VTKViewer_0_PointMarker", "std:1:9")
108 ipar.setParameter("SMESH_3", "VTKViewer_0_Opacity", "1")
109 ipar.setParameter("SMESH_3", "VTKViewer_0_ClippingPlane", "Off")
111 if salome.sg.hasDesktop():
112 salome.sg.updateObjBrowser(True)
113 iparameters.getSession().restoreVisualState(1)
115 import libSALOME_Swig
116 gui = libSALOME_Swig.SALOMEGUI_Swig()
117 gui.AddIObject( salome.ObjectToID( mesh_1.GetMesh() ))