1 # Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
3 # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
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.
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.
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
20 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
29 box = geompy.MakeBox(0., 0., 0., 100., 200., 300.)
30 idbox = geompy.addToStudy(box, "box")
32 subShapeList = geompy.SubShapeAll(box, geompy.ShapeType["FACE"])
33 face = subShapeList[0]
34 name = geompy.SubShapeName(face, box)
35 idface = geompy.addToStudyInFather(box, face, name)
37 box = salome.IDToObject(idbox)
38 face = salome.IDToObject(idface)
42 mesh = smesh.Mesh(box, "Meshbox")
44 # Set 1D algorithm/hypotheses to mesh
45 algo1 = mesh.Segment()
46 algo1.NumberOfSegments(10)
48 # Set 2D algorithm/hypotheses to mesh
49 algo2 = mesh.Triangle(smesh.MEFISTO)
50 algo2.MaxElementArea(10)
52 # Create submesh on face
53 algo3 = mesh.Segment(face)
54 algo3.NumberOfSegments(10)
55 algo4 = mesh.Triangle(smesh.MEFISTO, face)
56 algo4.MaxElementArea(100)
57 submesh = algo4.GetSubMesh()
58 smesh.SetName(submesh, "SubMeshFace")
63 faces = submesh.GetElementsByType(smesh.FACE)
65 print len(faces), len(faces)/2
66 group1 = mesh.CreateEmptyGroup(smesh.FACE,"Group of faces")
67 group2 = mesh.CreateEmptyGroup(smesh.FACE,"Another group of faces")
68 group1.Add(faces[:int(len(faces)/2)])
69 group2.Add(faces[int(len(faces)/2):])
71 salome.sg.updateObjBrowser(1)