Salome HOME
correct previous integration (Porting to Python 2.6)
[modules/smesh.git] / src / SMESH_SWIG / PAL_MESH_043_3D.py
1 #  -*- coding: iso-8859-1 -*-
2 #  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
3 #
4 #  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
5 #  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 #
7 #  This library is free software; you can redistribute it and/or
8 #  modify it under the terms of the GNU Lesser General Public
9 #  License as published by the Free Software Foundation; either
10 #  version 2.1 of the License.
11 #
12 #  This library is distributed in the hope that it will be useful,
13 #  but WITHOUT ANY WARRANTY; without even the implied warranty of
14 #  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15 #  Lesser General Public License for more details.
16 #
17 #  You should have received a copy of the GNU Lesser General Public
18 #  License along with this library; if not, write to the Free Software
19 #  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
20 #
21 #  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
22 #
23 #  File        : SMESH_testExtrusion3D.py
24 #  Module      : SMESH
25 #  Description : Create meshes to test extrusion of mesh elements along path
26 #
27 import salome
28 import geompy
29 import smesh
30
31
32 # create points to build two circles
33 p1 = geompy.MakeVertex(0,  100,  0)
34 p2 = geompy.MakeVertex(100,  0,  0)
35 p3 = geompy.MakeVertex(0, -100,  0)
36 p4 = geompy.MakeVertex(0,   70,  0)
37 p5 = geompy.MakeVertex(0,  100, 30)
38 p6 = geompy.MakeVertex(0,  130,  0)
39
40 # create two circles
41 circle = geompy.MakeCircleThreePnt(p1, p2, p3)
42 cf     = geompy.MakeCircleThreePnt(p4, p5, p6)
43
44 # make circular face
45 wire = geompy.MakeWire([cf])
46 face = geompy.MakeFace(wire, 1)
47
48 # publish circular face and second circle
49 idcircle = geompy.addToStudy(circle, "Circle")
50 idface   = geompy.addToStudy(face,   "Circular face")
51
52
53
54 # init a Mesh with the circular face
55 mesh1 = smesh.Mesh(face, "Mesh on circular face")
56
57 # set hypotheses and algos to the first mesh
58 numberOfSegments1 = 12
59 algoReg1 = mesh1.Segment()
60 algoReg1.SetName("Regular_1D")
61 hypNbSeg1 = algoReg1.NumberOfSegments(numberOfSegments1)
62 smesh.SetName(hypNbSeg1, "NumberOfSegments_" + str(numberOfSegments1))
63
64 maxElementArea = 30
65
66 algoMef = mesh1.Triangle()
67 algoMef.SetName("MEFISTO_2D")
68 hypArea = algoMef.MaxElementArea(maxElementArea)
69 smesh.SetName(hypArea, "MaxElementArea_" + str(maxElementArea))
70
71
72 # init a Mesh with the second circle
73 mesh2 = smesh.Mesh(circle, "Mesh on circular edge")
74
75 numberOfSegments2 = 12
76 algoReg2 = mesh2.Segment()
77 algoReg2.SetName("Regular_1D")
78 hypNbSeg2 = algoReg2.NumberOfSegments(numberOfSegments2)
79 smesh.SetName(hypNbSeg2, "NumberOfSegments_" + str(numberOfSegments2))
80
81
82 # compute meshes
83 mesh1.Compute()
84 mesh2.Compute()
85
86 # ---- udate object browser
87 salome.sg.updateObjBrowser(1);