1 # Create a Standalone Group
5 # Get ids of all faces with area > 100
6 aFilter = smesh_builder.GetFilter(SMESH.FACE, SMESH.FT_Area, SMESH.FT_MoreThan, 100.)
8 anIds = mesh.GetIdsFromFilter(aFilter)
10 # create a group consisting of faces with area > 100
11 aGroup1 = mesh.MakeGroupByIds("Area > 100", SMESH.FACE, anIds)
13 # create a group that contains all nodes from the mesh
14 aGroup2 = mesh.CreateEmptyGroup(SMESH.NODE, "all nodes")
15 aGroup2.AddFrom(mesh.mesh)
18 # ====================================
19 # Various methods of the Group object
20 # ====================================
22 aGroup = mesh.CreateEmptyGroup(SMESH.NODE, "aGroup")
25 aGroup.SetName( "new name" )
26 print("name", aGroup.GetName())
28 # get group type (type of entities in the group, SMESH.NODE in our case)
29 print("type", aGroup.GetType())
31 # get number of entities (nodes in our case) in the group
32 print("size", aGroup.Size())
35 print("is empty", aGroup.IsEmpty())
37 # check of presence of an entity in the group
38 aGroup.Add([1,2]) # Add() method is specific to the standalone group
39 print("contains node 2", aGroup.Contains(2))
41 # get an entity by index
42 print("1st node", aGroup.GetID(1))
45 print("all", aGroup.GetIDs())
47 # get number of nodes (actual for groups of elements)
48 print("nb nodes", aGroup.GetNumberOfNodes())
50 # get underlying nodes (actual for groups of elements)
51 print("nodes", aGroup.GetNodeIDs())
55 aGroup.SetColor( SALOMEDS.Color(1.,1.,0.));
56 print("color", aGroup.GetColor())
58 # ----------------------------------------------------------------------------
59 # methods specific to the standalone group and not present in GroupOnGeometry
61 # ----------------------------------------------------------------------------
63 # clear the group's contents
66 # add contents of other object (group, sub-mesh, filter)
67 aGroup.AddFrom( aGroup2 )
70 aGroup.Remove( [2,3,4] )