Salome HOME
Merge from V6_main 28/02/2013
[modules/smesh.git] / doc / salome / examples / grouping_elements_ex02.py
1 # Create a Group on Geometry
2
3 import salome
4 import geompy
5 import smesh
6
7 # create a box
8 box = geompy.MakeBox(0., 0., 0., 100., 100., 100.)
9 geompy.addToStudy(box, "box")
10
11 # add the first face of the box to the study
12 subShapeList = geompy.SubShapeAll(box, geompy.ShapeType["FACE"])
13 face = subShapeList[0]
14 geompy.addToStudyInFather(box, face, "face 1") 
15
16 # create group of edges on the face
17 aGeomGroupE = geompy.CreateGroup(face, geompy.ShapeType["EDGE"])
18 geompy.AddObject(aGeomGroupE, 3)
19 geompy.AddObject(aGeomGroupE, 6)
20 geompy.AddObject(aGeomGroupE, 8)
21 geompy.AddObject(aGeomGroupE, 10)
22 geompy.addToStudyInFather(face, aGeomGroupE, "Group of Edges")
23
24 # create quadrangle 2D mesh on the box
25 quadra = smesh.Mesh(box, "Box : quadrangle 2D mesh")
26 algo1D = quadra.Segment()
27 quadra.Quadrangle()
28 algo1D.NumberOfSegments(7) 
29
30 # compute the mesh
31 quadra.Compute()
32
33 # create SMESH group on the face with name "SMESHGroup1"
34 aSmeshGroup1 = quadra.GroupOnGeom(face, "SMESHGroup1")
35
36 # create SMESH group on <aGeomGroupE> with default name
37 aSmeshGroup2 = quadra.GroupOnGeom(aGeomGroupE) 
38
39 salome.sg.updateObjBrowser(1)