Salome HOME
correct previous integration (Porting to Python 2.6)
[modules/smesh.git] / src / SMESH_SWIG / ex30_groupsOp.py
1 #  -*- coding: iso-8859-1 -*-
2
3 import sys
4 import salome
5 import geompy
6 import math
7 import SALOMEDS
8 import SMESH
9 import smesh
10
11 salome.salome_init()
12 aStudyId = salome.myStudy._get_StudyId()
13
14 geompy.init_geom(salome.myStudy)
15 global Face_1
16 Face_1 = geompy.MakeFaceHW(100, 100, 1)
17 geompy.addToStudy( Face_1, "Face_1" )
18
19 #smesh.smesh.SetCurrentStudy(aStudyId)
20 import StdMeshers
21 pattern = smesh.GetPattern()
22 Mesh_1 = smesh.Mesh(Face_1)
23 Regular_1D = Mesh_1.Segment()
24 Nb_Segments_1 = Regular_1D.NumberOfSegments(10)
25 Nb_Segments_1.SetDistrType( 0 )
26 Quadrangle_2D = Mesh_1.Quadrangle()
27 isDone = Mesh_1.Compute()
28
29 # groups creation
30
31 aListOfElems = [ 52, 53, 54, 55, 56, 57,
32                  62, 63, 64, 65, 66, 67,
33                  72, 73, 74, 75, 76, 77,
34                  82, 83, 84, 85, 86, 87 ]
35                  
36 aRedGroup = Mesh_1.GetMesh().CreateGroup( smesh.FACE, "Red" )
37 aRedGroup.Add( aListOfElems );
38 aRedGroup.SetColor( SALOMEDS.Color( 1, 0, 0 ) )
39
40 aListOfElems = [ 55, 56, 57, 58, 59,
41                  65, 66, 67, 68, 69,
42                  75, 76, 77, 78, 79,
43                  85, 86, 87, 88, 89,
44                  95, 96, 97, 98, 99,
45                  105, 106, 107, 108, 109,
46                  115, 116, 117, 118, 119,
47                  125, 126, 127, 128, 129 ]
48                  
49 aGreenGroup = Mesh_1.GetMesh().CreateGroup( smesh.FACE, "Green" )
50 aGreenGroup.Add( aListOfElems );
51 aGreenGroup.SetColor( SALOMEDS.Color( 0, 1, 0 ) )
52
53 aListOfElems = [ 63, 64, 65, 66, 67, 68, 
54                  73, 74, 75, 76, 77, 78,
55                  83, 84, 85, 86, 87, 88, 
56                  93, 94, 95, 96, 97, 98, 
57                  103, 104, 105, 106, 107, 108, 
58                  113, 114, 115, 116, 117, 118 ]
59                  
60 aBlueGroup = Mesh_1.GetMesh().CreateGroup( smesh.FACE, "Blue" )
61 aBlueGroup.Add( aListOfElems );
62 aBlueGroup.SetColor( SALOMEDS.Color( 0, 0, 1 ) )
63
64 # UnionListOfGroups()
65 aUnGrp = Mesh_1.UnionListOfGroups([aRedGroup, aGreenGroup, aBlueGroup], "UnionGrp" )
66
67 # IntersectListOfGroups()
68 aIntGrp=Mesh_1.IntersectListOfGroups([aRedGroup, aGreenGroup, aBlueGroup], "IntGrp" )
69
70 # CutListOfGroups()
71 aCutGrp=Mesh_1.CutListOfGroups([aRedGroup],[aGreenGroup,aBlueGroup],"CutGrp")
72
73 salome.sg.updateObjBrowser( 1 )
74