Click or drag to resize
SoGetPrimitiveCountAction Class

Counts number of primitives in scene.

Inheritance Hierarchy
SystemObject
  OIV.InventorSoNetBase
    OIV.Inventor.ActionsSoAction
      OIV.Inventor.ActionsSoGetPrimitiveCountAction

Namespace: OIV.Inventor.Actions
Assembly: OIV.Inventor (in OIV.Inventor.dll) Version: 2024.1.0.0 (2024.1.0)
Syntax
public class SoGetPrimitiveCountAction : SoAction

The SoGetPrimitiveCountAction type exposes the following members.

Constructors
  NameDescription
Public methodSoGetPrimitiveCountAction

Constructor.

Top
Methods
  NameDescription
Public methodAddNumImage
Public methodAddNumLines
Public methodAddNumPoints
Public methodAddNumText
Public methodAddNumTriangles
Public methodApply(SoNode)

Initiates an action on the graph defined by a node.

(Inherited from SoAction.)
Public methodApply(SoPath)

Initiates an action on the graph defined by a path.

(Inherited from SoAction.)
Public methodApply(SoPathList)
Calls Apply(pathList, false).
(Inherited from SoAction.)
Public methodApply(SoPathList, Boolean)

Initiates an action on the graph defined by a list of paths.

(Inherited from SoAction.)
Public methodCanApproximateCount

Returns whether shapes are allowed to approximate their count.

Public methodClearApplyResult

