# Introduction

A simple example of using geometric context as the driver for generating adaptive versions of a design.

For more examples refer to the GenerativeComponents Documentation page.

# Create a new GCTransaction file

- Create a new GenerativeComponents Transaction file by pressing the New Script Transaction file button .
- Arrange the windows in such a way that they do not overlap and both the symbolic view and the geometric view are visible as well as the GenerativeComponents control panel.

# Saving the .gct File

- Save the file with an appropriate name, for instance bridgeexample01.gct, by clicking on the Save or Save as icon . If you resume your work open the file using the open button . GenerativeComponents does not save geometry, but the instructions to generate geometry, so the .gct file cannot be opened in MicroStation or other CAD programs directly.

# View Rotation and the View Window Toolbar

- Press for view rotation. To get back to an orthographic view select the spinning arrow and switch from dynamic to “top” in the pull-down menu. This is MicroStation functionality.
- To zoom in and out there are the + and – buttons at the bottom of the window frame for Pan and Fit .
- To shade a view click on the lightening bolt and select the shading mode .

# Placing the Support Points

- To begin the model select the point creation shortcut and place four points in an axonometric view into the geometric model in two pairs as the future bridge supports.

# Creating the Bridge Supports

Based on those four points one can create two lines which specify the direction of the cross section of the bridge at that point. Use the Line Feature from the Feature List and then the * ByPoints *update method. Locate the points by clicking into the input fields and then holding down the Ctrl key. Click on the respective points to select them, confirm the creation of the Line by pressing OK.

In order to get the direction of the bridge path, which is perpendicular to the section Line we can place a CoordinateSystem onto each of the lines. Use the CS shortcut and holding down the Ctrl key, click on the lines to place the CS onto the line. This is equivalent to selecting CoordinateSystem from the Feature list and selecting the * ByParameterAlongCurve *update method. Make sure that the T value is set to 0.5 by editing the CS with the edit tool .Add

*as the optional UpVector to make sure the CS does not flip.*

**baseCS.ZDirection**

We can now use the XDirection of those CoordinateSystems to construct to tangent lines needed to create a BSplineCurve path for the main bridge span. Go to the Feature list and choose * Line.ByStartDirectionandLength*. As StartPoint we can choose the

*and*

**coordinateSystem01***respectively (for the two lines), as the Direction the*

**coordinateSystem02***and*

**coordinateSystem01.XDirection***respectively and as the length for now a fixed value of 4. Hit OK to create the line.*

**coordinateSystem02.XDirection**

# Creating the Bridge Center Curve

In the Feature List select * BSplineCurve.ByTangents* to create a BSplineCurve. The line03 and line04 will be the two tangents. Since there is only one input field and the input expects a list of lines we need to construct a list of lines on the fly by typing

**{line03, line04} **

# Constructing the adaptive Bridge Section

Similar to the roof example we can again establish a set of planes on the BSplineCurve.

For the section we need a plane that is perpendicular to the path and one that is parallel to the horizontal component of the path.

- Start by opening the Feature library .
- Scroll to “P” like Plane and open the methods. Select
as the creation method.**ByParameterAlongCurve** - As the curve select our BSpline by holding down the Ctrl key and then hovering over the
.**BSplineCurve** - For the
Parameter type in a number of type double between**T**and**0**, which is the permissible range for a parametric curve in GenerativeComponents, so for instance 0.3 and then press Return.**1** - Right-click on the
variable afterwards and make sure the free option is checked so the plane can be moved along the curve for testing.**T** - Select the Move tool and click on the red circle handle that is around the plane you just created.

Create the second plane that will be horizontal at all times. To create it select * Plane *from the Feature library again but this time choose

*as the update method.*

**ParallelToPlaneThroughPoint**To create the “ribs” or outrigger for the in-between section, we need to first define the direction the cross members should be pointing to. We can derive this direction from intersecting the two planes we already have since their intersection will create a Direction that is always horizontal and always perpendicular to the curve.

