GenerativeComponents Help

Using Temporary Nodes within ByFunction techniques

Temporary nodes are nodes where no arguments are passed to the node's constructor. They can be used as constructions or intermediate steps when creating nodes. The benefit of using these is that they are lighter weight. This allows a number of steps to be taken with only the resulting node returned at the end of the function. The important thing to remember is that they are only temporary, so they themselves won't be added to the graph or get drawn unless they are returned at the end of the function:

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

transaction 2 modelChange 'Create Line from temporary features'
{
    node User.Objects.joiningLine Bentley.GC.NodeTypes.Line
    {
        Function                  = Line function(CoordinateSystem cs, double startX, double startY, double endX, double endY)
                                    {
                                    Point startPoint = new Point();
                                    startPoint.ByCartesianCoordinates(cs, startX, startY, 0.0);
                                    Point endPoint = new Point();
                                    endPoint.ByCartesianCoordinates(cs, endX, endY, 0.0);
                                    Line ln = new Line();
                                    ln.ByPoints(startPoint, endPoint);
                                    return ln;
                                    };
        FunctionArguments         = {baseCS, 0.2, 1.0, 0.8, 1.0};
    }
}