1 # Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
2 # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
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.
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.
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
18 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
22 # File : SMESH_testExtrusion3D.py
24 # Description : Create meshes to test extrusion of mesh elements along path
32 smesh = salome.lcc.FindOrLoadComponent("FactoryServer", "SMESH")
33 smesh.SetCurrentStudy(salome.myStudy)
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)
44 circle = geompy.MakeCircleThreePnt(p1, p2, p3)
45 cf = geompy.MakeCircleThreePnt(p4, p5, p6)
48 wire = geompy.MakeWire([cf])
49 face = geompy.MakeFace(wire, 1)
51 # publish circular face and second circle
52 idcircle = geompy.addToStudy(circle, "Circle")
53 idface = geompy.addToStudy(face, "Circular face")
56 smeshgui = salome.ImportComponentGUI("SMESH")
57 smeshgui.Init(salome.myStudyId)
60 hypNbSeg = smesh.CreateHypothesis("NumberOfSegments", "libStdMeshersEngine.so")
61 hypNbSeg.SetNumberOfSegments(12)
62 idseg = salome.ObjectToID(hypNbSeg)
63 smeshgui.SetName(idseg, "NumberOfSegments_10");
65 hypArea = smesh.CreateHypothesis("MaxElementArea", "libStdMeshersEngine.so")
66 hypArea.SetMaxElementArea(30)
67 idarea = salome.ObjectToID(hypArea)
68 smeshgui.SetName(idarea, "MaxElementArea_20");
71 algoReg = smesh.CreateHypothesis("Regular_1D", "libStdMeshersEngine.so")
72 idreg = salome.ObjectToID(algoReg)
73 smeshgui.SetName(idreg, "Regular_1D");
75 algoMef = smesh.CreateHypothesis("MEFISTO_2D", "libStdMeshersEngine.so")
76 idmef = salome.ObjectToID(algoMef)
77 smeshgui.SetName(idmef, "MEFISTO_2D");
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");
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)
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");
95 # set hypotheses and algos
96 mesh2.AddHypothesis(circle,algoReg)
97 mesh2.AddHypothesis(circle,hypNbSeg)
100 smesh.Compute(mesh1,face)
101 smesh.Compute(mesh2,circle)
103 # ---- udate object browser
104 salome.sg.updateObjBrowser(1);