1 # Create a Standalone Group
6 smesh = SMESH_mechanic.smesh
7 mesh = SMESH_mechanic.mesh
8 salome = SMESH_mechanic.salome
10 # Get ids of all faces with area > 100
11 aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_Area, SMESH.FT_MoreThan, 100.)
13 anIds = mesh.GetIdsFromFilter(aFilter)
15 # create a group consisting of faces with area > 100
16 aGroup1 = mesh.MakeGroupByIds("Area > 100", SMESH.FACE, anIds)
18 # create a group that contains all nodes from the mesh
19 aGroup2 = mesh.CreateEmptyGroup(SMESH.NODE, "all nodes")
20 aGroup2.AddFrom(mesh.mesh)
23 # ====================================
24 # Various methods of the Group object
25 # ====================================
27 aGroup = mesh.CreateEmptyGroup(SMESH.NODE, "aGroup")
30 aGroup.SetName( "new name" )
31 print "name", aGroup.GetName()
33 # get group type (type of entities in the group, SMESH.NODE in our case)
34 print "type", aGroup.GetType()
36 # get number of entities (nodes in our case) in the group
37 print "size", aGroup.Size()
40 print "is empty", aGroup.IsEmpty()
42 # check of presence of an entity in the group
43 aGroup.Add([1,2]) # method specific to the standalone group
44 print "contains node 2", aGroup.Contains(2)
46 # get an entity by index
47 print "1st node", aGroup.GetID(1)
50 print "all", aGroup.GetIDs()
52 # get number of nodes (actual for groups of elements)
53 print "nb nodes", aGroup.GetNumberOfNodes()
55 # get underlying nodes (actual for groups of elements)
56 print "nodes", aGroup.GetNodeIDs()
60 aGroup.SetColor( SALOMEDS.Color(1.,1.,0.));
61 print "color", aGroup.GetColor()
63 # ----------------------------------------------------------------------------
64 # methods specific to the standalone group and not present in GroupOnGeometry
66 # ----------------------------------------------------------------------------
68 # clear the group's contents
71 # add contents of other object (group, sub-mesh, filter)
72 aGroup.AddFrom( aGroup2 )
75 aGroup.Remove( [2,3,4] )
80 salome.sg.updateObjBrowser(1)