1 # Copyright (C) 2005 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
27 box = geompy.MakeBox(0., 0., 0., 100., 200., 300.)
28 idbox = geompy.addToStudy(box, "box")
30 subShapeList = geompy.SubShapeAll(box, geompy.ShapeType["FACE"])
31 face = subShapeList[0]
32 name = geompy.SubShapeName(face, box)
33 idface = geompy.addToStudyInFather(box, face, name)
35 box = salome.IDToObject(idbox)
36 face = salome.IDToObject(idface)
40 mesh = smesh.Mesh(box, "Meshbox")
42 # Set 1D algorithm/hypotheses to mesh
43 algo1 = mesh.Segment()
44 algo1.NumberOfSegments(10)
46 # Set 2D algorithm/hypotheses to mesh
47 algo2 = mesh.Triangle(smesh.MEFISTO)
48 algo2.MaxElementArea(10)
50 # Create submesh on face
51 algo3 = mesh.Segment(face)
52 algo3.NumberOfSegments(10)
53 algo4 = mesh.Triangle(smesh.MEFISTO, face)
54 algo4.MaxElementArea(100)
55 submesh = algo4.GetSubMesh()
56 smesh.SetName(submesh, "SubMeshFace")
61 faces = submesh.GetElementsByType(smesh.FACE)
63 print len(faces), len(faces)/2
64 group1 = mesh.CreateEmptyGroup(smesh.FACE,"Group of faces")
65 group2 = mesh.CreateEmptyGroup(smesh.FACE,"Another group of faces")
66 group1.Add(faces[:int(len(faces)/2)])
67 group2.Add(faces[int(len(faces)/2):])
69 salome.sg.updateObjBrowser(1)