Salome HOME
Join modifications from branch BR_DEBUG_3_2_0b1
[modules/smesh.git] / src / SMESH_SWIG / PAL_MESH_043_3D.py
1 #  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
2 #  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
3
4 #  This library is free software; you can redistribute it and/or 
5 #  modify it under the terms of the GNU Lesser General Public 
6 #  License as published by the Free Software Foundation; either 
7 #  version 2.1 of the License. 
8
9 #  This library is distributed in the hope that it will be useful, 
10 #  but WITHOUT ANY WARRANTY; without even the implied warranty of 
11 #  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
12 #  Lesser General Public License for more details. 
13
14 #  You should have received a copy of the GNU Lesser General Public 
15 #  License along with this library; if not, write to the Free Software 
16 #  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
17
18 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 #
20 #
21 #
22 #  File        : SMESH_testExtrusion3D.py
23 #  Module      : SMESH
24 #  Description : Create meshes to test extrusion of mesh elements along path
25
26 import salome
27 import geompy
28 import SMESH
29 import StdMeshers
30
31 # get smesh engine
32 smesh = salome.lcc.FindOrLoadComponent("FactoryServer", "SMESH")
33 smesh.SetCurrentStudy(salome.myStudy)
34
35 # create points to build two circles
36 p1 = geompy.MakeVertex(0,  100,  0)
37 p2 = geompy.MakeVertex(100,  0,  0)
38 p3 = geompy.MakeVertex(0, -100,  0)
39 p4 = geompy.MakeVertex(0,   70,  0)
40 p5 = geompy.MakeVertex(0,  100, 30)
41 p6 = geompy.MakeVertex(0,  130,  0)
42
43 # create two circles
44 circle = geompy.MakeCircleThreePnt(p1, p2, p3)
45 cf     = geompy.MakeCircleThreePnt(p4, p5, p6)
46
47 # make circular face
48 wire = geompy.MakeWire([cf])
49 face = geompy.MakeFace(wire, 1)
50
51 # publish circular face and second circle
52 idcircle = geompy.addToStudy(circle, "Circle")
53 idface   = geompy.addToStudy(face,   "Circular face")
54
55 # get SMESH GUI
56 smeshgui = salome.ImportComponentGUI("SMESH")
57 smeshgui.Init(salome.myStudyId)
58
59 # create hypoteses
60 hypNbSeg = smesh.CreateHypothesis("NumberOfSegments", "libStdMeshersEngine.so")
61 hypNbSeg.SetNumberOfSegments(12)
62 idseg = salome.ObjectToID(hypNbSeg) 
63 smeshgui.SetName(idseg, "NumberOfSegments_10");
64
65 hypArea = smesh.CreateHypothesis("MaxElementArea", "libStdMeshersEngine.so")
66 hypArea.SetMaxElementArea(30)
67 idarea = salome.ObjectToID(hypArea)
68 smeshgui.SetName(idarea, "MaxElementArea_20");
69
70 # create algorithmes
71 algoReg = smesh.CreateHypothesis("Regular_1D", "libStdMeshersEngine.so")
72 idreg = salome.ObjectToID(algoReg)
73 smeshgui.SetName(idreg, "Regular_1D");
74
75 algoMef = smesh.CreateHypothesis("MEFISTO_2D", "libStdMeshersEngine.so")
76 idmef = salome.ObjectToID(algoMef)
77 smeshgui.SetName(idmef, "MEFISTO_2D");
78
79 # init a Mesh with the circular face
80 mesh1 = smesh.CreateMesh(face)
81 idmesh1 = salome.ObjectToID(mesh1)
82 smeshgui.SetName(idmesh1, "Mesh on circular face");
83
84 # set hypotheses and algos
85 mesh1.AddHypothesis(face,algoReg)
86 mesh1.AddHypothesis(face,hypNbSeg)
87 mesh1.AddHypothesis(face,algoMef)
88 mesh1.AddHypothesis(face,hypArea)
89
90 # init a Mesh with the second circle
91 mesh2 = smesh.CreateMesh(circle)
92 idmesh2 = salome.ObjectToID(mesh2)
93 smeshgui.SetName(idmesh2, "Mesh on circular edge");
94
95 # set hypotheses and algos
96 mesh2.AddHypothesis(circle,algoReg)
97 mesh2.AddHypothesis(circle,hypNbSeg)
98
99 # compute meshes
100 smesh.Compute(mesh1,face)
101 smesh.Compute(mesh2,circle)
102
103 # ---- udate object browser
104 salome.sg.updateObjBrowser(1);