# Working with groups

The Salome platform offers such a useful functionality as creation and editing groups of subshapes of a geometrical object which makes handling subshapes much easier. However the functionality is available in the OCC viewer only. If other viewer is used in your project by default, you can toggle the OCC viewer via Preferences / Viewer background / OCC viewer.

To perform operations with groups:

In the main menu select New entity > Group.

Create a group

Description: Creates a group of subshapes of a geometrical object.

Result: GEOM_Object.

TUI Command: geompy.CreateGroup(MainShape, ShapeType), where MainShape is a shape for which the group is created, ShapeType is a type of shapes in the created group.

Arguments: 1 Shape + Type of subshape.

Dialog Box:

Example:

Edit a group

Description: Allows to edit the existing group.

Result: GEOM_Object.

TUI Command:

- geompy.AddObject(Group, SubShapeID), where Group is a group to which a sub shape has to be added, SubShapeID is an ID of the sub shape to be added to the group

- geompy.RemoveObject(Group, SubShapeID), where Group is a group from which a sub shape has to be removed, SubShapeID is an ID of the sub shape to be removed from the group

- geompy.GetObjectIDs(Group), where Group is a group for which its object ID’s are returned.

Returns: List of IDs.

Arguments: 1 Shape + its subshapes.

Dialog Box:

Our TUI Scripts provide you with useful examples of Working with Groups.