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

# SoPathSwitch(3iv)

group node that traverses only when traversed along a given path

## NAME

SoPathSwitch — group node that traverses only when traversed along a given path

## INHERITS FROM

SoBase \> SoFieldContainer \> SoNode \> SoGroup \> SoPathSwitch

## SYNOPSIS

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

Fields from class SoPathSwitch:

**SoSFPath**	**path**

Methods from class SoPathSwitch:

	**SoPathSwitch()**\
 	**SoPathSwitch(int nChildren)**\
 **static SoType**	**getClassTypeId()**

Methods from class SoGroup:

**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)**

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

**SoPathSwitch** is a group node that traverses its children only if the current traversal path matches the **SoPath** in the **path** field. This can be used, for example, to affect only one instance of a subgraph. The **path** field contains the path up to (but not including) the **SoPathSwitch**. The path need not go all the way back to the root; if it does not, then only the number of ancestors that are in the path are compared to see if the children should be traversed. A NULL path means that the children are never traversed.

## FIELDS

**SoSFPath**	**path**\
 The path that must match the current traversal path.

## METHODS

	**SoPathSwitch()**\
 Creates a path switch node with default settings.

	**SoPathSwitch(int nChildren)**\
 Constructor that takes approximate number of children.

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

## ACTION BEHAVIOR

**SoGLRenderAction, SoCallbackAction, SoGetBoundingBoxAction, SoRayPickAction, SoHandleEventAction**\
 Traverses the children if the paths match.

## FILE FORMAT/DEFAULTS

```
PathSwitch {
path	NULL
}
```

## SEE ALSO

**SoPath, SoSwitch**
