Different types of geometric scripts in OpenBuildings™ GenerativeComponents
These examples illustrate the different ways scripts can be used in OpenBuildings™ GenerativeComponents to generate geometry. The geometry is the same in this case but it is created using a range of different scripting techniques and concepts supported in OpenBuildings™ GenerativeComponents.
The below set of transaction is run for specified steps,
listed in the subsequent sections:
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 = {28.333, 117.5, 0.0, 115.59}; } } transaction 3 modelChange 'Change baseCS' { node User.Objects.baseCS Bentley.GC.NodeTypes.CoordinateSystem { Technique = 'AtModelOrigin'; DGNModelName = '3D Metric Design'; } } transaction 4 modelChange 'Change baseCS' { node User.Objects.baseCS Bentley.GC.NodeTypes.CoordinateSystem { GraphLocation = {25.0, 82.5, 174.0, 115.59}; } } transaction 5 script 'Points sequence by script transaction' { for (int j = 0; j < 10; ++j) { Point point = new Point("p_" + j); point.ByCartesianCoordinates(baseCS,j+1.0,0.0,j*j/10); } } transaction 6 modelChange 'First (using full point nodes) BSpline curve' { node User.Objects.curve1 Bentley.GC.NodeTypes.BSplineCurve { Points = {p_0, p_1, p_2, p_3, p_4, p_5, p_6, p_7, p_8, p_9}; Color = 3; } } transaction 7 modelChange 'Define scale variable' { node User.Objects.curveScale Bentley.GC.NodeTypes.Slider { Value = 1.0; Minimum = 0.1; Maximum = 2.0; } } transaction 8 modelChange 'Coordinate system for points defined by function' { node User.Objects.cs2 Bentley.GC.NodeTypes.CoordinateSystem { CoordinateSystem = baseCS; XTranslation = <free> 0.0; YTranslation = <free> 0.0; ZTranslation = <free> 4.0; HandlesVisible = true; } } transaction 9 modelChange 'Point (compound) defined by internal function' { node User.Objects.points2 Bentley.GC.NodeTypes.Point { Function = function (cs,num,scale) { for (int j = 0; j < num; ++j) { Point point = new Point(this); point.ByCartesianCoordinates(cs,j+1.0,0.0,scale*j*j/num); } }; FunctionArguments = {cs2,10,curveScale}; } } transaction 10 modelChange 'change curveScale variable' { node User.Objects.curveScale Bentley.GC.NodeTypes.Slider { Value = 1.031; } } transaction 11 modelChange 'Second (using child node points) BSpline curve' { node User.Objects.curve2 Bentley.GC.NodeTypes.BSplineCurve { Points = points2; Color = 4; } } transaction 12 modelChange 'Coordinate system for lightweight BSpline curve' { node User.Objects.cs3 Bentley.GC.NodeTypes.CoordinateSystem { CoordinateSystem = baseCS; XTranslation = 0.0; YTranslation = 0.0; ZTranslation = <free> 8.0; HandlesVisible = true; } } transaction 13 modelChange 'Third (using DSeries lightweight points) BSpline curve (defined by internal function)' { node User.Objects.curve3 Bentley.GC.NodeTypes.BSplineCurve { Function = function (cs,num,scale) { DPoint3d dPoint = {}; // list of points for (int j = 0; j < num; ++j) { dPoint[j] = new DPoint3d(1.0+j, 0.0, scale*j*j/num); } this.ByPointsAsDPoint3ds(cs, dPoint); }; FunctionArguments = {cs3,10,curveScale}; } } transaction 14 modelChange 'Coordinate system for BSpline curve defined with inline function' { node User.Objects.cs4 Bentley.GC.NodeTypes.CoordinateSystem { CoordinateSystem = baseCS; XTranslation = 0.0; YTranslation = 0.0; ZTranslation = <free> 12.0; HandlesVisible = true; } } transaction 15 modelChange 'Fourth BSpline curve only as point' { node User.Objects.p5T Bentley.GC.NodeTypes.Expression { Value = 0.5; IsValueDisplayed = true; } node User.Objects.point4 Bentley.GC.NodeTypes.Point { Function = function(cs,num,scale,t) { DPoint3d dPoint = {}; // list of points for (int j = 0; j < num; ++j) { dPoint[j] = new DPoint3d(1.0+j, 0.0, scale*j*j/num); } BSplineCurve childBSpline = new BSplineCurve(); childBSpline.ByPointsAsDPoint3ds(cs, dPoint); this.ByParameterAlongCurve(childBSpline,t); }; FunctionArguments = {cs4, 10, curveScale,p5T}; } }