ConstructionHistory

Object Hierarchy

Inheritance

    SIObject
       ConstructionHistory

Description

This object represents the Operator stack for a Primitive object. It allows you to browse through the stack one operator at a time by enumerating the ConstructionHistory object, which you can get with the Primitive.ConstructionHistory property.

The operator stack on a primitive is called the "Construction History" because the order of the operators generally reflects the order that the operators were created. However because of the concept of siConstructionMode, operators may sometime be added underneath existing operators.

The construction history is one example of the more general concept of "Connection Stack", see DataRepository.GetConnectionStackInfo for details.

Note: For performance reasons the Item and Count properties have not been implemented, so you have to enumerate the entire stack and check each one to see if it's the one you want.

Methods

Filter | Find | IsClassOf | IsEqualTo

Properties

Application | Categories | FullName | Help
Name | NestedObjects | Origin | OriginPath
Parent | Type |  |

Examples

1. VBScript Example

    ' Set up the scenario (a cylinder with two operators)
    Set oObj = CreatePrim( "Cylinder", "MeshSurface" )
    ApplyOp "Bulge", oObj, 3, siPersistentOperation
    ApplyOp "Twist", oObj, 3, siPersistentOperation

    ' First find the cylinder with the operators on it
    Set oRoot = ActiveSceneRoot
    Set oCyl = oRoot.FindChild(,,siMeshFamily)

    ' Now get the primitive from the cylinder and then the
    ' operator stack as the construction history object
    Set oPrim = oCyl.ActivePrimitive
    Set oOpStack = oPrim.ConstructionHistory

    ' This isn't a normal collection, so Count and Item
    ' do not work, as you can see if you uncomment these lines:
    REM LogMessage "The stack contains " & oOpStack.Count & " operators."
    REM LogMessage "...and the first one is: " & oOpStack.Item(0)

    ' Since you cannot indicate which one you want with Item,
    ' you need to enumerate each one to check to see whether it
    ' is the one you are looking for
    For Each o in oOpStack
       If (o = oPrim & ".bulgeop") Then

           ' You found it!
           Set oBulgeOp = o

           ' Find the DeformAlong settings and toggle Y and Z
           For Each p in oBulgeOp.Parameters
              Select Case p.ScriptName
                  Case "defy"
                     LogMessage "Original value for DeformAlongY = " & p.Value
                     p.Value = not( p.Value )
                     LogMessage "New value = " & p.Value
                  Case "defz"
                     LogMessage "Original value for DeformAlongZ = " & p.Value
                     p.Value = not( p.Value )
                     LogMessage "New value = " & p.Value
                  Case Else
              End Select
           Next
       End If
    Next

    REM Output of above script is:
    'INFO : "Original value for DeformAlongY = False"
    'INFO : "New value = True"
    'INFO : "Original value for DeformAlongZ = True"
    'INFO : "New value = False"

2. VBScript Example

    ' The following code illustrates how to get a ConstructionHistory
    ' object and how to iterate the construction history using the
    ' For Each...Next statement:

    Set oObject = Application.ActiveProject.ActiveScene.Root.AddGeometry("Sphere","MeshSurface")
    ApplyOp "Twist", oObject
    ApplyOp "Bend", oObject
    ApplyOp "Taper", oObject

    LogMessage "The " & oObject.Name & " has the following operators applied:"

    For Each oOperator in oObject.ActivePrimitive.ConstructionHistory
       LogMessage vbTab & oOperator.Name
    Next

    REM The output of the above script is:
    'INFO : "The sphere has the following operators applied:"
    'INFO : " Taper Op"
    'INFO : " Bend Op"
    'INFO : " Twist Op"
    'INFO : " Geometry"

3. JScript Example

    //jscript example showing how to
    //enumerate the Operators on a geometry

    var oGrid = ActiveProject.ActiveScene.Root.AddGeometry( "Sphere", "MeshSurface" ) ;
    ApplyOp("Bulge", oGrid.Name, 3, siPersistentOperation);
    ApplyOp("Bend", oGrid.Name, 3, siPersistentOperation);

    oEnum = new Enumerator( oGrid.ActivePrimitive.ConstructionHistory );
    for (;!oEnum.atEnd();oEnum.moveNext())
    {
       // Print the name of the operator
       logmessage( oEnum.item().fullname ) ;
    }

    // Output of this script is:

    //INFO : "sphere.polymsh.bendop"
    //INFO : "sphere.polymsh.bulgeop"
    //INFO : "sphere.polymsh.geom"

See Also

Primitive.ConstructionHistory | Operator

Autodesk Softimage v7.5