When applied, an action may reference nodes or create objects (e.g.

(Inherited from SoAction.)
Public methodContainsNonTriangleShapes

Returns true if scene contains some primitives that are not triangles.

Public methodContainsNoPrimitives

Returns true if scene contains no primitives of any kind.

Public methodStatic memberEnableElement
Public methodEnableElements Obsolete.
Returns the list of enabled elements for a given action subclass.
(Inherited from SoAction.)
Public methodEquals
Determines whether the specified Object is equal to the current Object.
(Inherited from Object.)
Public methodForwardTraversal(SoNode)

Traverse a node that is not part of the current scenegraph.

(Inherited from SoAction.)
Public methodForwardTraversal(SoPath)

Traverse a path that is not part of the current scenegraph.

(Inherited from SoAction.)
Public methodGetContinueActionInBranchFlag

This function indicates if the action must stop in the current branch.

(Inherited from SoAction.)
Public methodGetCurPath

Returns the path accumulated during traversal, i.e., the chain of nodes from the root of the traversed graph to the current node being traversed.

(Inherited from SoAction.)
Public methodGetDecimationPercentage

Gets decimation percentage.

Public methodGetDecimationType

Gets decimation type.

Public methodGetDistribMode

Returns the distribution mode of this action across a cluster (ScaleViz-Cluster only).

(Inherited from SoAction.)
Public methodGetHashCode
Overrides GetHashCode().
(Inherited from SoNetBase.)
Public methodGetImageCount

Returns counted number of primitives (images).

Public methodGetLineCount

Returns counted number of primitives (lines).

Public methodGetNodeAppliedTo

Returns the node the action is being applied to.

(Inherited from SoAction.)
Public methodGetOriginalPathListAppliedTo

Returns the original path list the action is being applied to.

(Inherited from SoAction.)
Public methodGetPathAppliedTo

Returns the path the action is being applied to.

(Inherited from SoAction.)
Public methodGetPathCode

Returns path code based on where current node (the node at the end of the current path) lies with respect to the path(s) the action is being applied to.

(Inherited from SoAction.)
Public methodGetPathListAppliedTo

Returns the path list the action is being applied to.

(Inherited from SoAction.)
Public methodGetPipeId

Gets pipe identifier in the range [1..N] associated to this render action while running a ScaleViz Multipipe configuration.

(Inherited from SoAction.)
Public methodGetPointCount

Returns counted number of primitives (points).

Public methodGetSceneManager

Return the OIV.Inventor.SoSceneManager associated with this action.

(Inherited from SoAction.)
Public methodGetState

Gets the state from the action.

(Inherited from SoAction.)
Public methodGetTextCount

Returns counted number of primitives (text).

Public methodGetTriangleCount

Returns counted number of primitives (triangles).

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

Returns code indicating what action is being applied to.

(Inherited from SoAction.)
Public methodHasTerminated

Returns true if the traversal has reached a termination condition.

(Inherited from SoAction.)
Public methodIncNumImage
Public methodIncNumLines
Public methodIncNumPoints
Public methodIncNumText
Public methodIncNumTriangles
Public methodInvalidateState

Invalidates the current traversal state in the action, forcing it to be recreated when the action is next applied.

(Inherited from SoAction.)
Public methodIs3DTextCountedAsTriangles

Returns how OIV.Inventor.Nodes.SoText3 should be counted: as a triangle-based shape (true) or as a text-based shape (false).

Public methodIsBeingApplied

Returns true if this action is currently being applied.

(Inherited from SoAction.)
Public methodIsLastPathListAppliedTo

Returns true if the current list is the last one from the original.

(Inherited from SoAction.)
Public methodIsUsingAlternateRep

Returns true if current action is using alternate representations.

(Inherited from SoAction.)
Public methodPostDelayedTraversal

Method called by SoMultiPassManager after delayed pass traversals.

(Inherited from SoAction.)
Public methodPreDelayedTraversal

Method called by SoMultiPassManager before delayed pass traversals.

(Inherited from SoAction.)
Public methodResetContinueActionInBranchFlag

This function resets the continue action flag.

(Inherited from SoAction.)
Public methodSetCanApproximate

Some shapes may be able to guess an approximate number of triangles without actually counting.

Public methodSetCount3DTextAsTriangles

OIV.Inventor.Nodes.SoText3 can be counted two ways: as a triangle-based shape or as a text-based shape.

Public methodSetDecimationValue(SoDecimationTypeElementTypes)
Calls SetDecimationValue(type, 1.0).
Public methodSetDecimationValue(SoDecimationTypeElementTypes, Single)

Sets decimation type and percentage.

Public methodSetPipeId

Sets pipe identifier in the range [1..N] associated to this render action while running a ScaleViz Multipipe configuration.

(Inherited from SoAction.)
Public methodSetSceneManager

Set the scene manager associated with this action (if any ).

(Inherited from SoAction.)
Public methodSetUpState

Creates state if it is NULL or it is no longer valid because new elements have been enabled since it was created.

(Inherited from SoAction.)
Public methodStopActionInBranch

This function stops the action in the current Scene Graph branch.

(Inherited from SoAction.)
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Public methodTraverse

Does traversal of a graph rooted by a node.

(Inherited from SoAction.)
Public methodUseAlternateRep

Tell the action to use alternate representations during traversal when available.

(Inherited from SoAction.)
Top
Remarks

This class counts the number of rendering primitives a scene would use to render. This can be used as an approximation of how long the scene would take to render. The primitives are divided into five categories: triangles, lines, points, text objects, and images.

After applying the action to a path or scene graph, the results can be obtained with the functions OIV.Inventor.Actions.SoGetPrimitiveCountAction.GetTriangleCount(), OIV.Inventor.Actions.SoGetPrimitiveCountAction.GetLineCount(), etc. The decimation value can be altered before applying, which is useful for finding the minimum and maximum number of primitives the scene requires (use LOWEST and HIGHEST).

3D Text, such as OIV.Inventor.Nodes.SoText3 can be counted as either text or triangles. The function OIV.Inventor.Actions.SoGetPrimitiveCountAction.SetCount3DTextAsTriangles(System.Boolean) will determine how these objects are counted.

Polygonal geometry nodes, for example OIV.Inventor.Nodes.SoIndexedFaceSet, are always counted as triangles even if the draw style (OIV.Inventor.Nodes.SoDrawStyle) is set to LINES or POINTS.

Some shapes, such as trimmed NURBS surfaces, can answer quicker if they are allowed to approximate how many primitives they will use instead of calculating an exact answer. If an exact answer is not required, passing true to OIV.Inventor.Actions.SoGetPrimitiveCountAction.SetCanApproximate(System.Boolean) will speed the action.

Elements Sets: OIV.Inventor.Elements.SoDecimationTypeElement, OIV.Inventor.Elements.SoDecimationPercentageElement

EXAMPLE

SoGetPrimitiveCountAction gpca = new SoGetPrimitiveCountAction();
gpca.Apply( root );
int numTris = gpca.GetTriangleCount();

See Also