---
name: "SoGroup"
section: "3iv"
platform: "linux"
package: "inventor-doc"
version: "2.1.6+ds-2"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/SoGroup/3iv"
---

# SoGroup(3iv)

base class for all group nodes

## NAME

SoGroup — base class for all group nodes

## INHERITS FROM

SoBase \> SoFieldContainer \> SoNode \> SoGroup

## SYNOPSIS

**#include \<Inventor/nodes/SoGroup.h\>**

Methods from class SoGroup:

	**SoGroup()**\
 	**SoGroup(int nChildren)**\
 **void**	**addChild(SoNode \*child)**\
 **void**	**insertChild(SoNode \*child, int newChildIndex)**\
 **SoNode \***	**getChild(int index) const**\
 **int**	**findChild(const SoNode \*child) const**\
 **int**	**getNumChildren() const**\
 **void**	**removeChild(int index)**\
 **void**	**removeChild(SoNode \*child)**\
 **void**	**removeAllChildren()**\
 **void**	**replaceChild(int index, SoNode \*newChild)**\
 **void**	**replaceChild(SoNode \*oldChild, SoNode \*newChild)**\
 **static SoType**	**getClassTypeId()**

Methods from class SoNode:

**void**	**setOverride(SbBool state)**\
 **SbBool**	**isOverride() const**\
 **SoNode \***	**copy(SbBool copyConnections = FALSE) const**\
 **virtual SbBool**	**affectsState() const**\
 **static SoNode \***	**getByName(const SbName &name)**\
 **static int**	**getByName(const SbName &name, SoNodeList &list)**

Methods from class SoFieldContainer:

**void**	**setToDefaults()**\
 **SbBool**	**hasDefaultValues() const**\
 **SbBool**	**fieldsAreEqual(const SoFieldContainer \*fc) const**\
 **void**	**copyFieldValues(const SoFieldContainer \*fc, SbBool copyConnections = FALSE)**\
 **SbBool**	**set(const char \*fieldDataString)**\
 **void**	**get(SbString &fieldDataString)**\
 **virtual int**	**getFields(SoFieldList &resultList) const**\
 **virtual SoField \***	**getField(const SbName &fieldName) const**\
 **SbBool**	**getFieldName(const SoField \*field, SbName &fieldName) const**\
 **SbBool**	**isNotifyEnabled() const**\
 **SbBool**	**enableNotify(SbBool flag)**

Methods from class SoBase:

**void**	**ref()**\
 **void**	**unref() const**\
 **void**	**unrefNoDelete() const**\
 **void**	**touch()**\
 **virtual SoType**	**getTypeId() const**\
 **SbBool**	**isOfType(SoType type) const**\
 **virtual void**	**setName(const SbName &name)**\
 **virtual SbName**	**getName() const**

## DESCRIPTION

**This node defines the base class for all group nodes. SoGroup** is a node that contains an ordered list of child nodes. The ordering of the child nodes represents the traversal order for all operations (for example, rendering, picking, and so on). This node is simply a container for the child nodes and does not alter the traversal state in any way. During traversal, state accumulated for a child is passed on to each successive child and then to the parents of the group (**SoGroup** does not push or pop traversal state as **SoSeparator** does).

## METHODS

	**SoGroup()**\
 Creates an empty group node.

	**SoGroup(int nChildren)**\
 Constructor that takes approximate number of children. Space is allocated for pointers to the children, but the group does not contain any actual child nodes.

**void**	**addChild(SoNode \*child)**\
 Adds a child as last one in group.

**void**	**insertChild(SoNode \*child, int newChildIndex)**\
 Adds a child so that it becomes the one with the given index.

**SoNode \***	**getChild(int index) const**\
 Returns pointer to child node with the given index.

**int**	**findChild(const SoNode \*child) const**\
 Finds index of given child within group. Returns -1 if not found.

**int**	**getNumChildren() const**\
 Returns number of children.

**void**	**removeChild(int index)**\
 Removes child with given index from group.

**void**	**removeChild(SoNode \*child)**\
 Removes first instance of given child from group.

**void**	**removeAllChildren()**\
 Removes all children from group.

**void**	**replaceChild(int index, SoNode \*newChild)**\
 Replaces child with given index with new child.

**void**	**replaceChild(SoNode \*oldChild, SoNode \*newChild)**\
 Replaces first instance of given child with new child.

**static SoType**	**getClassTypeId()**\
 Returns type identifier for this class.

## ACTION BEHAVIOR

**SoGLRenderAction, SoCallbackAction, SoGetBoundingBoxAction, SoHandleEventAction, SoRayPickAction**\
 Traverses each child in order.

**SoGetMatrixAction**\
 Does nothing unless the group is in the middle of the path chain the action is being applied to. If so, the children up to and including the next node in the chain are traversed.

**SoSearchAction**\
 If searching for group nodes, compares with this group. Otherwise, continues to search children.

**SoWriteAction**\
 Writes out the group node. This method also deals with any field data associated with the group node. As a result, this method is used for most subclasses of **SoGroup** as well.

## FILE FORMAT/DEFAULTS

```
Group {
}
```

## SEE ALSO

**SoArray, SoLevelOfDetail, SoMultipleCopy, SoPathSwitch, SoSeparator, SoSwitch**
