Click or drag to resize
SoPath Class

Path that points to a list of hierarchical nodes.

Inheritance Hierarchy

Namespace: OIV.Inventor
Assembly: OIV.Inventor (in OIV.Inventor.dll) Version: 2024.2.2.0 (10.16.2.0)
Syntax
public class SoPath : SoBase

The SoPath type exposes the following members.

Constructors
  NameDescription
Public methodSoPath

Constructs an empty path.

Public methodSoPath(Int32)

Constructs a path with a hint to length (number of nodes in chain).

Public methodSoPath(SoNode)

Constructs a path and sets the head node to the given node.

Top
Methods
  NameDescription
Public methodAppend(Int32)

Adds node to end of chain; the node is the childIndex'th child of the current tail node.

Public methodAppend(SoNode)

Adds node to end of chain; uses the first occurrence of childNode as child of current tail node.

Public methodAppend(SoPath)

Adds all nodes in fromPath's chain to end of chain; the head node of fromPath must be the same as or a child of the current tail node.

Public methodContainsNode(Type)

Returns true if the node type is found anywhere in the path chain.

Public methodContainsNode(SoNode)

Returns true if the node is found anywhere in the path chain.

Public methodContainsPath

Returns true if the nodes in the chain in the passed path are contained (in consecutive order) in this path chain.

Public methodCopy
Calls Copy(System.Int32(0), System.Int32(0)).
Public methodCopy(Int32)
Calls Copy(startFromNodeIndex, System.Int32(0)).
Public methodCopy(Int32, Int32)

Creates and returns a new path that is a copy of some or all of this path.

Public methodDispose
Releases all resources used by SoDisposable.
(Inherited from SoDisposable.)
Public methodEquals
Determines whether the specified Object is equal to the current Object.
(Inherited from Object.)
Public methodFindFork

If the two paths have different head nodes, this returns -1.

Public methodStatic memberGetByName(String)

Method to return a path with a given name.

Public methodStatic memberGetByName(String, SoPathList)

Method to return paths with a given name.

Public methodGetHashCode
Overrides GetHashCode().
(Inherited from SoNetBase.)
Public methodGetHead

Returns the first node in a path chain.

Public methodGetIndex

Returns the index of the i'th node (within its parent) in the chain.

Public methodGetIndexFromTail

Returns the index of the i'th node (within its parent) in the chain, counting backward from the tail node.

Public methodGetInstanceIndex

Returns the index of the instance inside the parent OIV.Inventor.Nodes.SoMultipleInstance, OIV.Inventor.Nodes.SoMultipleCopy or OIV.Inventor.Nodes.SoArray group.

Public methodGetInstanceIndexFromTail

Returns the index of the i'th node instance (within its parent, if it is a OIV.Inventor.Nodes.SoMultipleInstance, OIV.Inventor.Nodes.SoMultipleCopy or OIV.Inventor.Nodes.SoArray group in the chain, counting backward from the tail node.

Public methodGetLength Obsolete.

Returns length of path chain (number of nodes).

Public methodGetName

Returns the name of an instance.

(Inherited from SoBase.)
Public methodGetNode(Int32)

Returns the i'th node (within its parent) in the chain.

Public methodGetNode(Type, Int32)

Returns the first node and its index, from the head of the given type in the chain.

Public methodGetNodeFromTail

Returns the i'th node (within its parent) in the chain, counting backward from the tail node.

Public methodGetStringName (Inherited from SoBase.)
Public methodGetTail

Returns the last node in a path chain.

Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodIsSynchronizable

Gets the ScaleViz synchronizable state of this object.

(Inherited from SoBase.)
Public methodPop

The OIV.Inventor.SoPath.Push(System.Int32) and OIV.Inventor.SoPath.Pop() methods allow a path to be treated as a stack; they push a node at the end of the chain and pop the last node off.

Public methodPush

The OIV.Inventor.SoPath.Push(System.Int32) and OIV.Inventor.SoPath.Pop() methods allow a path to be treated as a stack; they push a node at the end of the chain and pop the last node off.

Public methodSetHead

Sets head node (first node in chain).

Public methodSetName (Inherited from SoBase.)
Public methodSetSynchronizable

Sets this to be a ScaleViz synchronizable object.

(Inherited from SoBase.)
Public methodToString
Converts this SoBase structure to a human readable string.
(Inherited from SoBase.)
Public methodTouch

Marks an instance as modified, simulating a change to it.

(Inherited from SoBase.)
Public methodTruncate

Truncates the path chain, removing all nodes from index start on.

Top
Properties
  NameDescription
Public propertyFullPath
This property allows you to retrieve a SoFullPath from an SoPath.
Public propertyIsDisposable
ISafeDisposable interface implementation.
(Inherited from SoDisposable.)
Public propertyLength

Returns length of path chain (number of nodes).

Top
Remarks

A path represents a scene graph or subgraph. It contains a list of nodes forming a chain from some root to some descendant. Each node in the chain is a child of the previous node. Paths are used to refer to some object in a scene graph precisely and unambiguously, even if there are many instances of the object. Therefore, paths are returned by both the OIV.Inventor.Actions.SoRayPickAction and OIV.Inventor.Actions.SoSearchAction.

When an action is applied to a path, only the nodes in the subgraph defined by the path are traversed. These include: the nodes in the path chain, all nodes (if any) below the last node in the path, and all nodes whose effects are inherited by any of these nodes.

OIV.Inventor.SoPath attempts to maintain consistency of paths even when the structure of the scene graph changes. For example, removing a child from its parent when both are in a path chain cuts the path chain at that point, leaving the top part intact. Removing the node to the left of a node in a path adjusts the index for that node. Replacing a child of a node when both the parent and the child are in the chain replaces the child in the chain with the new child, truncating the path below the new child.

Hidden children

Note that only public children of nodes are accessible from an OIV.Inventor.SoPath. Nodes like node kits limit access to their children and these "hidden children" will not be visible using the OIV.Inventor.SoPath methods.

For example, if your application does picking and gets a path from OIV.Inventor.Actions.SoRayPickAction, the actual last node in the path (tail) will normally be a shape node. But if that shape is part of a node kit, then the GetTail() method will return the node kit, not the shape node. To access all hidden children in the path, get the full path with the SoPath.FullPath property before calling get methods. To access hidden node kit children (but not all children) in the path, cast the path object to OIV.Inventor.SoNodeKitPath before calling get methods.

Node References:

An OIV.Inventor.SoPath object maintains a reference to every node in the path. These nodes will not be garbage collected as long as the OIV.Inventor.SoPath exists. Actions that return an OIV.Inventor.SoPath, for example OIV.Inventor.Actions.SoSearchAction and OIV.Inventor.Actions.SoRayPickAction, maintain a reference to the returned path (or paths). As long as the action exists and is not reset, the nodes referenced by the path cannot be garbage collected. See the OIV.Inventor.Actions.SoAction method clearApplyResult().

FILE FORMAT/DEFAULT

OIV.Inventor.SoPath {
[head node]
[number of remaining indices]
[index]
&...
[index]
}

Note that the indices in a written path are adjusted based on the nodes that are actually written to a file. Since nodes in the graph that have no effect on the path (such as some separator nodes) are not written, the siblings of such nodes must undergo index adjustment when written. The actual nodes in the graph remain unchanged.

OIV.Inventor.SoPath is not able to write "per instance" information to a file for instancing nodes like OIV.Inventor.Nodes.SoMultipleInstance and OIV.Inventor.Nodes.SoMultipleCopy. The saved path will reference the whole set of instances under OIV.Inventor.Nodes.SoMultipleInstance or SoMulitpleCopy node.

See Also