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