GenerativeComponents Help

Updating Nodes in Script Transactions

Nodes will update in script transactions if they are top-level nodes and one of the top-level nodes given as one of their arguments changes. If some of their arguments are calculated within the script transaction, these will not be recalculated. In following example a change in point01 or localCS will trigger an update in the top-level node scriptedPoint.

transaction 1 modelChange 'Add baseCS'
{
    node User.Objects.baseCS Bentley.GC.NodeTypes.CoordinateSystem
    {
        Technique                 = 'AtModelOrigin';
        DGNModelName              = '3D Metric Design';
        GraphLocation             = {29.167, 80.0};
    }
}

transaction 2 modelChange 'Add point01'
{
    node User.Objects.point01 Bentley.GC.NodeTypes.Point
    {
        Technique                 = 'ByCartesianCoordinates';
        XTranslation              = <free> 0.0;
        YTranslation              = <free> 0.0;
        ZTranslation              = <free> 0.0;
        GraphLocation             = <auto> {303.167, 80.0};
    }
}

transaction 3 script 'Create top-level Point'
{
    		Point pt = new Point("scriptedPoint");
    		pt.ByCartesianCoordinates(baseCS, 0, 0, 2.0, point01);
}

If an expression uses any local variables, then only the expression's resultant value is passed to the node; no dependency link is established. In the following example, scriptedPoint will not update if expression01 changes, because expression01 is not one of its direct arguments.

transaction 1 modelChange 'Add expression01'
{
    node User.Objects.expression01 Bentley.GC.NodeTypes.Expression
    {
        Technique                 = 'Default';
        GraphLocation             = <auto> {40.0, 40.0};
    }
}

transaction 2 modelChange 'Change expression01'
{
    node User.Objects.expression01 Bentley.GC.NodeTypes.Expression
    {
        GraphLocation             = {378.0, 91.0};
    }
}

transaction 3 modelChange 'Add baseCS'
{
    node User.Objects.baseCS Bentley.GC.NodeTypes.CoordinateSystem
    {
        Technique                 = 'AtModelOrigin';
        GraphLocation             = <auto> {652.0, 91.0};
    }
}

transaction 4 modelChange 'Change baseCS'
{
    node User.Objects.baseCS Bentley.GC.NodeTypes.CoordinateSystem
    {
        GraphLocation             = {2.0, 7.0};
    }
}

transaction 5 modelChange 'Change baseCS'
{
    node User.Objects.baseCS Bentley.GC.NodeTypes.CoordinateSystem
    {
        Technique                 = 'AtModelOrigin';
        DGNModelName              = '3D Metric Design';
    }
}

transaction 6 modelChange 'Change expression01'
{
    node User.Objects.expression01 Bentley.GC.NodeTypes.Expression
    {
        Technique                 = 'Default';
        Value                     = 6;
    }
}

transaction 7 modelChange 'Change expression01'
{
    node User.Objects.expression01 Bentley.GC.NodeTypes.Expression
    {
        Technique                 = 'Default';
        Value                     = 6+3;
    }
}

transaction 8 modelChange 'Change expression01'
{
    node User.Objects.expression01 Bentley.GC.NodeTypes.Expression
    {
        GraphLocation             = {329.0, 95.0};
    }
}

transaction 9 script 'Create top-level Point using local variable'
{
    		double x = expression01 + 5;
    		Point pt = new Point("scriptedPoint");
    		pt.ByCartesianCoordinates(baseCS, x, 0, 2.0);
}

Normally, when an expression is passed as an argument to a node technique, the expression itself is passed along with its resultant value. Both the expression and its value are recorded into the corresponding node property. Subsequently, GC's dependency analyzer will examine the expression, and will create dynamic links based on whichever node names appear in the expression.

However, if the entire expression is enclosed within parentheses, the expression will be "reduced" to only its resultant value, before that value is passed to the technique. In that case, no dynamic link will be established.

In the following example, the raisedPoint will update only when point01 moves in the Y Direction, not when it moves in the X or Z directions.

transaction 1 modelChange 'Add baseCS'
{
    node User.Objects.baseCS Bentley.GC.NodeTypes.CoordinateSystem
    {
        Technique                 = 'AtModelOrigin';
        GraphLocation             = <auto> {40.0, 40.0};
    }
}

transaction 2 modelChange 'Change baseCS'
{
    node User.Objects.baseCS Bentley.GC.NodeTypes.CoordinateSystem
    {
        GraphLocation             = {23.333, 76.667};
    }
}

transaction 3 modelChange 'Change baseCS'
{
    node User.Objects.baseCS Bentley.GC.NodeTypes.CoordinateSystem
    {
        Technique                 = 'AtModelOrigin';
        DGNModelName              = '3D Metric Design';
    }
}

transaction 4 modelChange 'Add point01'
{
    node User.Objects.point01 Bentley.GC.NodeTypes.Point
    {
        Technique                 = 'ByCartesianCoordinates';
        XTranslation              = <free> 0.0;
        YTranslation              = <free> 0.0;
        ZTranslation              = <free> 0.0;
        GraphLocation             = <auto> {297.333, 76.667};
    }
}

transaction 5 script 'Semi responsive point'
{
    		Point pt = new Point("raisedPoint");
    		pt.ByCartesianCoordinates(baseCS, (point01.X), point01.Y, (point01.Z + 2));
}