Salome HOME
2485e09b0c1e868b494de229b9f2d53180e469d7
[modules/smesh.git] / src / SMESH_SWIG / PAL_MESH_043_2D.py
1 #! /usr/bin/python
2 #  -*- coding: iso-8859-1 -*-
3 #  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
4 #
5 #  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
6 #  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
7 #
8 #  This library is free software; you can redistribute it and/or
9 #  modify it under the terms of the GNU Lesser General Public
10 #  License as published by the Free Software Foundation; either
11 #  version 2.1 of the License.
12 #
13 #  This library is distributed in the hope that it will be useful,
14 #  but WITHOUT ANY WARRANTY; without even the implied warranty of
15 #  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16 #  Lesser General Public License for more details.
17 #
18 #  You should have received a copy of the GNU Lesser General Public
19 #  License along with this library; if not, write to the Free Software
20 #  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
21 #
22 #  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 #
24 #  File        : SMESH_testExtrusion2D.py
25 #  Module      : SMESH
26 #  Description : Create meshes to test extrusion of mesh elements along path
27 #
28 import salome
29 import geompy
30 import smesh
31
32
33 #----------------------------------GEOM
34
35 # create points
36 p1 = geompy.MakeVertex(100, 0, 0)
37 p2 = geompy.MakeVertex(100, 0, 100)
38 p3 = geompy.MakeVertex(0, 0, 0)
39 p4 = geompy.MakeVertex(0, 100, 0)
40
41
42 # create two vectors
43 vector1 = geompy.MakeVector(p1,p2)
44 vector2 = geompy.MakeVector(p3,p4)
45
46 # make two ellipses
47 ellipse1 = geompy.MakeEllipse(p1,vector1,50,25)
48 ellipse2 = geompy.MakeEllipse(p3,vector2,300,50)
49
50 # publish circular face and second circle
51 id_ellipse1 = geompy.addToStudy(ellipse1, "Ellips 1")
52 id_ellipse2 = geompy.addToStudy(ellipse2, "Ellips 2")
53
54
55 #---------------------------------SMESH
56
57 # create the path mesh
58 mesh1 = smesh.Mesh(ellipse1, "Path Mesh")
59
60 algoReg1 = mesh1.Segment()
61 algoReg1.SetName("Regular_1D")
62 hypNbSeg1 = algoReg1.NumberOfSegments(18)
63 smesh.SetName(hypNbSeg1, "NumberOfSegments 1")
64
65 # create the tool mesh
66 mesh2 = smesh.Mesh(ellipse2, "Tool Mesh")
67 algoReg2 = mesh2.Segment()
68 algoReg2.SetName("Regular_1D")
69 hypNbSeg2 = algoReg2.NumberOfSegments(34)
70 smesh.SetName(hypNbSeg2, "NumberOfSegments 2")
71
72 # compute meshes
73 mesh1.Compute()
74 mesh2.Compute()
75
76
77 # ---- udate object browser
78 salome.sg.updateObjBrowser(1);