- To create a Direction we need to go to the Feature library and select the Feature “Direction.” As the creation method we choose
. Fill in**ByPlanePlaneIntersection**and**plane01**and click OK.**plane02** - Now that we have the direction of the ribs we can create two lines that point in opposite directions from the planes.
- Select
again from Feature list and as the method**Line**. The**ByStartPointDirectionAndLength**is again**StartPoint**and the**plane01**is the*Direction*we just created. As length we use for now half the length of one of the support lines. In order to create that reference we select the support Line**direction01**then use the dot again to access its properties, double-click on Length. Multiply the result by**line01**. The final expression should look like this:**0.5**

**Length = line01.Length * 0.5**

- Press Apply only, not OK, to keep the dialog window open, because we need it for the next step.
- To repeat the Line to the other side we can use the Create Copy button to the left of Apply. Create Copy keeps the current values but creates a new Line instance. The only change we need to make is inverting the direction of the Line by changing the Length from 0.5 to –0.5. Now press OK.
- In addition we can place two points using the point shortcut tool onto the lines end points for easier reference.
- We should see the view below now.

# Creating the Equation driven Section Points

- Next in order to create an equation driven adaptable cross section we create three points related to the cross section Line EndPoints.
- First we should create several variables to control the Sin based equation we are about to use to control the cross section.
- The GraphVariables can easily be created using the Manage GraphVariable window. We can find it under Graph->Manage Graph Variables. Here add three variables using the Add button. Name them amp1, leng, and offset. After creating them select each and click the limit to range checkbox at the bottom to add sliders to the interface. The window should look like this now.

- Now we can use these variables in a sin expression that determines the height of the cross section for step along the length of the path. Amp1 stands for the scale factor of the sine function result, leng stands for the scale factor of the 0-1 range along the Line of the T parameter. 360 would give us one sine revolution, we start with 720 to better observe what happens. Offset is a value that shifts the result of the equation. That way we can shift the range of pos. and neg. values of the sine equation into the positive range.

We create a simple point using the point shortcut. Then we can edit the point and select one of the section line EndPoints as the optional origin. Set the X and Ytranslation to 0. This will make the point coincide with its origin point. Now if we add our sine expression to the Ztranslation we get what we want.

**Ztranslation = (Sin (plane01.T*leng)*amp1)-offset **

Add another point for the other line’s EndPoint using the same expression. A third point is placed using the plane along the curve as the origin and a fixed offset of -1.

# Arraying the Section

Now we can array the initial plane along the curve to replicate our cross section construct. Set the plane01.T to

**plane01.T = Series(0, 1.0, 0.1) **

This gives us the distribution of sections along the curve with the Points on the edges undulating according to our sine expression as the section steps along the curve.

# Creating a Surface from the Section Points

Now we can use those points to create a BSplineSurface, similar to the roof exercise again. Create a BSplineSurface Feature using the ByPoles update method

**Poles = { point05, point06, point07, point08, point09 } **

Assuming that the sequence of points is such that point05 and point06 are the Line EndPoints, point07 and point09 are the sin offset points and point08 is the middle offset point.

Set the optional * Vclosed *flag to true to create a surface tube.

Then we should end up with the surface below.

# Adding Context to the Bridge

In order to visualize the context for the bridge body better we can add surfaces to the end pieces of the support to symbolize the supports. To do so we can add Lines to the CoordinateSystems pointing into the negative direction downwards. We could write a small function that calculates the lowest point of the surface as a driver for the Line length or simply use a fixed value for now.

Now we can play with the variables and the four support points from the very beginning to see the bridge body adapt and change based on the varying context conditions.

Changing the variables can produce either a very continuous body when the leng variable is very small, or when going beyond 360 a very undulating body.

This is the end of this simple example that introduced the use of equations to control simple surfaces based on a geometric context. In contrast to the roof example the geometry of the bridge center line is a result of the boundary conditions and not explicitly described through control points.