Introduction
The goal is to create a freeform roof that will be used to cover a courtyard, in which there is a tree. The roof must adapt to the position of the tree. At the moment we do not exactly know where the tree will be placed. We need to be able to move the tree, and observe the changing roof form.
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.
Save the .gct file
- Save the file with an appropriate name, for instance, roofexample01.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.
Familiarize yourself with the view rotation in the bottom tool bar of the geometric view window
- 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
.
Create the Trigger and Grid Point
To begin the model, select the point creation shortcut
and place two Points in an axonometric view into the geometric model. One of these points will represent the tree also called the trigger point. The other point will (at the moment) represent the ‘spot’ base point or grid point for the roof within the courtyard.
Create Line to Measure Distance
We are going to create a Line between these points, in order to measure the distance between the tree and the sample roof base point.
- To create a Feature that does not have a shortcut button, open the Feature list
. - Click on the Line Feature and expand it.
- From the available Feature update methods (the different possible ways to create this Feature based on various combinations of inputs), select ByPoints.
- The ByPoints method expects a StartPoint and an EndPoint in order to create a Line.
- Click on the StartPoint variable under the ByPoints method.
- To select an existing Feature as the StartPoint HOLD DOWN THE CTRL KEY, then hover over the point in the geometry view until the name of the Feature appears in the input window
- Now press a ‘Data Point’ (left-mouse button) or the Return key.
- Repeat this process for the EndPoint.
- Once sufficient inputs have been defined (in this case the StartPoint and the EndPoint) the Apply button is enabled.
- Press the Apply Button and the Line is created.
Creating a Responsive Offset Line
We now want to create a vertical offset point above the base point of the roof. To do this we are going to create another Line, but this time based on the location of the base point (as its StartPoint) and in a vertical direction, with a Length equal to the first Line we created.
- We want to create another Line, so click the Create Copy button on the Edit Feature form.
- Select the ByStartPointDirectionAndLength method (it is the next one down the list of methods).
- Select point02 as the StartPoint ( to HOLD DOWN THE CTRL KEY), then hover over the point in the geometry view until the name of the Feature appears in the input window.
- Now press a Data Point (left-mouse button) or the Return key.
- Select the vertical axis of the baseCS (baseCS.Zdirection).
- For the length, we need to select Line01. But we do not just want the Line01, but rather its property Line01.Length, so HOLD DOWN THE CTRL KEY, then hover over the line01 in the geometry view until its name appears in the input field for ‘Length’, but DO NOT right-mouse click or “Enter.”
- Now (with the Ctrl key released) bring the cursor back to the ‘Length’ input field, and type in the “.” ‘period’ or “dot” character.
- A list of properties appears, either enter the letters ‘le’ and the ‘Length’ property will be highlighted (using an auto-completion technique), or scroll down the list and manually highlight the Length property.
- Double-click to select the Length property.
- Click Return to indicate that the expression line01.Length is your complete entry for the field.
- Click Apply and the line02 appears.
Testing the Model Relations
We now need to test the model we have created. We can exercise a model (in dynamics) by moving one of the input points and observing the resulting behavior of the model.
- Select the Move tool
. - Select the XY handle of point02.
- Move the cursor.
- Observe that the Length of Line02 is always the same as the Length of Line01.
Adjusting the relation
While we have established some sort of relationship, we might observe that the vertical Line becomes shorter the closer Point01 is to Point02. If the StartPoint of Line02 represents the base point of the roof, then EndPoint of Line02 represents the height of the roof. We want the roof to be higher, the closer it is to the tree (represented by point01). What we have is the inverse of the relationship we required. So to change this:
- Select the input Length for line02.
- Change this expression to 5.0/(line01.Length+1.0).
- We add the +1.0 to line01.Length, so that if line.01.Length was zero, we would not divide by zero. We need to put line01.Length+1.0 in parenthesis () so that this is evaluated before the division.
- Again, we need to test the behavior of the model with this new relationship.
- Use the Move tool
to move point02 and observe the relationship that the Length of line02 increases as point02 approaches point01. - Experiment with different expression for the Length input property for Line02.
Creating a Grid of Points from the Base Point
At the moment Point02 and Line02 represent a ‘sample’ point within the proposed courtyard. We now want to ‘replicate’ Point02 (and hence Line02) to represent the ‘grid’ of points within the courtyard
- Use the Edit Feature Command
and select point02 for editing. - We are going to change the ‘single’ value for the Xtranslation input property into a ‘list’ of values, using the Series function.
- When you select the Xtranslation field you will see the
button in the field. Click on it and the Script Expression Builder displays. - Select the Functions tab and scroll down to the Series function, and hover over this entry.
- We can see that the Series function creates a list of values, given a start value, end value and increment. (‘start’, ‘final’, and ‘increment’ are referred to as the ‘arguments’ of the function).
- Click the Replace button (to replace the current value with the ‘prototype’ usage of the Series function).
- Use a start = 5, a final = 10 and an increment = 1, so as to give an input expression Series(5,10,1) and hit Return.
- Copy and Paste (Ctrl c and Ctrl v) the expression Series(5, 10, 1) into the Ytranslation field and hit Return.
Finally we click Apply (and ‘fit’ the view).
- Notice that as we ‘replicate’ point02, so line02 is also replicated.
- Here we have a list of points, where each point has a ‘corresponding’ YTranslation, for each Xtranslation. But what we want is a rectangular array of points (and hence lines), where for each Xtranslation we iterated through all values of Ytranslation.
- This can be achieved by using the ‘Replication Min/Max’ command
We now need to exercise the model, but first we need to ‘tune’ the display.
- In order to ‘see’ what we have created, we need to suppress the display of some of the intermediate construction, so using the ‘Display’ command we can hide the point02 and turn line01 to a construction view using
. - In order to make the length of the vertical lines (line02) more ‘readable,’ we can display the EndPoint (using the ‘Construction Display’
command).
Exercising the Model
- In this excise the points representing the courtyard roof points (point02) are fixed in X and Y (using the Series functions) so we are going to move the Point representing the tree (point01).
- Use the Move tool
with point01’s XY handle.
Adding a Roof Surface
We can now add a surface to represent the roof.
- To create a Feature that does not have a shortcut button open the Feature list
. - Click on the BSplineSurface Feature and expand it.
- From the available update methods (the different possible ways to create this Feature based on various combinations of inputs) select ByPoles.
- The ByPoles update method expects a rectangular array of points in order to create a BSplineSurface.
- Click on the Poles variable under the ByPoles method.
- To select an existing Feature as the Poles HOLD DOWN THE CTRL KEY, then hover over the line02.EndPoint in the geometry view until the name of the Feature appears in the input window, for example as {line02[2][3].EndPoint}.
- We have selected an individual point, when in fact we want the whole 2D array (or ‘collection of collections’), so we need to remove the index’s [2][3].
- Also this input property is expecting a collection and to anticipate this has added an opening‘{‘ and a closing ‘}’. Because line02 is already a ‘collection of collections’, so line02.EndPoint is ‘collection of collections’ of points, so we can remove them.
- Hit Enter to confirm the selection.
- Once sufficient inputs have been defined (in this case the Poles) the Apply button is enabled.
- Press the Apply Button and the Line is created.
- If the surface displays in wireframe this can be changed to Phong display using the View Attributes dialog
in the MicroStation tool bar at the bottom.
Exercising the model
We can now exercise the complete model using the move command with point01.
- First use the ‘Construction Display’ command
to hide the line02.EndPoint. - Next use the ‘Display’ command
to hide line02. - Finally move
point02. - We now have a responsive surface using only five Features, baseCS, point01, point02, line01, line02, bSplineSurface01.