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="2.24428" Y="1.06993" Z="22.7012"/>
29 <FocalPoint X="2.24428" Y="1.06993" Z="0"/>
30 <ViewUp X="0" Y="1" Z="0"/>
31 <ViewScale Parallel="8.06783" 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 m=MEDCouplingCurveLinearMesh("myCurveLinearMesh")
76 m.setNodeGridStructure([2,3])
77 coords=DataArrayDouble([0.,0., 2.,0., 0.,1., 1.9,1.1, 0.3,1.9, 2.2,2.1],6,2)
78 coords.setInfoOnComponents(["X [m]","Y [m]"])
81 WriteMesh("mesh1.med",m,True)
87 import SMESH, SALOMEDS
88 from salome.smesh import smeshBuilder
90 smesh = smeshBuilder.New(salome.myStudy)
91 ([mesh_1], status) = smesh.CreateMeshesFromMED(r'mesh1.med')
93 ### Store presentation parameters of displayed objects
95 ipar = iparameters.IParameters(theStudy.GetModuleParameters("Interface Applicative", "SMESH", 1))
98 # set up entry SMESH_3 (mesh) parameters
99 ipar.setParameter("SMESH_3", "VTKViewer_0_Visibility", "On")
100 ipar.setParameter("SMESH_3", "VTKViewer_0_Representation", "2")
101 ipar.setParameter("SMESH_3", "VTKViewer_0_IsShrunk", "0")
102 ipar.setParameter("SMESH_3", "VTKViewer_0_Entities", "e:0:f:1:v:0:0d:0:b:0")
103 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")
104 ipar.setParameter("SMESH_3", "VTKViewer_0_Sizes", "line:1:outline:1:elem0d:5:ball:10:1:shrink:0.75:orientation:0.1:0")
105 ipar.setParameter("SMESH_3", "VTKViewer_0_PointMarker", "std:1:9")
106 ipar.setParameter("SMESH_3", "VTKViewer_0_Opacity", "1")
107 ipar.setParameter("SMESH_3", "VTKViewer_0_ClippingPlane", "Off")
109 if salome.sg.hasDesktop():
110 salome.sg.updateObjBrowser(True)
111 iparameters.getSession().restoreVisualState(1)
113 import libSALOME_Swig
114 gui = libSALOME_Swig.SALOMEGUI_Swig()
115 gui.AddIObject( salome.ObjectToID( mesh_1.GetMesh() ))