Sie sind auf Seite 1von 338

GenerativeComponents V8i

Essentials
08.11.08

Bentley Institute Course Guide

TRN012930-1/0002

Trademarks
AccuDraw, Bentley, the B Bentley logo, MDL, MicroStation and SmartLine are
registered trademarks; PopSet and Raster Manager are trademarks; Bentley SELECT is a
service mark of Bentley Systems, Incorporated or Bentley Software, Inc.
AutoCAD is a registered trademark of Autodesk, Inc.
All ther brands and product names are the trademarks of their respective owners.

Patents
United States Patent Nos. 5,8.15,415 and 5,784,068 and 6,199,125.

Copyrights
2000-2010 Bentley Systems, Incorporated.
MicroStation 1998 Bentley Systems, Incorporated.
All rights reserved.

GenerativeComponents V8i Essentials

ii

Copyright 2009 Bentley Systems, Incorporated

Jan-10

Table of Contents
Course Overview ____________________________________ 1
Course Description ____________________________________1
Target Audience_______________________________________1
Prerequisites _________________________________________2
Course Objectives _____________________________________2
Design Intent _________________________________________2
Modules Included _____________________________________3

Introduction to GenerativeComponents _________________ 5


Module Overview _____________________________________5
Module Prerequisites __________________________________5
Module Objectives_____________________________________5
What is GenerativeComponents? _________________________5
The General Concept _______________________________6
The Bentley Concept ________________________________7
Historical Background of Parametric Design_________________9
GenerativeComponents Generic Workflow _________________11
GenerativeComponents and Workspaces _______________12
Frequently Asked Questions _____________________________13
References ___________________________________________15
Module Review _______________________________________15
Questions ________________________________________15
Answers __________________________________________15

The Basics of GenerativeComponents ___________________ 17


Module Overview _____________________________________17
Module Prerequisites __________________________________17
Module Objectives_____________________________________17
Module Glossary ______________________________________18
File Formats __________________________________________19
The Design Based Approach _____________________________20
Objects and types _____________________________________20
Basic Types___________________________________________21
The GenerativeComponents Interface _____________________24
The GenerativeComponents Task______________________24
Transaction File player ______________________________25

Jan-10

iii

Copyright 2009 Bentley Systems, Incorporated

Table of Contents

Table of Contents

Additional tasks and tabs ____________________________26


Getting help __________________________________________26
Example Help______________________________________27
Additional Help Examples and IMPORTANT NOTE _________28
Getting Started________________________________________29
Create a transaction file _____________________________29
View Control__________________________________________31
Rotating a view using the mouse ______________________32
Clip Volume and Clip Mask ___________________________33
Creating Features______________________________________33
Points ____________________________________________34
Using the Expression Field____________________________39
Defining a transaction _______________________________40
Symbolic Diagram _____________________________________41
State ________________________________________________43
Parameter Spaces _____________________________________44
T Value point ______________________________________44
Editing Features____________________________________46
Move Feature tool__________________________________46
Free and locked parameters __________________________48
Feature association _________________________________49
Edit Feature tool ___________________________________49
Working with Transactions ___________________________50
Parametric and Associative ______________________________52
Module Review _______________________________________55
Questions_________________________________________55
Answers __________________________________________55
Tips from this module __________________________________56

Variables and Sets ___________________________________ 57


Module Overview______________________________________57
Module Prerequisites___________________________________57
Module Objectives _____________________________________57
Introductory Knowledge ________________________________57
Questions_________________________________________58
Answers __________________________________________58
Module Glossary ______________________________________58
Syntax_______________________________________________58
Sets _____________________________________________58
Index ____________________________________________60
Functions _________________________________________61
Graph Variables _______________________________________62
Creating a graph variable ____________________________62
Creating Variables on-the-fly _________________________65
Sets or Collections __________________________________66
Feature Properties and the dot operator ________________67

Table of Contents

iv

Copyright 2009 Bentley Systems, Incorporated

Jan-10

Defining a new coordinate system _____________________68


Drawing Economy __________________________________72
Editing a Transaction File ________________________________75
Selecting Alternative Update Methods _____________________77
Objects and types______________________________________77
Module Review _______________________________________78
Questions_________________________________________78
Answers __________________________________________79
Tips from this module __________________________________79

Using the Series Function _____________________________ 81


Module Overview______________________________________81
Module Prerequisites___________________________________81
Module Objectives _____________________________________81
Module Glossary ______________________________________81
Creating a Series ______________________________________83
Editing a Series ____________________________________87
Replication ___________________________________________88
Other Functions Related to Series _________________________91
Flatten ___________________________________________91
Sort _____________________________________________91
Sublist ___________________________________________92
Add______________________________________________92
Module Review _______________________________________95
Questions_________________________________________95
Answers __________________________________________95
Tips from this module __________________________________95

Reactors and Object Operators ________________________ 97


Module Overview______________________________________97
Module Prerequisites___________________________________97
Module Objectives _____________________________________97
Reactor for Vertically Dependent Line _____________________98
Object Operators ______________________________________100
Extra Exercises _____________________________________111
Module Review _______________________________________111
Questions_________________________________________111
Answers __________________________________________111
Tips from this module __________________________________112

Simple Reactor and Fabrication ________________________ 113


Module Overview______________________________________113
Module Prerequisites___________________________________113
Module Objectives _____________________________________113
Module Glossary ______________________________________113

Jan-10

GenerativeComponents V8i Essentials


Copyright 2009 Bentley Systems, Incorporated

Table of Contents

Working Prototype _________________________________113


B-Spline Curve or Surface ____________________________114
Your GC Workflow _____________________________________114
Creating a Responsive Surface____________________________115
Fabrication ___________________________________________117
Module Review _______________________________________121
Questions_________________________________________121
Answers __________________________________________121
Tips from this module __________________________________122

Creating a Generated Feature Type _____________________ 123


Module Overview______________________________________123
Module Prerequisites___________________________________123
Module Objectives _____________________________________123
Module Glossary ______________________________________124
Generated feature type______________________________124
Input ____________________________________________124
Replication and Generated Feature Types _______________124
Defining a Generated Feature Type________________________124
Creating a Generated Feature Type _______________________125
Inputs and Outputs _________________________________125
Nested Features ___________________________________126
Other Options _____________________________________127
Alternate Method for Creating Graph Variables ______________132
Module Review _______________________________________133
Questions_________________________________________133
Answers __________________________________________133
Tips from this module __________________________________133

Law Curves _________________________________________ 135


Module Overview______________________________________135
Module Prerequisites___________________________________135
Module Objectives _____________________________________135
Module Glossary ______________________________________136
Law Curve ________________________________________136
String ____________________________________________136
Plane ____________________________________________136
Order ____________________________________________136
Dependent Variable ________________________________137
Law Curves and Relationships ____________________________137
Steps to Create a Law Curve _____________________________137
Create the Law Curve frame __________________________139
Establish the Law Curve _________________________________142
Graph Variables and Law Curves __________________________146
Module Review _______________________________________147
Questions_________________________________________147

Table of Contents

vi

Copyright 2009 Bentley Systems, Incorporated

Jan-10

Answers __________________________________________148
Tips from this module __________________________________148

GenerativeComponents Import and Export ______________ 149


Module Overview______________________________________149
Module Prerequisites___________________________________149
Module Objectives _____________________________________149
Module Glossary ______________________________________150
Pre-compiled Assembly File (*.dll) _____________________150
Microsoft Excel ____________________________________150
Spreadsheet_______________________________________150
Database _________________________________________150
Excel Import/Export ____________________________________151
Loading the Libraries for Excel ________________________151
Import from Excel __________________________________152
Syntax ___________________________________________152
Export to Excel_____________________________________154
Database Import/Export ________________________________155
Image Capture ________________________________________156
Inputs____________________________________________156
Module Review _______________________________________157
Questions_________________________________________157
Answers __________________________________________157
Tips from this module __________________________________157

Designing a Simple Tower _____________________________ 159


Module Overview______________________________________159
Module Prerequisites___________________________________159
Module Objectives _____________________________________159
Module Glossary ______________________________________159
Building Envelope __________________________________159
Array ____________________________________________160
Transpose ________________________________________160
Flexible Building Floor Plates _____________________________160
Tips from this module __________________________________170

GenerativeComponents and Other Formats ______________ 171


Module Overview______________________________________171
Module Prerequisites___________________________________171
Module Objectives _____________________________________171
Models ______________________________________________171
References ___________________________________________172
MicroStation Reference Attachment settings ____________173
Referencing as a Feature type_________________________174
Using Range _______________________________________176

Jan-10

vii

GenerativeComponents V8i Essentials


Copyright 2009 Bentley Systems, Incorporated

Table of Contents

Promoting Elements to Features __________________________176


Using MicroStations Import/Export Functionality ____________177
Import IGES _______________________________________178
Exporting to DGN, DXF or DWG _______________________178
Save As V8 Options _________________________________178
Save As DWG/DXF Options ___________________________180
Exporting to IGES___________________________________181
Exporting to STL and 3D Printing __________________________181
Export Feature Type____________________________________182
Module Review _______________________________________183
Questions_________________________________________183
Answers __________________________________________183
Tips from this module __________________________________183

Using Patterns ______________________________________ 185


Module Overview______________________________________185
Module Prerequisites___________________________________185
Module Objectives _____________________________________185
Design Patterns _______________________________________185
The Controller Pattern __________________________________186
References ___________________________________________191
Tips from this module __________________________________192

Advanced Topics ____________________________________ 193


Module Overview______________________________________193
Module Prerequisites___________________________________193
Module Objectives _____________________________________193
BIM Objects __________________________________________193
Overview _________________________________________194
Installation and Setup _______________________________196
BIM Feature Type______________________________________196
Drawing Extraction _________________________________196
Example GCT file using BIM Elements___________________197
Working with Solids ____________________________________197

Scripting Basics _____________________________________ 199


Module Overview______________________________________199
Module Prerequisites___________________________________199
Module Objectives _____________________________________199
Module Glossary ______________________________________200
C# (sharp) ________________________________________200
Top level Feature___________________________________200
Temporary Feature _________________________________200
Child Feature ______________________________________200
Reflection_________________________________________200

Table of Contents

viii

Copyright 2009 Bentley Systems, Incorporated

Jan-10

Objects___________________________________________201
Function__________________________________________201
Class _____________________________________________202
Enum ____________________________________________202
Namespace _______________________________________202
GCScript Basic Components______________________________203
Feature Properties__________________________________203
How to Operate the Script Console ____________________205
How to write and use GCScript functions ___________________208
Calling functions ___________________________________209
Creating your own Functions _________________________210
Local Functions ____________________________________210
Return Value ______________________________________211
Optional values ____________________________________215
Writing your own global functions _____________________216
Anonymous Functions_______________________________216
Script Transactions _________________________________217
Script Files ________________________________________218
GCScript Basic Components______________________________218
Basic GCScript Syntax _______________________________218
Keywords _________________________________________220
Fundamental Types _________________________________220
Variables _________________________________________223
Some additional thoughts _______________________________226
Point ByFunction Script _________________________________228
List Points with a Loop script _____________________________233
The For loop statement______________________________235
Using simple equations to describe forms _______________238
Generating Polygons ___________________________________250
Polygon grid (alternative) ____________________________252
More Scripting Examples ________________________________256
B-Spline Curve _____________________________________256
B-Spline curve using child Feature points ________________257
B-Spline curve defined by internal function ______________259
Fourth B-Spline curve only as point ____________________261
Creating a user defined function_______________________262
References ___________________________________________265

Design Problems ____________________________________ 267


Module Overview______________________________________267
Module Prerequisites___________________________________267
Module Objectives _____________________________________267
Module Glossary ______________________________________267
Hierarchical Control_________________________________267
Free Form Surfaces _________________________________268
Tunnel with a Crossbar Roof _____________________________268

Jan-10

ix

GenerativeComponents V8i Essentials


Copyright 2009 Bentley Systems, Incorporated

Table of Contents

Conveyor Belt Design___________________________________284

Appendix A: Visualization with Luxology _________________ 303


Module Overview______________________________________303
Module Prerequisites___________________________________303
Module Objectives _____________________________________303
Display Styles _________________________________________303
Camera Setup and Navigation ____________________________304
Setup Camera _____________________________________304
Scripting the Camera for Animation _______________________308
Animating Graph Variables ___________________________308
Animating a Camera ________________________________309
Exporting Frames___________________________________311
Luxology Manager _____________________________________312
Materials ____________________________________________313
Pattern maps ______________________________________313
Bump maps _______________________________________313
Working with Materials______________________________314
Lighting______________________________________________315
Global Lighting_____________________________________316
Source Lighting________________________________________317
Shadow generation from source lighting ________________318
Place Light tool ____________________________________318
Output of Imagery _____________________________________319
Save Image________________________________________321

GenerativeComponents Quick Reference ________________ 323


Tools ________________________________________________323
Symbolic Diagram _____________________________________326
Feature Input Parameters Color Codes _____________________327
General Tips and Hints__________________________________327

Table of Contents

Copyright 2009 Bentley Systems, Incorporated

Jan-10

Course Overview
Course Description
GenerativeComponents, also referred to as GC, is a parametric and associative
design system that gives you new ways to explore alternative design scenarios.
GenerativeComponents captures design intent by graphically representing both
the elements and the relationships between them, enabling efficient design
exploration and reuse without manually rebuilding a model for each scenario.
GenerativeComponents lets designers work completely graphically, or combine
graphics with scripting and programming where appropriate.
This course is an introduction to GenerativeComponents and an opportunity to
explore new options for design. You will see how a complex design can be created
from multiple instances of a feature and how the feature adapts itself to the local
placement conditions. You will see how GenerativeComponents can
automatically reconfigure each individual floor plate after changing the height
and shape of a building, or after modifying its footprint.

Target Audience
This course is recommended for the following audience(s):

Jan-10

Designers

Engineers

Architects

Fabricators

Researchers

1
Copyright 2009 Bentley Systems, Incorporated

Course Overview

Prerequisites

Prerequisites

Expert MicroStation 3D, Rendering and Animation user

Expert users of B-spline curves and surfaces

Expertise with advanced Modeling or Animation software

Expert Microsoft Excel user or familiar with developing application logic

Course Objectives
After completing this course, you will be able to:

Use the GC Interface

Use GC tools to create geometry

Apply principles of transactional and programmatic design

Import and export with Excel and databases

Use principles of scripting to design

Integrate GC design with their CAD workflow

Install and set up GC

Design Intent
Design intent includes the location of geometric primitives, the relationships
between multiple geometric primitives, the composition of primitives into
assemblies, and the relationships between multiple assemblies. Above all, intent
implies a certain conceptual compression, whereas a few bits of information are
required, along with a formula of an intention, to elaborate a complete design
response.
If you change those bits of information, the formula is intact and so the new
complete design response still reflects the intent. A change in intentions means
literally to rewrite the formula. The way to measure whether or not the intention
has been captured is if the model behaves in the desired way when either the
formula or the information is altered. Capturing design intent, then, is to capture
the bits of information, the formula, and ultimately generating the complete
response. One does not just record it, but as one records their actions, they also

Course Overview

Copyright 2009 Bentley Systems, Incorporated

Jan-10

Modules Included

have to organize them into the appropriate hierarchy and order, or, design the
graph.

Results from the SmartGeometry workshop


illustrating the diversity of architectural geometry created with GenerativeComponents

Modules Included
The following modules are included in this course:

Jan-10

Introduction to

Basics of GenerativeComponents

Graph Variables, Sets and Coordinate Systems

Using the Series Function

Digital Feedback and Object Operators

Responsive Roof Problem

Creating a Generated Feature Type

Law Curves

Copyright 2009 Bentley Systems, Incorporated

Course Overview

Modules Included

GenerativeComponents Import and Export

Design of a Simple Tower

GenerativeComponents and MicroStation

Design Problems with Patterns

Advanced Topics

Basics of Scripting

Design Problems

Appendix A: Visualizing a 3D Design

Appendix B: Installation and Setup

GenerativeComponents Quick Reference

Course Overview

Copyright 2009 Bentley Systems, Incorporated

Jan-10

Introduction to
GenerativeComponents
Module Overview
This module presents basic GenerativeComponents concepts. These include
aspects of the interface, and terms that relate to the process.

Module Prerequisites

Understanding of 3D computer applications

Module Objectives
After completing this module, you will be able to:

Determine where GenerativeComponents fits into your workflows

Recognize and define basic terms and interface items

Recognize items in the GenerativeComponents dialog

What is GenerativeComponents?
GenerativeComponents is a parametric and associative design system which gives
users new ways to efficiently explore alternative designs.
GenerativeComponents captures design intent by graphically representing both
design components and the relationships between them.
GenerativeComponents enables efficient design exploration and reuse without
manually rebuilding the model for each scenario.

Jan-10

Introduction to GenerativeComponents

Copyright 2009 Bentley Systems, Incorporated

What is GenerativeComponents?

GenerativeComponents allows designers to work completely graphically, or to


combine this with scripting and programming where appropriate.
GenerativeComponents is the tool of choice for those who appreciate that design
is best when it emerges from a combination of intuition and logic.
GenerativeComponents is a system with a set of primitives, or features. Features
can be geometry, such as a line or a point. A feature can also be numeric data,
such a number specifying length or specifying how many elements exist in a
design. Users can define their own design elements and the underlying
associative architecture allows for the interoperability of all features.
GenerativeComponents is a flexible design environment that is designed to be
used both as a digital exploration/sketching tool for design development and as a
production tool.
A key concept of GenerativeComponents is the ability to define geometry in
different ways. One approach is based on traditional CAD modeling, but it is
expanded by parametric and associative aspects. It creates a collection of
graphics with intelligence. You create your own components from them.

The General Concept


Design must have a combination of novel aspects and efficient aspects. Both
novelty and efficiency depend on the exploration of possible solutions. Such
solutions have to be generated. Either many solutions must be created and then
filtered for desirable traits, or the creation process itself must encourage
exploration in which a viable solution can be arrived at with the minimum of
intermediaries.
It is unlikely that such solutions can be efficiently created, even with conventional
CAD systems, if each idea has to be hand-built using conventional command

Introduction to GenerativeComponents

Copyright 2009 Bentley Systems, Incorporated

Jan-10

What is GenerativeComponents?

based applications. Such applications may be sufficient for the documentation of


a pre-defined design, but not for exploration.

Exploration is open-ended. You cannot predict what will be arrived at or what


pre-cursors will be required to enable us to arrive at a viable solution. It is not
appropriate to develop an application intended for exploratory design around a
fixed (or pre-defined) system of components or relationships, a fixed schema.
The fixed schema approach to application development may work well in
established design methodologies, in highway design, and in some forms of
regular architecture. Designers who use these conventional systems come to
expect that standard items such as walls, windows, and doors are directly
available in CAD applications. Architecture has the interesting dynamic of
spanning from the regular to the experimental. As you progress along this path, it
becomes increasing inefficient to directly support the special requirements of the
more adventurous designers, particularly in the domain of free form architecture.
If there is a button on the menu to create an egg shaped high rise office tower, or
a distorted toroidal shaped sports stadium, then everyone is going to use it. The
button on the menu is not the basis for originality.

The Bentley Concept


A more appropriate strategy, and one adopted by Bentley with
GenerativeComponents, is to give users the ability to create their own application
schema, by allowing them to create their own components and inter-component
relationships. GC is a good tool-making device. But this raises some interesting
issues. First, the underlying tools must be general yet comprehensive. The tools
must allow for a myriad of geometric and logical possibilities.

Jan-10

Introduction to GenerativeComponents
Copyright 2009 Bentley Systems, Incorporated

What is GenerativeComponents?

The second issue is one of education. Even if a very powerful and general tool set
is provided, there is the important task of educating designers. You need to
appreciate that, to arrive at a novel or efficient solution, you cannot use preconfigured, fixed schema applications. In order to design, you must first build
your design tools. You must accept that you are completely responsible for
creating the sequence of constructive steps that result in the appropriate design
geometry. Because the rationale is that design is improved by exploration, the
resulting geometric model must be robust enough and efficient enough to
support geometric variation, which is essential to the explorative process.
In this sense GenerativeComponents represent and supports the convergence of:

Conventional geometric or feature based modeling

Parametric and associative control systems

Extensibility of new feature types without end user programming using


reflection and code generation -- making your own tools

Scripting and programming, based on the conventions of object-oriented


software design

And perhaps most important: Self-Documenting software

The objective is to harness a range of design skills, which may vary in emphasis,
requiring geometric, spatial, compositional fluency, and those based on
computing concepts of algorithm, type hierarchy, continuous and discrete
change.
The literal implementation of the object-oriented concepts, as supported in
currently available computer languages, does not result in a system which
supports artifact creation. One of the interesting challenges in the development
of GenerativeComponents has been the development of computing conventions
that go beyond the limitations of current Object-Oriented languages, in order to
create a system that can respond to the sense of intuition and exploration which
is essential in design.
Parametric design builds complex logical relationships between objects or
elements in a design, so to harness these possibilities requires precision in the
notation used to define these relationships.
If GenerativeComponents was conceived within the restrictive limitation of
conventional design, then it might have been valid to construct some simplified
notation with which to define these logical relationships. The problem with this
approach, might occur after a user had acquired a working knowledge of the
simplified notation and then if they progressed to a more programmatic

Introduction to GenerativeComponents

Copyright 2009 Bentley Systems, Incorporated

Jan-10

Historical Background of Parametric Design

approach. At that moment of transition, there would inevitably be some clash of


notation between the simplified design only notation and the full rigor of a
conventional high level object oriented programming language. The potential
clash and the possible need to replace or unlearn the simplified notation, would
result in a major disruption and discontinuity to their progression at a most
vulnerable moment.
To avoid this discontinuity, GenerativeComponents uses a formal system of
notation. Although this may present a slightly more complex initial learning task,
once this notation is mastered, you are set for further progression into the world
of application computing without further disruption.
An analogy is to musical notation which requires a certain formalism to
unambiguously define musical expression. How can you simplify this notation for
beginners? There really is no way, except to teach the new music student the
basics of the formal notation and work towards more complex usages of that
notation.
The imagined trajectory of learning and use of GenerativeComponents would be
as follows:
1

First, to design through geometric production using the interactive


graphical user interface.

Second, to proceed to one line scripts through the formula bar and GC
Script.

Third, to the production of complex programs to process large numbers of


calculations, highly complex geometries or simply to extend the
functionality of the program through the C# (sharp) programming
language.

Historical Background of Parametric Design


Many CAD applications are parametric. Typically these applications use discrete
elements or components that represent some application domain. For example,
in an architectural domain, these elements or components might be walls or floor
slabs. Each type of elements might have a series of defining properties, for
example, thickness or height. You give a numeric value to define these properties.
Subsequently, these values for the properties of one element can be changed,
and that element updates in isolation, but there are no logical connections
between the components and no algebraic connections, or expressions, linking
the value of one elements property to another elements properties.

Jan-10

Introduction to GenerativeComponents
Copyright 2009 Bentley Systems, Incorporated

Historical Background of Parametric Design

A change to one element via a change to one of that element's properties is not
propagated to other elements. Some people erroneously claim this to be
parametric CAD.
At the next level of sophistication you find solid modeling applications such as
Solid Edge, Solid Works, and Inventor. These applications can correctly claim to
be parametric. In these packages, complicated feature trees can be built using
geometric primitives, or features, such as rectangular slabs, cones, spheres, etc.
and boolean operations such as union, intersection and difference. These
applications also implement domain specific features for mechanical engineering
such nuts and bolts, countersunk holes, and other typical machining operations.
These domain specific features are themselves constructed out of geometric
primitives and boolean operations, with the top-level dimensional controls
exposed to you within domain specific dialog boxes. These applications are
referred to as feature tree based, because a tree-like data structure is created
and used to control the propagation of change to other down stream features.
Each object has only one set of parents, and you cannot make a connection
between two disparate elements on different levels of the hierarchy.
Basic Parametric:
No associations or expressions.
Parameters such as wall thickness
drive geometry.

Simple Parametric:
Uses Feature Tree driven modeling,
where Parent-Child/Inheritance
relationships determine geometric
properties.
Full Associative and Parametric:
Based on change propagation and
transactions. Acyclic graph allows for
more complex relationships.
GenerativeComponents is more generalized. You can draw relationships that are
complete graphs. In most cases in GenerativeComponents as elsewhere you
cannot have feedback up the tree however without the use of an outside
controller. In other words, a leaf node cannot affect a node further up the tree/
graph. In most cases you are building a propagation network that represents your

Introduction to GenerativeComponents

10

Copyright 2009 Bentley Systems, Incorporated

Jan-10

GenerativeComponents Generic Workflow

design. You are deferring the final decisions on size shape and design until later
on, allowing instantly changes later on. The dependency graph used in
GenerativeComponents is a generalization of the tree structure. Any tree
structure can be represented as a dependency graph. The
GenerativeComponents graph is directed, because all the relationships are from
the upstream or independent components to the downstream or dependent
components. Many components in the middle of the graph have both inputs from
other upstream component and, in turn, influence other downstream
components. A component with no inputs is referred to as a root component. A
component with no dependents is referred to as a leaf component.
In strict graph terminology, the components are nodes of the graph and the
relationships between the components are the arcs of the graph. The relationship
between two components is established by one of the input properties of the
downstream components referring to an upstream component or to a property
of an upstream component.
The key to understanding is to realize that you can feedback the property of a
graphical component. For example, you could use the length of a line to control
the radius of a circle or adjust the angle of a plane if it is greater than 15 degrees
out-of-plane.
Once you allow bi-directional relationships between components, the cognitive
complexity explodes. Even with a reasonably-complex directed graph model, you
are challenging the cognitive limits.
There are, however, important aspects of design where design intent cannot be
modeled as simple dependency relations. Therefore, bi-directionality is an
important requirement that needs to be addressed.

GenerativeComponents Generic Workflow


So effort versus rewards is as follows. In normal CAD it is easy to begin with, gets
more complicated every time you want to change the design and you have to
rebuild the whole model and adjust all the constituent parts.
With GenerativeComponents you invest much more heavily at the setup stages of
the model, but later on, changes can be made easily.
A generic workflow may look like:

Jan-10

11

Introduction to GenerativeComponents
Copyright 2009 Bentley Systems, Incorporated

GenerativeComponents Generic Workflow

Take some points,

Use them to control a curve,

Use the curve to control a surface,

Use the surface to control a solid.

or
Perform some boolean operations on a solid,
1

Use to extract a surface,

Use to control a line,

Use to find a point.

Perhaps one of the most interesting things about GenerativeComponents is that


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. Hence, GCT files are very SMALL in size. It is computationally
efficient.

GenerativeComponents and Workspaces


Generated feature types are stored within the active project, so changing
projects will change the set of generated feature types which
GenerativeComponents loads at startup. GenerativeComponents uses the
Workspace path as defined by the installation.
These are installed in WIndows XP by default to:
C:\Documents and Settings\All Users\Application
Data\Bentley\GenerativeComponents\WorkSpace\
On Windows Vista and Windows 7, the workspace files are installed by default to:
C:\ProgramData\Bentley\GenerativeComponents\
The GenerativeComponents Configuration Manager allows you to set the default
WorkSpace settings for User, Project, and GenerativeComponents seed file. This
lets you launch GenerativeComponents in the desired workspace when you
double click on a GCT file, without using the File Open dialog.

Introduction to GenerativeComponents

12

Copyright 2009 Bentley Systems, Incorporated

Jan-10

Frequently Asked Questions

Frequently Asked Questions


What is a Feature?
Features can be geometry, such as a line, curve or a point. A feature can also be
numeric data, such a number specifying length or a process such as referencing a
DGN file or exporting data to Excel.
What is a Transaction file?
It contains the instructions that will generate geometry. When you open one in
GenerativeComponents, you see the working environment. It is comprised of the
GenerativeComponents dialog, the Symbolic Diagram and a Geometric view.
What is the View?
View 1-8 are the views in which geometric construction is represented. You can
open any views to let you visualize the current geometric state of the model by
displaying all geometric features in 3 dimensions.
What is the Symbolic Diagram?
The Symbolic Diagram is a view of the geometric and non-geometric features you
are placing, in graph form. The features are capsules with the feature type noted
underneath the feature name. For example, a coordinate system feature with its
name, baseCS, below it.

The lines connecting the features show any dependencies between features. The
arrows show the direction of the dependency.

The Symbolic Diagram visually expresses dependencies that may not be as


apparent in the Geometric view, but which influence other dependent features
and so the behaviors of the whole model.

Jan-10

13

Introduction to GenerativeComponents
Copyright 2009 Bentley Systems, Incorporated

Frequently Asked Questions

For reference, please review the term Directed Acyclic Graphs.

Simple Directed Acyclic Graph

What is the Coordinate System, or baseCS?


The coordinate system controls the direction of the x, y and z coordinates. When
you open a transaction file there is a coordinate system called baseCS. You can
see it in the View and the Symbolic Diagram.

Top view of the baseCS

Isometric view of the baseCS

What is a Transaction?
Each change you make is recorded as a step or transactions. Use transactions to
group multiple steps into a single, logical entity. Think of this as recording the
building of a portion of the final geometric construction. When you play the
transactions, the geometric construction is built in the Geometric view.
Transactions only record the changes or deltas. The granularity of transactions is
user defined.

Introduction to GenerativeComponents

14

Copyright 2009 Bentley Systems, Incorporated

Jan-10

References

References
Herbert Simon - Science of the Artificial.

Module Review
Now that you have completed this module, lets measure what you have learned.

Questions
1

What is your definition of Design Intent?

GenerativeComponents is an parametric and ______ design system.

What is a transaction file?

What is the Symbolic Diagram?

What is a transaction?

What is the coordinate system, or baseCS?

Answers

Jan-10

Design intent includes the location of geometric primitives, the


relationships between multiple geometric primitives, the composition of
primitives into assemblies, and the relationships between multiple
assemblies.

Associative.

It contains the instructions that will generate geometry. When you open
one in GenerativeComponents, you see the working environment. It is
comprised of the GenerativeComponents dialog, the Symbolic Diagram
and a Geometric view.

View 1 is a view of the geometric and non geometric features you are
placing, in graph form. The features are circles with the feature type
noted underneath the feature name.

15

Introduction to GenerativeComponents
Copyright 2009 Bentley Systems, Incorporated

Module Review

Transactions group multiple design steps into a single, logical entity. Think
of this as recording the building of a portion of the final geometric
construction. When you play the transactions, the geometric construction
is built in the Geometric view.

The coordinate system controls the direction of the x, y and z coordinates.


When you open a transaction file there is a coordinate system called
baseCS. You can see it in the Geometric view and the Symbolic Diagram.

Introduction to GenerativeComponents

16

Copyright 2009 Bentley Systems, Incorporated

Jan-10

The Basics of
GenerativeComponents
Module Overview
This module describes how to create a file, place point and line features, and edit
those features. It also discusses feature association and the Symbolic Diagram,
and information about working with transactions.

Module Prerequisites

Basic understanding of 3D modeling

Module Objectives
After completing this module, you will be able to:

Jan-10

Create a file

Use the View Control tools

Create features

Define a transaction

Define a T Value point

Edit features

Work with Transactions

17

The Basics of GenerativeComponents

Copyright 2009 Bentley Systems, Incorporated

Module Glossary

Module Glossary
Transaction
A transaction file is typical of programming tools. A transaction file is executed
one time and populates a model with elements or components. To change the
result, or create a new file, all the generated elements or components must be
deleted and the transaction file is re-run with different input parameters.

Coordinate System
The coordinate system controls the direction of the X, Y and Z coordinates. When
you create a new transaction file you are automatically assigned a coordinate
system called baseCS and it is located AtModelOrigin.
Rotate the Geometric view, View 2, to Right Isometric and you will see it more
clearly. The red line is X, the green Y and the cyan is Z. The active plane is defined
by the yellow square. When you begin it is on the XY plane. You can change the
plane to the YZ plane or XZ plane using the option list in the
GenerativeComponents dialog.

Dashed line, drawn here, indicates the active plane, which is yellow in the Geometric view

The Basics of GenerativeComponents

18

Copyright 2009 Bentley Systems, Incorporated

Jan-10

File Formats

Feature
A feature is the name used to describe different geometric constructions. These
can be general such as lines, arc, curves or surfaces and solids or they can be an
action such as Export. In turn, what you build can form the basis of new features
or generative components such as a box, a wall, or a column. The generative
components that you create will be loaded every time you launch the
GenerativeComponents application.

T Value point
A T Value point denotes a relative position that is controlled by the parameter
value T, in the range of 0.0 to 1.0, along a line or curve.

Double
A double is another name for a Real number; any number with a decimal value
(1.0, 0.5, 0.03 101.9).

Integer
An Integer, or int, is any whole number (1, 2, 101).

File Formats
GC works with the MicroStation DGN file and the DGN file can be used as the
container for GC work.
There is a separate GCT file format that can be created from Save As ...
The DGN is an auto-save format, so long as you save your transactions you will
not need to save the DGN explicitly. In addition, the DGN format uses Models.
When working with GC the term Models refers to a container for graphics and
information. For example, in Microsoft Excel you have different worksheets. Each
worksheet is separate from the others and unless you link them they are
independent numerical spaces. In GC, the Models are like worksheets. They are
independent graphical spaces. They are almost like separate files in one big
container.

Jan-10

19

The Basics of GenerativeComponents


Copyright 2009 Bentley Systems, Incorporated

The Design Based Approach

The GenerativeComponents GCT file does not save geometry, but the instructions
to generate geometry, so the GCT file cannot be opened in base MicroStation or
other CAD programs directly.

The Design Based Approach


Modeling in a CAD environment is centered on geometric tools. In a parametric,
associative environment such as GenerativeComponents, the approach is similar,
but offers the additional benefit of storing relations between elements in an usercustomized way. These associations require you to define the creation methods
(called Update Methods) explicitly. The inputs are created by referencing existing
features by referring to their unique name in the system. Each new feature
receives a unique name.
The main tools are the shortcuts to create points, planes and coordinate systems,
and there is a complete list of features available. First you choose the Feature
Type you would like to create. Second you identify the update method most
appropriate for the way in which you want to create, and later vary, the feature.
Once a feature is created there are multiple ways to edit it or interact with it.
Feature assemblies can be turned into new features and made available for
future designs. This is a function that otherwise would only be possible through
programming. It allows you, when modeling designs, to harness some of the
power of programming without requiring you to have programming expertise.
One way to start to use GenerativeComponents is to model the design using the
interface. These first modules explore the model based approach, using basic
tools used to create and associate features.
On a general note, GC is case sensitive for text.

Objects and types


Almost everything you will work with are computing objects. Including the input
variables. For computers not all objects are equal. Objects have different types.

The Basics of GenerativeComponents

20

Copyright 2009 Bentley Systems, Incorporated

Jan-10

Basic Types

Basic Types
Built-in Types

Int: an integer, no decimal places

Double: a number with decimal places

Boolean: a true or false value

String: a string of characters or text - in double quotes

Microstation Types
These are the types that GC is built on. They exist, but you do not use them in GC.
It is only possible to use these in C# programming interface.

GenerativeComponents Types
IPOINT - parent class (zero dimension (0D) object)

Point (location only)

Plane (location and direction: infinite plane therefore divides the world into
two half spaces. Can also be thought of as a 2D cartesian space, with X and Y
coordinates

CoordinateSystem

IDIRECTION - parent class (one dimension (1D) object)

vector

line

ICURVE - parent class (1D object)

line

arc

circles

ellipses

b-spline curves

ISURFACE - parent class (2D or 3D object)

Jan-10

surface

21

The Basics of GenerativeComponents


Copyright 2009 Bentley Systems, Incorporated

Basic Types

ISOLID - parent class (3D object)

solid
IPOINT

IDIRECTION

ISURFACE

ICURVE

ISOLID

Line
Vector

Point

Arc

(location)

Circle
Line

Plane
(location and direction)

Ellipse
Solid

B-Spline Surface
Elliptical Arc
Plane
B-Spline

Coordinate System
(location+direction+translation,
rotation, scaling, shear)

Composite Curve

Define

IPOINT

Offset

Define

IDIRECTION

Intersect

ICURVE

ISURFACE

Extract/Intersect

ISOLID

Boolean Operation and Extract

Define

The Basics of GenerativeComponents

22

Copyright 2009 Bentley Systems, Incorporated

Jan-10

Basic Types

You can see these types in the interface.

User Created types


These are user generated features that can be created either in the GC GUI or for
the very advanced user, using C#. They are stored as a DLL (Dynamic Link Library).
They are normally called a Generated Feature Type (or Generative Component)
and you name them yourself, once created they appear under the Create Feature
tab.

Jan-10

23

The Basics of GenerativeComponents


Copyright 2009 Bentley Systems, Incorporated

The GenerativeComponents Interface

The GenerativeComponents Interface


The GC interface includes a GC dialog, up to eight views within which you can
draw graphics and a Symbolic Diagram showing transactions
GC Main Menu

View Controls

GC Task
Views to draw graphics
Tabs

Tool Settings

Symbolic Diagram and State docked

GC is case sensitive.

The GenerativeComponents Task

The GenerativeComponents task contains the basic tools needed to operate


GenerativeComponents can be found docked to the left edge of the screen.

The Basics of GenerativeComponents

24

Copyright 2009 Bentley Systems, Incorporated

Jan-10

The GenerativeComponents Interface

There are also menus that contain options not represented by the icons.

Transaction File player


The Transaction File tab is displayed by default. It lists existing transaction steps.
You manage transactions here. Use the player controls at the bottom to move
backward and forward through the transaction steps.

Let see how transactions work.

Jan-10

Exercise: Examine a GCT file


1

Launch GenerativeComponents V8i.

Open the folder WorkflowSamples.

Next, open the folder ellipse_by_focal_points.

25

The Basics of GenerativeComponents


Copyright 2009 Bentley Systems, Incorporated

Getting help

Open the ellipse_by_focal_points.gct file.


There are five transactions in this file.

Use the Play Transaction button to step through each transaction.

As you step through each transaction, observe the changes on the screen.

Additional tasks and tabs


As you perform other tasks, such as adding or editing features, other tabs are
added to the dialog. Common tabs are as follows.

Transaction

New Feature

Edit Feature

Variables

Console

Quick Help

Coordinates

These tabs only appear when you need them.

Getting help
Access the regular Help file by selecting Contents from the Help menu.

The Basics of GenerativeComponents

26

Copyright 2009 Bentley Systems, Incorporated

Jan-10

Getting help

Example Help
Help is available in the form of pre-built examples. Each Feature type has the
option to show an Example.

Exercise: Using Example Help


1

Create a new transaction file.

From the GenerativeComponents task select New Feature.

A New Feature tab opens.

Jan-10

On the New Feature tab of the GenerativeComponents dialog, expand the


node next to the Arc feature by clicking the +.

Under Update Method, expand the method


ByAngleCenterStartPlanePoint.

27

The Basics of GenerativeComponents


Copyright 2009 Bentley Systems, Incorporated

Getting help

Click inside the first Expression field, next to CenterPoint.


The Example button highlights.

Click the Example button.


View 2 opens. In addition an Example Symbolic Diagram opens and is for
the Example. Also, a new tab named Example appears in the GC dialog.

In the GC dialog, click Play All Remaining Transactions to see the geometry
that results from the example.

Spend a few minutes to try other Features and Update Methods and
explore their Examples.

Use the window control in the upper right to close the Examples tab.

This will also close the View and the Example Symbolic Diagram.

Additional Help Examples and IMPORTANT NOTE


IMPORTANT NOTE: One of GenerativeComponents most interesting advantages
is that it is self-documenting.

The Basics of GenerativeComponents

28

Copyright 2009 Bentley Systems, Incorporated

Jan-10

Getting Started

Therefore, most GC users learn by reviewing existing GCT files. By looking at an


existing GCT files you can see how someone created a specific piece of geometry.
To aid in this process GC ships with many Workflow Samples on various topics.
You can find these sample GCTs at:
C:\Documents and Settings\All Users\Application
Data\Bentley\GenerativeComponents\WorkSpace\Projects\Examples\GC_Defaul
t\gct\WorkflowSamples
In addition, there are hundreds of GCT files available on the Internet, from
Bentley and various other resources. A good place to start is:
http://communities.bentley.com
From here you can join Forums, read and post to Wikis and find communities of
other users.
Also, go to:
http://www.smartgeometry.org

Getting Started
Create a transaction file
GenerativeComponents has a GCT file format. It is a simple ASCII text file that can
be opened with a text editor. If you double click on a GCT in Windows Explorer
you launch GenerativeComponents and open that file.
By default, GenerativeComponents uses seedGC.dgn to create the design file in
which you will create geometric components. This file is like a scratch file. The
directions needed to create the geometry are stored in the DGN file. The DGN file
is used to assemble and display the model that you will build and can be Saved As
a GCT file.
CAD managers should use their own default seed files as a basis for creating their
own seedGC.dgn. The delivered file is an example only, and will not contain
project specific working units, levels or any other settings.

Jan-10

29

The Basics of GenerativeComponents


Copyright 2009 Bentley Systems, Incorporated

Getting Started

When you launch the GenerativeComponents application, the


GenerativeComponents dialog appears and 2 view windows are open on the
screen.
The basic layout in the Geometric view is based on a global coordinate system, or
baseCS, which has a Z-Axis pointing upward and X and Y axis oriented in the
plane. Geometric elements are seen as what they are, such as line elements, or as
cell icons depicting abstract elements such as planes or directions, which
otherwise could not be effectively shown in a view like this.
Hint: To easily locate direction on the baseCS, open View 8, rotate it to Right

Isometric and then fit it, using the view controls. Click the right mouse button
to reset after using a view control to return focus to the
GenerativeComponents dialog. Minimize View 8 and use it when you need to
identify direction.

Exercise: Create a New file for GC

The Basics of GenerativeComponents

30

Copyright 2009 Bentley Systems, Incorporated

Jan-10

View Control

In the GenerativeComponents main menu select File > New File.


In the GenerativeComponents dialog, you see the New Feature tab which
contains the library of available feature types. You select feature types
and define their parameters on this tab.

The Transaction File tab is does not list anything because nothing has
been recorded to the transaction file.

View Control
When you work in a 2D model, you can rotate the view. Visually, this is like
rotating the xy-plane about a perpendicular, or z-axis. When you are working in a
3D model, you can rotate the view about any axis (the x-, y-, or z-axis). Again, the

Jan-10

31

The Basics of GenerativeComponents


Copyright 2009 Bentley Systems, Incorporated

View Control

visual effect on screen is like rotating a cube. You can rotate any view to a
standard view or to any other arbitrary view orientation.
When you dynamically rotate a view, for example, you can use either of the
following methods:

Using the mouse

Shift key + middle mouse button to Rotate about Center

Pressing the left mouse button completes the rotation

Using a tool

View Rotation

Standard View Rotation

Rotating a view using the mouse


The mouse wheel/button can be used for several view control purposes.
The most common view controls are:

Double click the wheel to Fit View

Single click the wheel for a Dynamic Pan View

Roll the wheel for Zoom In/Out

Shift + click mouse wheel for View Rotation about center

Additional 3D mouse view controls are:

Shift + roll - Pan with Zoom

Ctrl + middle button click - Rotate about point

Ctrl + roll - Walk Forward/Backward

Alt + roll - Pan Left/Right

The Basics of GenerativeComponents

32

Copyright 2009 Bentley Systems, Incorporated

Jan-10

Creating Features

Clip Volume and Clip Mask


During a design session, you may want to work on a particular element and rotate
it to view from various angles. When you do this with clipping planes set,
however, parts may disappear or other elements appear in the display depth.
MicroStations Clip Volume and Mask tools let you select a discrete volume,
within the design cube, for display.

This tool is helpful in general as well as when you have elements on the same
level and some elements you want to see and others you do not.
You can use 2D or 3D elements to define the volume. When you use a 2D shape,
the clipping volume is created by sweeping the 2D shape through the entire
model. The sweep direction is perpendicular to the plane of the 2D element.
MicroStation creates a 2D clipping shape using active attributes. When a 3D
element is used, it defines the entire clip volume.
Operations, such as view rotation, fence processing, hidden line removal, and
rendering, honor the clip volumes. They ignore any elements that are not
displayed within the defined volume for the view.
Clipping elements may consist of any solid or closed extrusion, cylinders, or
closed planar elements (shapes, circles, ellipses, complex shapes, grouped holes).
Where a planar element is chosen, or you use the clipping elements by points
options, the clipping volume is generated by sweeping the planar element
through the entire model. Planar elements may be selected in any view, because
the sweep direction is orthogonal to the plane of the element. Similarly, clip
elements that you define by points may be drawn in any view. AccuDraw can be
used to set the correct orientation of the clip element.
ClipVolume is also the name of a feature type and can be used as any other
feature.

Creating Features
A feature is a graphical element or an operation on a graphical element or a
function to control graphical elements.

Jan-10

33

The Basics of GenerativeComponents


Copyright 2009 Bentley Systems, Incorporated

Creating Features

Geometric Features are based on MicroStation elements and have a name or


Feature Type and an Update Method. For example, the Line Feature Type has
about 22 Update Methods. Which is to say you can draw a Line up to 22 different
ways. Common Update Methods for a Line are:
Line ByPoints - Here you define the endpoints of a line to define it.
Line ByStartPointDirectionLength - Here you define a start point, the direction of
the line and the length of the line.
Most Update Methods have an Help Example so you can see how they work. So
when you define a Feature you must think of the Update Method you will use to
define it.

Points
It is all about Points. Almost every feature is dependent on Points.
Points are the basis of the geometry you will create. GenerativeComponents
stores the relationship between the points and associated geometry and
computes the associated geometry from the current value of the points.
Create Point tool and Line feature

Exercise: Use points to create a line


1

Continue in your new file.

In the GenerativeComponents dialog, click the Create Point tool.

This tool creates a point ByCartesianCoordinates. Properties of this type


of point identify the coordinate system to which it is related, the baseCS in
this case, and the X, Y and Z location of the point. When you select the
tool and enter a data point you are identifying these properties. You can
also specify these explicitly on the New Feature tab of the
GenerativeComponents dialog.
3

Enter a data point in the Geometric view to place one point, enter another
data point to place a second point, and then click the right mouse button
to end the command.

The Basics of GenerativeComponents

34

Copyright 2009 Bentley Systems, Incorporated

Jan-10

Creating Features

This is called a reset.

Two point symbols have also been added to the graph in the Symbolic
Diagram.

Note: GC automatically names new features with their type and then a serial

number starting with 01 and incrementing each new instance of that


type by 1.

Jan-10

35

The Basics of GenerativeComponents


Copyright 2009 Bentley Systems, Incorporated

Creating Features

Scroll to Line in the Feature Type list and click the + to expand the entry.

You see many update methods by which you can create lines. You will
create a line ByPoints.
5

Scroll to the ByPoints update method and expand it to see the properties
you must define.

Click in the field to the right of StartPoint.

Press and hold the Ctrl key on the keyboard, and then move the pointer
over the first point in the graphics view.

The Basics of GenerativeComponents

36

Copyright 2009 Bentley Systems, Incorporated

Jan-10

Creating Features

The point highlights and its name appears in a pop-up. You can select
features from either the graphic or Symbolic Diagram.
8

While still holding the Ctrl key, enter a data point (left mouse button), or
press Enter on the keyboard, to accept.

Point01 is entered and focus now moves to the EndPoint field.


9

Press and hold the Ctrl key on the keyboard, and then enter a data point
on the second point.
The fields are populated, but no line has appeared.

10 Click OK at the bottom of the GenerativeComponents dialog.

The line now appears.

11 Review the Symbolic Diagram.

GenerativeComponents named the feature line01. To give it the name of your


choice, either name before clicking OK (previous step 9) or click the Rename
button to change the name in the New Name field of the Rename dialog and then
click OK.

Jan-10

37

The Basics of GenerativeComponents


Copyright 2009 Bentley Systems, Incorporated

Creating Features

It is a good idea to give features, and transactions, meaningful names.

If you are drawing multiple lines by points, first place all the points, then click the
Create New button. This takes you back to the same location in the Feature Type
list so you can define the next lines parameters.

The Basics of GenerativeComponents

38

Copyright 2009 Bentley Systems, Incorporated

Jan-10

Creating Features

Using the Expression Field


The expression field where the values Point01 and Point02 were entered, can
also be used in other ways.

This field is similar to the expression field for Microsoft Excel.


Expression Field

Expression Field
If you feel comfortable with those expression fields then you will be fine with GC.

Jan-10

39

The Basics of GenerativeComponents


Copyright 2009 Bentley Systems, Incorporated

Creating Features

In the expression field you can enter data using Ctrl+mouse click or typing in
information.
Number
Expression
Function
For example, simple numbers, simple computations or scientific calculations. You
can even do complex expressions like:
(1/acos(0.9)+1)*5
These calculations follow the PODMAS rules:
P - Parentheses first
Orders - Powers and Roots
DM - Division, Multiplication
AS - Addition, Subtraction
Some useful notations are:
xy = Pow(x,y)
Square Root = Sqrt(x)
There is much more that can be done here, so it is important to understand these
basic functions before more complex uses of the Expression Field are used.

Defining a transaction
A transaction is a single event in a GC file. It might be placing a point, drawing a
line, moving a point, importing Excel data or many other things.

Exercise: Define the transaction

The Basics of GenerativeComponents

40

Copyright 2009 Bentley Systems, Incorporated

Jan-10

Symbolic Diagram

Continue in the same file.

Click the Transaction File tab in the GenerativeComponents dialog.

Click Record User Changes into the Transaction File.

A transaction bearing the name of the events as been added.


4

Replace the default name with a more meaningful name, if desired.

Click Save Transaction File, supply a name, and click Save.

Click the + (node) to expand the transaction.


The points and the line have been recorded. Note that
GenerativeComponents lists features alphabetically.

At the bottom of the tab, click Unplay the previous transaction.

The geometry disappears from view. It is not gone, though, because the
instructions about placing the points and the line remain in the file. You
play the transaction to reconstruct the geometry.
8

Click the Fit button, to the right of the transaction player controls.

Now all geometry will fit in the views. Enable this button any time you
want to fit everything into the views.
9

Click Play next transaction so the geometry reappears.

10 Expand point01.

You can see how it was constructed. The coordinate system on which it is
based is a property and also its X, Y, and Z coordinates. Handles are used
to edit features. Use the HandleVisible property to toggle their display.
11 Save the file as first_line.gct

Symbolic Diagram
The Symbolic Diagram shows the features created and their relationship. Almost
every symbolic diagram will have a Coordinate System, by default it is given a

Jan-10

41

The Basics of GenerativeComponents


Copyright 2009 Bentley Systems, Incorporated

Symbolic Diagram

name of baseCS. There are several tools to help with managing the symbolic
diagram.

The tools in the top of the window allow you to set the direction of the flow chart,
with options for Top, Bottom, Left and Right. There are Zoom In, Zoom Out, Fit
View, Actual Size and Refresh.
The Search button on the right allows you to find a specific string of text as a
name or content in the Symbolic Diagram.

The Basics of GenerativeComponents

42

Copyright 2009 Bentley Systems, Incorporated

Jan-10

State

There is also right-click functionality in the Symbolic Diagram. When you right
click on a feature in the Symbolic Diagram you see the following menu.

State
The State dialog is showing which plane you are on and allows you to change the
plane. You may dock it anywhere, for example on top the tool settings so it forms
a tab.

Jan-10

43

The Basics of GenerativeComponents


Copyright 2009 Bentley Systems, Incorporated

Parameter Spaces

Parameter Spaces
Parameter spaces allow you to describe a mathematical relationship between the
parameter space and the geometry.
UV Values
on Surface

UV Values in
Parameter Space
The figure shows a 2D representation of a 3D space to provide a method of action
of the surface.

T Value point
A T Value point denotes a relative position that is controlled by the parameter T,
in a range of 0.0 to 1.0, along a line or curve. It is created by the feature Point >
ByParameterAlongCurve.

Exercise: Create a T Value point


1

Open the first_line.gct file.

In the GenerativeComponents dialog, click the Create Feature tool.

Scroll to Point in the Feature Type list and expand the entry.

Expand the ByParamterAlongCurve update method to see the parameters


you must define.
Parameters listed in black are required. Those in blue are optional and you
can define them now, or later. To see all parameters, enable the Show
settings properties check box above the feature list.

The Basics of GenerativeComponents

44

Copyright 2009 Bentley Systems, Incorporated

Jan-10

Parameter Spaces

Click in the expression field, to the right of the Curve property.

Press and hold the Ctrl key on the keyboard, and then enter a data point
on the line, or press Enter on the keyboard, to accept.

Note: If an invalid expression value is entered the field will become shaded.

Focus shifts to the T: double (repl.) field.


7

Type 0.5.
This means that the point will always be in the center of the line. The
value 0 would place a point at the start of the line, 1.0 at the end of the
line, 0.2 at 20% from the start of the line, and so on.

Rename the feature TValuePoint in the Name of feature field, and then
click OK.
A point appears in the center of the line.

Select the Transaction File tab and click Record User Changes into the
Transaction File.

10 Replace the default name with a more meaningful name.


11 Click Save.

Jan-10

45

The Basics of GenerativeComponents


Copyright 2009 Bentley Systems, Incorporated

Parameter Spaces

Editing Features
You can edit a feature different ways. You can use the Move Feature tool to move
a feature in the geometric view, you can change the values in the Expression
fields on the Transaction File tab or you can click the blue property editor icon
that appears when you click in the Expression field and enter values in the
resulting dialog.

Move Feature tool


Handles represent the parameters of a feature that can be edited interactively
within the Geometric view.
For instance, a point created by Cartesian coordinates is defined by X, Y and Z
coordinates. Each line corresponds to an axis with a matching color.

X-axis = Red

Y-axis = Green

Z-axis = Cyan

Select the Move Feature tool, click on one of the handles, and the point will move
along the selected axis, adjusting the corresponding parameter accordingly. For
each pair of axes, X-Y Y-Z and X-Z there is a corner handle. If that one is selected
you can change both variables simultaneously (move in a plane instead along an
axis). However, you cannot click the center of the point and move it.

Exercise: Use the handles


1

In the GenerativeComponents dialog, click the Move Feature tool.

Click one of point01s red handles, continue pressing the mouse button,
and move the point along the X-axis.

Red handles move the point along the X-axis

The Basics of GenerativeComponents

46

Copyright 2009 Bentley Systems, Incorporated

Jan-10

Parameter Spaces

A Feature Coordinates tab dialog is opened. It has been docked with Tool
Settings and State.
3

Enter a data point to move the point.


Note the value change in the XTranslation field.

Select the Transaction File tab and check the XTranslation value for
point01.
It has not changed. The values here are part of the first transaction.

Jan-10

Click Record User Changes and replace the default name with a more
meaningful name, if desired.

Expand the new transaction, expand point01, and see that the changes to
point01 are recorded as a separate transaction.

Click Save.

Click Unplay All Transactions.

Click Play Next Transaction.

47

The Basics of GenerativeComponents


Copyright 2009 Bentley Systems, Incorporated

Parameter Spaces

You see the original points and line.


10 Click Play next transaction twice to step through these transactions.

The T Value point appears and then point01 and the line move.
You can turn handles off from Tools > Toggle Feature Settings > Handles Visible or

Free and locked parameters


There is a free button on the right side of the numeric field on the Coordinates
tab. You also see the <free> value noted in the expression fields on the
Transaction File tab.

Free in Move mode on the Coordinates tab

Right click in Feature Edit form to set/clear free status.

In the free state you can use the graphic handles to move a feature interactively.
If a value is typed in manually, or the button is pressed, it changes to locked and
the feature can only be edited through a parameter edit.

The Basics of GenerativeComponents

48

Copyright 2009 Bentley Systems, Incorporated

Jan-10

Parameter Spaces

Feature association
During the exercise you saw that moving point01 moved the line and the T Value
point. That is because of the dependencies, which you can see in the Symbolic
diagram. The graph in the Symbolic diagram shows that the association flows
directly from point01 and point 02 to the line. The line is dependant on the
points, which are dependant on the location of the baseCS.
The T Value point is also dependent on the line. So, when you change a feature on
a higher level of the hierarchy, all other features which are linked to that feature
will update accordingly.
The symbols in the Symbolic diagram did not move when you moved the point.
You can move the symbols as desired in the Symbolic diagram to get a clear idea
of the feature structure of your model. This does not change their position
geometrically.

Edit Feature tool


Use this tool to edit all parameters of a selected feature.

Exercise: Edit the T Value point features parameters


1

In the GenerativeComponents dialog, click the Edit Feature tool.

In the Symbolic diagram, enter a data point on the T Value point.

Note: You can also select the feature in the Geometric view. However, since

the T Value point sits on the line, it is easier to select it in the Symbolic
diagram.
The Edit Feature tab is added to the GenerativeComponents dialog.
3

Click in the T: double field, change 0.5 to 0.3, and click Apply.
The point moves closer to the start of the line.

Select the Transaction File tab.

Click Record User Changes.

Note: A transaction will also be recorded if you unplay and replay all

transactions.

Jan-10

49

The Basics of GenerativeComponents


Copyright 2009 Bentley Systems, Incorporated

Parameter Spaces

Click Save.

Working with Transactions


As you start to work with GC you will notice that there is no UNDO command.
Since you are capturing the history in each transaction you can simply delete or
suppress that transaction. If you forgot to Record you changes to a transaction
you can split up a transaction or you can manually edit you GCT to add or remove
transactions.
When you add features to the model the steps are recorded as parts of a
transaction. Use options on the Transaction File tab to work with the entire
transaction.

Suppress transaction
When you right click on a transaction, or the node that precedes it, you can select
Suppress Transaction from the menu. This allows you to play the steps in the
transaction file, skipping the steps in that particular transaction.
While you can delete transactions from the right click menu, it is better to
suppress transactions than delete them. Once the work is done, you may want to
apply it else where. You can copy and paste transactions to do this.

Exercise: Suppress a transaction


1

In the GenerativeComponents dialog, right click on the third transaction,


when you moved point01.

Select Suppress Transaction.


The indicator preceding the transaction name is dimmed.

The Basics of GenerativeComponents

50

Copyright 2009 Bentley Systems, Incorporated

Jan-10

Parameter Spaces

Unplay all transactions.

Click Play next transaction.

You see the original points and line.


5

Click Play next transaction.

The original T Value point appears.


6

Click Play next transaction.

The T Value point moves, but point01 and the line do not move since the
instructions that make this occur have been suppressed.

Cutting and copying transactions

Exercise: Move a transaction


1

In the GenerativeComponents dialog, right click on the third transaction


and select Unsuppress Transaction.

Right click on it again and select Cut Transaction.

Right click on the last transaction that is now listed and select Paste
Transaction > Insert After.

Unplay all transactions.

Click Play next transaction to step through the new order.

Click Save.

Any of these changes can be saved without changing the current transaction file
by selecting File > Save <file name> As.

Jan-10

51

The Basics of GenerativeComponents


Copyright 2009 Bentley Systems, Incorporated

Parametric and Associative

Parametric and Associative


So far GC produces geometry like any other graphics application. Lets see how it
differs by producing parametric and associative geometry. In the following
exercise you will create two lines that cross or intersect each other. You will then
create a point at the intersection point. Then draw a line between that
intersection point and another point. The association is between the last line and
the intersection point. As you move one of the first points to break the
intersection the line is removed.

Exercise: Creating a Conditional Line based on Intersection


1

Create a new GCT file.

Select the Create Point command and place five points as shown.

The Basics of GenerativeComponents

52

Copyright 2009 Bentley Systems, Incorporated

Jan-10

Parametric and Associative

Select Create Feature and draw two Lines, with method ByPoint, as
shown. Use the default names (line01 and line02).

Select Create Feature and create a Point with method


AtCurveCurveIntersection, select the two lines as the curves.

Set TreatLinesInfinite to false and click OK.

Select Create Feature and create a Line with method ByPoints, select the
point off to the side and the intersection point.

Note: It is easier to select the intersection point in the Symbolic diagram.

Jan-10

Select the Move Feature tool and click on the corner (where the red and
green lines touch) to move the point in a planar fashion.

Move the point so that the two lines no longer intersect.

53

The Basics of GenerativeComponents


Copyright 2009 Bentley Systems, Incorporated

Parametric and Associative

Select the corner in the upper right so that you can move in X and Y.
Note how the third line disappears when the intersection condition is
broken.

Advanced Note on Temporary Features


The Intersection point can be a temporary point, or one that is generated when
needed.
How to create a temporary point:
Do not complete Exercise step 4. When you create the feature line03, replace the
line03 EndPoint expression with the following.
new Point().AtCurveCurveIntersection(line01,line02)

The Basics of GenerativeComponents

54

Copyright 2009 Bentley Systems, Incorporated

Jan-10

Module Review

This point is only created at the time it is needed, and does not exist otherwise.

Module Review
Now that you have completed this module, lets measure what you have learned.

Questions
1

What is a double?

What is an integer?

Where are the directions about how to create the geometry stored?

How do you reconstruct geometry that you have created?

What is the difference between the free and locked parameters?

What is a T Value point?

Answers

Jan-10

A double is another name for a Real number; any number with a decimal
value.

An integer is any whole number.

The directions about how to create the geometry are stored in a DGN file.

You play a transaction to reconstruct the geometry.

In the free state you can use the graphic handles to move a feature
interactively. When locked and it can only be edited through a parameter
edit.

A T Value point denotes a relative position that is controlled by the


parameter value T, in the range of 0.0 to 1.0, along a line or curve.

55

The Basics of GenerativeComponents


Copyright 2009 Bentley Systems, Incorporated

Tips from this module

Tips from this module


1

Learn the basics of the interface. Spend 15 minutes exploring menus and
tools for your first few sessions.

Understand how to use the View Controls, spend five minutes at the
beginning of each session practicing zoom in/out and rotating. Spin the
mouse wheel for Zoom In/Out, double click to fit the view and Shift+press
the wheel for Rotate about center of view.

Remember it is all about points. Explore the Point feature and its Update
Methods.

Use Example Help.

The Symbolic Diagram is a great way to find, insert into expression fields
and operate on features.

Learn the vocabulary of GC now. Features, Transactions, Symbolic


Diagram, Update Methods, Parametric values, free v. locked values, etc.

The Basics of GenerativeComponents

56

Copyright 2009 Bentley Systems, Incorporated

Jan-10

Variables and Sets


Module Overview
This module discusses variables and describes how to create a graphic variable
for GenerativeComponents. It also presents the procedure for creating sets or
collections/lists and establishing a new coordinate system. You will also learn
techniques to shorten the design process.

Module Prerequisites

Basic understanding of Features, Transactions and Interface

Module Objectives
After completing this module, you will be able to:

Create and modify Graph Variables

Creates and manipulate sets

Define a new coordinate system

Drawing economically

Define feature properties

Edit a transaction file

Select alternative update methods

Introductory Knowledge
Before you begin this module, let's define what you already know.

Jan-10

57
Copyright 2009 Bentley Systems, Incorporated

Variables and Sets

Module Glossary

Questions
1

How do you create a point feature?

Where can you define feature parameters?

Answers
1

In the GenerativeComponents dialog, click the Create Point tool or select


Features > Create Point. Place the points by entering data points.

In the expression fields for the update methods for different feature
types.

Module Glossary
Graph variable
These work hierarchically and affect elements in the graph to which they belong.
A graph variable will control all elements or constructions that reference it. When
you change the graph variable, all references to that variable will change along
with it.

Curly brackets {}
These are used to define collections or sets, such as a set of features made up of
{point01, point02, point03}. These can be passed as a parameter value.

Syntax
Sets
Sets use curly brackets: { }

Variables and Sets

58

Copyright 2009 Bentley Systems, Incorporated

Jan-10

Syntax

Consider a circle defined by a center point and radius. You could have one circle
with a defined radius of 5 units.

Radius set to 5

or,
you can have a set of circles by using curly brackets and a set of numbers for radii.

Radii controlled by set


of numbers: {2,3,5,7,8}

A set of sets looks like: {{abc},{def}}

Jan-10

59

Copyright 2009 Bentley Systems, Incorporated

Variables and Sets

Syntax

Index
Index of inputs uses square brackets: [ ]
The Index count starts at 0.
For Circle01 below we have:

[3]

[4]

[2]
[0]

[1]

In GC these circles are notated as:


Circle01[0]
Circle01[1]
Circle01[2]
Circle01[3]
Circle01[4]
For a List of 5 circles, which is the List Length.
Remember when you index a set you start with 0.
If you have multiple dimensions then use:
Index [a][b]...[n]

Variables and Sets

60

Copyright 2009 Bentley Systems, Incorporated

Jan-10

Syntax

For example, consider the 2D array of points, this is two sets of X values and Yvalue for one point, point01:

Point01[0][2]

Point01[5][3]

Point01[2][0]

Point01[9][0]

Within a set you can also mix types, for example add a variable as a set member.

Exercise: Trying out sets


1

Try to duplicate the circles example.

Then try 2D point grid shown above.

Functions
Functions use parentheses ( ). For example,
Sin(1.28)
Series(0,9,1)

Jan-10

61

Copyright 2009 Bentley Systems, Incorporated

Variables and Sets

Graph Variables

Graph Variables
The Symbolic view contains the graph, or graphs, of geometric and nongeometric features. You can create a new model and its baseCS is free from the
default models baseCS. The Symbolic view can contain more than one graph, and
they only become interrelated if you design a dependency between them.

Variables are named data containers that can hold values as single values or as
lists of values. The values are accessed by using the variable name in place of the
needed value.
A graph variable belongs only to one graph. A graph variable named ObjectHeight
in the default graph is exclusive of a graph variable named ObjectHeight in a
graph named secondaryModel.

Creating a graph variable


To create and manage graph variables you can select GraphVariable from the
feature list and use the EvaluateExpression update method or select Utilities >
Graph > Manage Graph Variables.

Variables and Sets

Exercise: Create a graph variable


1

In the GenerativeComponents menu, select File > New.

Name the new file: Pyramid

IN the GenerativeComponents task, select Create Feature.

62

Copyright 2009 Bentley Systems, Incorporated

Jan-10

Graph Variables

Select GraphVariable and expand Update Method: EvaluateExpression.

Name the variable PyramidHeight and click OK.

Change the Value to 5 and press Enter.


At the bottom you see Minimum, Maximum and Step Size and other
expression fields. The blue color indicates an optional field.

Set LimitValueToRange to true.


You are going to specify the range of values that can be applied to this
variable as well as the increments in which it can be increased or
decreased.

Set the following:


Minimum: 1
Maximum: 100
Step Size: 1
A slider appears in the Analog Value column. The value 5 is between the
limits and the slider indicates this. Move the slider to the left toward the
minimum value or to the right toward the maximum value.

Jan-10

63

Copyright 2009 Bentley Systems, Incorporated

Variables and Sets

Graph Variables

Click on OK to create the Graph Variable.

10 Select the Transaction File tab, click Record User Changes and replace the

default name with a more meaningful name.

11 Click Save Transaction File, supply a name, and click Save.


Hint: A shorthand way to create a variable on the fly in the expression field,

when creating a feature, is varName=25.0


In the following exercises you will create a pyramid and apply the graph variable
you created to control its height. First you will draw three sides.

Exercise: Create Base Polygon


1

Continue in the same file, and ensure that you are working in the Top view
rotation in the Geometric view.
You want to place four points on the same plane.

Place 4 points.

Now you will create a polygon from the four points.

Variables and Sets

Click the Create Feature tool.

Scroll to Polygon in the Feature Type list, expand it and then expand the
ByVertices update method.

Place the pointer in the Vertices expression field, press and hold the Ctrl
key on the keyboard, and then select the four points.

64

Copyright 2009 Bentley Systems, Incorporated

Jan-10

Graph Variables

Press Enter.

Note that in the expression filed the vertices are a set of points with curly
braces.

Select the Transaction File tab, click Record User Changes and replace the
default name with a more meaningful name, if desired.

Now you need to define the center of the polygon and place a point at that
location.

Creating Variables on-the-fly


You can always declare a variable in the expression field, by using the syntax:
varName = value
for example,
pointCount = 5
allradii = {2,3,4,5.5,7,10}
so that,
allradii[3] = 5.5

Jan-10

65

Copyright 2009 Bentley Systems, Incorporated

Variables and Sets

Graph Variables

allradii[5] = 10
Remember with a list you start counting at 0.

Sets or Collections
Parameters that include (repl.) let you use a list of inputs, effectively replicating
the feature that they define. For instance, instead of a single value for the X
parameter of a Point> ByCartesianCoordinates there will be as many point
instances as there are values in the list.

Use curly braces to surround input that you want to be treated as a set.
When a collection is required as the input property, GenerativeComponents
displays {} (the symbol for an empty collection) to indicate this. You can add to
the contents of a collection. For example, in the Expression field:
{point01, point02, point03}
You should be aware that the choice to add or not add an additional level of nest
might have downstream effects. For example, if these points are being used to
define the StartPoint of Lines. The affect of adding a {}, is adding an additional
level of nest, is that when you hover over the resulting lines you will see:
line01[0][n]

Variables and Sets

66

Copyright 2009 Bentley Systems, Incorporated

Jan-10

Graph Variables

Without the additional level of nest you will see line01[n], where n is the index of
the Line being hovered over. So, the additional level of nest caused by the
(potentially) redundant {} propagates down stream via the replication process.
You need to be aware of this and consciously control this process.

Feature Properties and the dot operator


Modeling in a CAD environment is centered on geometric tools. When starting
with GenerativeComponents you most likely were thinking that you will have to
draw every line and shape, and not considering how you could shorten the
process by using variables. There are more ways to shorten the process.
A feature always has a given set of properties. Thus, the line feature always has
the StartPoint, EndPoint and Length properties. A circle always has the Radius
property.
To activate a property of a feature use the dot . operator in the expression field.

The purple box icons in the list indicate an alternate Update Method or Function.
The hand on the list icon indicates a Property of the feature.
You can use these properties to create new features. It is an economical way of
working, as it will reduce the number of features overall.
Sets and dot operators are two of the most powerful tools of GC (there are many
others), but you must master the use of sets and variables.
In the following exercise, you will use a set consisting of the four points to define
the center of the polygon. This point will be the base of a new coordinate system
which will help when establishing the pyramids height.

Jan-10

67

Copyright 2009 Bentley Systems, Incorporated

Variables and Sets

Graph Variables

Exercise: Use a set to define the center of the polygon


1

In the GenerativeComponents dialog, click the Create Feature tool.

Scroll to Point in the Feature Type list, expand it, and then expand the
CentroidOfSet update method.

Place the pointer in the SetToFindCentroidFrom expression field, type in


polygon01.Vertices

The set of 4 vertices of the polygon is entered for you.


4

Click OK.

A centroid point appears.


5

Select the Transaction File tab, click Record User Changes and replace the
default name with a more meaningful name.

Defining a new coordinate system


To establish the highest point of the pyramid it would be easiest place a new
coordinate system at the centroid point, and use that point as your base
reference. You will control the height of the pyramid from this point using the

Variables and Sets

68

Copyright 2009 Bentley Systems, Incorporated

Jan-10

Graph Variables

graph variable. This means that if you rotate the pyramid, the height will always
be perpendicular to the base.

Exercise: Create a new coordinate system


1

In the GenerativeComponents dialog, click the Create Feature tool.

Scroll to Coordinate System in the Feature Type list, expand it, and then
expand the ByOriginXPoint update method.
Required parameters are the origin and an X point.

Place the cursor in the Origin expression field, press and hold the Ctrl key,
and then select the centroid point.

Type in polygon01.Vertices[0] for the XPoint.

Click OK.

Select the Transaction File tab, click Record User Changes and replace the
default name with csPyramid.

Now you need to draw a line in the Z direction from the centroid, defined by
GraphVariable PyramidHeight. This will define the height of the Pyramid.

Exercise: Define the height


1

In the GenerativeComponents dialog, click the Create Feature tool.

Scroll to Line in the Feature Type list, expand it, and then expand the
ByStartPointDirectionLength update method.

Place the pointer in the StartPoint expression field, press the Ctrl key, and
then enter a data point on the centroid.

Note: It may be easier to select the point (point05) in the Symbolic view.

Jan-10

69

Copyright 2009 Bentley Systems, Incorporated

Variables and Sets

Graph Variables

To define the direction, first identify the new coordinate system.


4

Place the pointer in the Direction expression field, press the Ctrl key, and
then enter a data point on csPyramid.
Now you need to define the direction in which you want the line to go. To
define height, you need to indicate the Z direction. So, you will define the
property csPyramid.ZDirection.

Place the pointer after csPyramid in the Direction expression field, and
type a period. This is the dot operator.
A menu containing valid parameters opens.

Scroll down and double click on ZDirection to select it.


csPyramid.ZDirection
Next, the length of the line will be defined by the variable PyramidHeight.

Place the pointer in the Length expression field, press the Ctrl key, and
then select the GraphVariable in the Symbolic view, as it is not in the
Geometric view.

Click OK.

Rotate the Geometric view to Right Isometric to see the line.

Reset after using a view control to return focus to the


GenerativeComponents dialog.
10 Select the Transaction File tab, click Record User Changes and replace the

default name with a more meaningful name.

Variables and Sets

70

Copyright 2009 Bentley Systems, Incorporated

Jan-10

Graph Variables

You will now add a point at the end of the vertical height line. This is
helpful in some instances when using this pyramid. Though you could
simply use the endpoint of the line just created.
11 Select Create Feature, select Point with Update Method of

ByDirectionAndDistanceFromOrigin. Use the following values for the


Expression fields:
Origin: csPyramid
Direction: csPyramid.ZDirection
DistanceFromOrigin: PyramidHeight
12 Rename the new Point feature to ptTopPoint and click OK to create it.

How could use exisiting geometry and avoid creating this point?
As you will find out you will need it later, so please create it.

Exercise: Create Polygons to represent the sides


1

In the GenerativeComponents task, click the Create Feature tool.

Scroll to Polygon in the Feature Type list, expand it, and then expand the
ByVertices update method.

Place the pointer in the Vertices field, press the Ctrl key, and then select 2
edge vertices, and the ptTopPoint .
Vertices: {polygon01.Vertices[0],polygon01.Vertices[1],ptTopPoint}

Hint: Alternatively, you can use property line01.Endpoint instead of

ptTopPoint.
4

Set the Fill parameter to true and click OK.

Click Create Copy and create filled polygons ByVertices on the other 3
sides. Simply change the index of the vertices. For Example,
Vertices: {polygon01[1],polygon01[2],ptTopPoint}
You can rotate the view dynamically so you can distinguish the sides.
Reset after using a view control to return focus to the
GenerativeComponents dialog.

Jan-10

Create a filled polygon ByVertices under the pyramid by selecting the 4


base points.

Select the Transaction File tab, click Record User Changes.

71

Copyright 2009 Bentley Systems, Incorporated

Variables and Sets

Graph Variables

To see the fill attribute, click the MicroStation icon at the upper left of
View 2 and select View Attributes. Enable the Fill check box.

Exercise: Change the height


1

In the GenerativeComponents dialog, select Utilities > Graph > Manage


Graph Variables.

Use the slider bar to change the graph variable of the pyramid height.
You can also edit the graph variable by selecting the Edit Feature tool and
clicking the GraphVariable in the Symbolic view. Then you can change the
object Value expression.

Hint: Think about using one line endpoint as the start point of another line.

Drawing Economy
There are more efficient ways of drawing the geometry we created.

Exercise: Create a square by defining feature properties


1

In the GenerativeComponents dialog, click New Transaction File.

Click the Create Point tool, create 2 points and then create a line ByPoints.
To draw a second line perpendicular to the first, graphically you would
create a third point and then the line. You can also draw the line using
additional feature properties.

Variables and Sets

Click the Create Feature tool.

72

Copyright 2009 Bentley Systems, Incorporated

Jan-10

Graph Variables

Scroll to CoordinateSystem in the Feature Type list, expand it and then


expand the ByOriginXPoint update method.

Place the pointer in the Origin expression field, press and hold the Ctrl
key, and then select the first point.

Define the X Direction by selecting the second point.

Click OK.

Click the Create Feature tool.

Scroll to Line in the Feature Type list, expand it and then expand the
ByStartPointDirectionLength update method.

10 Place the pointer in the StartPoint expression field, press and hold the Ctrl

key, and then select line01.


11 Place the pointer after line01 in the StartPoint expression field, and type a

period, the dot operator.


A menu containing valid parameters opens.
12 Scroll down and double click on StartPoint to select it.

line01.StartPoint
The StartPoint of line02 is now defined as line01.StartPoint. Next you
define the direction of the line as CoordinateSystem01.Ydirection.
Remember you defined the X Direction when you selected point02 when
you created the new coordinate system. When you select the Y direction
you know it will be perpendicular to line01.
13 Place the pointer in the Direction expression field, press and hold the Ctrl

key, select CoordinateSystem01, type a period, and then double click on


YDirection to select it.
The last thing to do is define the length.

Jan-10

73

Copyright 2009 Bentley Systems, Incorporated

Variables and Sets

Graph Variables

14 Place the pointer in the Length expression field, press and hold the Ctrl

key, select line01, type a period, then and double click on Length to select
it.

15 Click OK.

The line is drawn.

Exercise: Continue the square


1

On the Edit Feature tab of the GenerativeComponents dialog, click Create


New.

Define the following:


StartPoint: line02.EndPoint
Direction: coordinateSystem01.Xdirection
Length: line01.Length

You can finish the square by creating a Line ByPoints.


StartPoint: line03.EndPoint
EndPoint: point02

Variables and Sets

Click OK.

74

Copyright 2009 Bentley Systems, Incorporated

Jan-10

Editing a Transaction File

On the Transaction File tab, click Record User Changes and replace the
default name with a more meaningful name, if desired.

As a result of economical drawing the graph in the Symbolic view is simple,


containing 2 less points than the previous method.
When you drew line01 you defined the StartPoint as point01 and the EndPoint as
point02. This defined the direction of the line. Being aware of the direction of the
features makes drawing more economical.
A different way is to draw the first line, place a third point or CoordinateSystem,
and then create line03 ByStartPointDirectionLength.

StartPoint is defined by point03

Direction is defined by line01

Length is defined by line01.Length

Editing a Transaction File


Once you have created a transaction file you can edit it. Editing an existing file can
be a way to work economically.
You will change the color and line weight of the square by editing the transaction
file.

Jan-10

Exercise: A quick way


1

Continue in the same file, and select Edit Feature tool.

Enable Show Settings Properties.

Change the Color, Line Style and the Line Weight.

Exercise: Edit the transaction file

75

Copyright 2009 Bentley Systems, Incorporated

Variables and Sets

Editing a Transaction File

Click the Edit transaction file tool at the bottom of the


GenerativeComponents dialog.

Scroll to the section where you created line04.

You must use the correct syntax, as the file is case sensitive.
3

Add the following after the last line in the section:


Color = 3;
LineWeight = 5;

Click OK.

Click Play all Remaining Transactions.

You see the change.

Variables and Sets

76

Copyright 2009 Bentley Systems, Incorporated

Jan-10

Selecting Alternative Update Methods

The transaction file does not tell you which type of line or point you have created.
It just lists feature line04 GC.Line. It does not note that it is a line
ByStartPointDirectionLength or ByPoints. This because GenerativeComponents
knows which feature type you have used by the expression inputs. Each feature
has a set of unique expression inputs.

Selecting Alternative Update Methods


You can change to a different Update Method later for a feature type.
There is an option list on the Edit Feature tab that shows the Active update
method. You can select an alternative update method.

Exercise: Finding an alternative update method


1

In the GenerativeComponents dialog, click the Edit Feature tool and select
line04.

Select Also show inactive update methods to see alternate ways to draw
that feature.

Expand ByStartPointDirectionLength.

Some of the expressions are already entered. All you need to do is supply the
required expression, or expressions, that are unknown and click Apply to change
the update method used to draw the line. The exact update method GC chooses
(by itself behind the scenes) relies upon an analysis of the input properties
supplied, giving preference to the latest input properties supplied.

Objects and types


Lets review the discussion of objects and the types of objects.
Objects have properties, they can be values, or sub-objects. Either way, they have
a type.

Jan-10

77

Copyright 2009 Bentley Systems, Incorporated

Variables and Sets

Module Review

the general form of calling this is:


object.property.sub-property
for example,
Line01.Endpoint
or
Line01.Endpoint.X
To review, the basic types are:

string - a string of text in double-quotes

double - a decimal number

int - An integer or a whole number

bool - a boolean, true or false. Can also be thought of as On or Off.

Module Review
Now that you have completed this module, lets measure what you have learned.

Questions

Variables and Sets

What is a graph variable?

What do curly brackets indicate?

True or False: The Symbolic view can contain more than one graph.

Why did you crate a T Value point at the top of the ZDirection line, the top
of the pyramid?

When defining the length of the ZDirection line, why did you select the
GraphVariable in the Symbolic view?

What is one a result of economical drawing?

True or False: Once you have created a transaction file you can edit it.

True or False: The transaction file script is case sensitive.

How can you select an alternative update method for a feature?

78

Copyright 2009 Bentley Systems, Incorporated

Jan-10

Tips from this module

Answers
1

A variable that controls all elements that reference it, within a specific
graph.

A set of values.

True. The Symbolic view can contain more than one graph and they only
become interrelated if you design a dependency between them.

So you could control the height of the pyramid from this defined position.
The pyramid height will always be perpendicular to the base.

It is not represented in the Geometric view.

The graph in the Symbolic view is simple, containing less features.

True. Use the Edit transaction file tool to open the transaction file.

True. You must use the right syntax, as the transaction file script is case
sensitive.

On the Edit Feature tab there is an option list that shows the Active
update method. Select Also show inactive update methods to see them.

Tips from this module

Jan-10

Sets can be created in two basic ways: curly brackets or a Series function.
There are other ways but these work well for most challenges.

Know how to read and find a location in a list for example, Line01[2][1]

You can declare variables in the expression field of a feature.

Try to write neat transaction files.

Be efficient: Use the output of one feature as the input of a new feature.

Know your Types: Variable Types (string, bool, int, etc) and GC Types
(IPoint, ISolid, etc).

Replication is a more efficient and controllable way to copy.

79

Copyright 2009 Bentley Systems, Incorporated

Variables and Sets

Tips from this module

Variables and Sets

80

Copyright 2009 Bentley Systems, Incorporated

Jan-10

Using the Series Function


Module Overview
This module defines a Series and describes how to implement these functions in
GenerativeComponents. In addition, you will learn the general use of a function
and learn some additional functions that are helpful when working with Lists.

Module Prerequisites

Knowledge of basic features and transactions

Module Objectives
After completing this module, you will be able to:

Create and Edit a Series

Use Replication

Module Glossary
Series
Round brackets or parentheses () are used to define functions like a Series. One
example of a Series is a collection of points along a line or a surface. The Series is
defined inside the parentheses (start, finish, increment). These inputs generate
and return a collection of numbers from the start to the finish, at intervals
specified by the increment.

Jan-10

81
Copyright 2009 Bentley Systems, Incorporated

Using the Series Function

Module Glossary

These are Series of ints and doubles, for example. Series(1, 10, 1) returns {1, 2, 3,
4, 5, 6, 7, 8, 9, 10}. It starts at 1, ends at 10 and increments at intervals of 1.
Series(1, 10, 2) returns {1, 3, 5, 7, 9} Series(2, 3, 0.25) returns {2, 2.25, 2.5, 2.75,
3}.

Function
A Function turns inputs into something else. A Series is a type of Function. Each
Function listed in GenerativeComponents Script Expression Builder has a short
description. What the Function returns, or gives you back, is also noted. When
you use a Function you can see the syntax, or, how to write the inputs. A quick
way to access functions is to use the Fx button in the Script Builder. The most
important question to ask is, What does a function return. The answer has to be
in two parts: what type does it return (string, double, int, etc) and what value
does it return.

Replication
Replication in GenerativeComponents is to make copies of a feature, through the
use of series or curly brackets.
(repl.) = replicable

If you have a feature type comprised of a line drawn between a start point and an
end point, when you place this feature it would respond to a single start point
and a single end point. However, if you make features within it replicable, it can
respond to a series of start points and end points. The resulting generated feature
type would be a set of lines.

Using the Series Function

82

Copyright 2009 Bentley Systems, Incorporated

Jan-10

Creating a Series

We have seen replication at work with the multiple circles. One radius = One
circle. Four radii = Four circles. You do not draw four circles, you simply specify
four radii.

Creating a Series
When you want multiple sets of points to define geometry, and you know exactly
what the increments between those points should be, you can use a Series.

Exercise: Create a Series


1

Select File > New File. Name the new file Series.dgn

Make sure that you are working in the Top view rotation in the geometric
view.

Scroll to Point in the Feature Type list, expand it and then expand the
ByCartesianCoordinates update method.

Place the pointer in the CoordinateSystem expression field, press and hold
the Ctrl key, and then select the baseCS in the Symbolic view.
You will use a Series to define the X and Y and Z coordinates. A Series is a
Function, so you will select it from the Script Expression Builder.
The Series Function will create a list of values given a start value, final
value and the increment. Start, final, and increment are referred to as the
arguments of the function.

Jan-10

83

Copyright 2009 Bentley Systems, Incorporated

Using the Series Function

Creating a Series

Click on the blue Script Editor icon.

Click the fx icon.

Using the Series Function

84

Copyright 2009 Bentley Systems, Incorporated

Jan-10

Creating a Series

Select the Functions tab in the Script Expression Builder, scroll to Series,
and double click it.

The Expression Builder is non-modal so it can be kept open and docked.


One recommendation is to dock with the Symbolic Diagram so they form
tabs.
You can also select a function and click Insert. This inserts the arguments
in the expression field.
8

Click Close at the bottom right of the Script Expression Builder.


Lets say you want to create 11 points on the X-axis, at an equal distance
apart, so youll define (start, finish, increment) as (5,15,1), meaning (start
at 5, end at 15, in increments of 1).

Place the pointer inside the parenthesis and replace (start, finish,
increment) with 5,15,1.

10 Place the pointer in the YTranslation expression field and type 0.


11 Place the pointer in the ZTranslation expression field and type 0.
12 Click OK.

Jan-10

85

Copyright 2009 Bentley Systems, Incorporated

Using the Series Function

Creating a Series

13 Fit View to see the points.

There are 11 points along the X-axis, equidistant apart. (There are not 15
points, as you started at 5, not 0.)
14 Select the Transaction File tab, click Record User Changes and replace the

default name with a more meaningful name, if desired.


15 Click Save Transaction File, supply a name.

How would have created these points using a Set with Curly Braces?

Adding a Line to the Series of Points


1

Continue in the same file, and select Create Point and add another point.

Select Create Feature, select Line with the Update Method ByPoints, and
set the following:
StartPoint: point01
Remove the indexing of point01, so should read point01, not point01[0].
EndPoint: point02
Lines are automatically drawn to all instances of point01.

Using the Series Function

Move Point02 and see what happens. Did you expect the result?

86

Copyright 2009 Bentley Systems, Incorporated

Jan-10

Creating a Series

Editing a Series
Use the Edit Feature Tool to edit an existing series. You will edit the points so that
the Series is in the Y direction rather than the X.

Exercise: Edit the direction of the Series


1

Continue in the current file, and return to the Edit Feature tab.

Copy Series(5,15,1) from the XTranslation field and paste it into


YTranslation field, replacing the 0 value.

Make the X Translation 0.

Click Apply.

Fit View to see the points.

Select the Transaction File tab, and click Record User Changes.

On the Edit Feature tab, copy Series(5,15,1) from the YTranslation field
and paste it into ZTranslation field, replacing the 0 value.

Make the YTranslation 0.

Click Apply.

10 Rotate the view to Right Isometric.


11 Fit View to see the points.
12 Select the Transaction File tab, and click Record User Changes.
13 Now, on the Edit Feature tab, put the Series into both the X and

YTranslation expression field, make the ZTranslation 0, and click Apply.


14 Fit View to see the points.

The points are now equidistant between the X and Y directions.


15 Put the Series into ZTranslation expression field, and the points will move

up into the Z direction too.


16 Select the Transaction File tab, click Record User Changes.

Jan-10

87

Copyright 2009 Bentley Systems, Incorporated

Using the Series Function

Replication

Replication
While it is a fancy word, replication is a simple concept, and one that all designers
have used in regular CAD application and that is copying. In GC, the copying is
more intelligent and controllable. In addition, one can easily do multidimensional copying as well. The initial concept of replication is based on the
Series function or by typing in a set as an input.
In addition, you can turn the Replication style to see all combinations.

Exercise: Basic Replication


1

Continue in the same file, and edit the point01 feature and replace the
XTranslation expression field with Series(1,9,2).

Line01 is also replicated.


Note that X is now unambiguously defined and cannot be edited by its
handles, which are no longer visible.

Using the Series Function

88

Copyright 2009 Bentley Systems, Incorporated

Jan-10

Replication

For point01 replace the YTranslation expression field with Series(1,9,2).

What you see here is are lines going from one point (point02) to five
instances of point01, but in this case the point01 instances are at
{(1,1),(3,2),(5,3),(7,4),(9,5)}, which corresponds to point01[0], point01[1],
point01[2], point01[3], point01[4].
3

In the GC dialog, click on Toggle Replication Style, and click on any


instance of point01 (or click on point01 in the Symbolic View).

Now you see all combinations of X and Y for point 01.


4

Jan-10

Place the cursor on any instance of point01, and note the dual instancing.

89

Copyright 2009 Bentley Systems, Incorporated

Using the Series Function

Replication

Record the transaction.

Click Save, and provide a name for the GCT file.

Exercise: 3D Replication
1

Create a new DGN file.

Select Create Point and place one point.

Record the transaction.

Select Edit Feature and click on point01.

Replace XTranslation, YTranslation, ZTranslation with:


Series(1,9,2)

Note: Same entry for all three fields.


6

Click on Toggle Replication Style and click on point01.

Point01 instances after replication and view rotation

Using the Series Function

Rotate the View to see Replication in 3D.

90

Copyright 2009 Bentley Systems, Incorporated

Jan-10

Other Functions Related to Series

Other Functions Related to Series


Flatten
Returns a new flat (one level) list comprising every member at every nest level
within the given list at one level. Usage is Flatten(list). Input and ouput types are
object types. For example, if Point01 is a list of 2D points like our previous
example (Series for X for five values and Series for Y for 5 values) then there are
25 total points. Before Flatten they are indexed:
Point01[0][0] ... Point01[5][5]
after Flatten:
Point01[1 ... 25]

Sort
While a very useful function Sort is generally used in GC Script, though the
thoughtful geometrician can certainly use this function in an expression field.
The sort function goes through the list making comparisons between pairs of
values according to a supplied sort criteria/function. The general form is:
Sort (numbers, function(x, y)
where function(x,y) tells us how to sort (ascending, descending, etc). For
example,
double[] sortedNumbers = Sort(numbers, function(x, y) { return x < y; });
sortedNumbers is just a variable that is delcared on-the-fly.
Here the sort criteria is set by calling a temporary function where for each x < y
the number (x) is lower in the list.
The Sort funtion returns an object, a sorted list.

Jan-10

91

Copyright 2009 Bentley Systems, Incorporated

Using the Series Function

Other Functions Related to Series

Sublist
Returns a new list comprising a contiguous sequence of members of the given
list. Specifically, the resultant list comprises the members at index positions
(firstIndex) through (firstIndex + count 1), inclusive. If the count is omitted, the
entire remainder of the list is returned.
For example, if you have a Series of point01 and you use:
Sublist(point01,1)
then you start at point01[1] instead of point01[0].

Add
Returns a new list comprising all members of the given list, plus the given
additional value. This function does not change the given list. To add a new
member directly to the end of a list, call the Add method on that list, itself.

Exercise: Using the Sublist and Add Functions


1

Create a New DGN file.

Place four Points and create two Lines between them as shown.

Select Create Feature and choose Point with Update Method of


ByParameterAlongCurve with the following parameters:
Curve: line01
T: Series(0,1,0.2)

Using the Series Function

92

Copyright 2009 Bentley Systems, Incorporated

Jan-10

Other Functions Related to Series

Repeat step three for line02.

Now you will use the Sublist function to create lines between the Series
points.
5

Select Create Feature and choose Line with Update Method of ByPoints
with the following parameters:
StartPoint: point06
EndPoint: point05
Now you shift the start point of the cross lines by one.

Select Edit Feature and choose Line just drawn and change the following
parameter:
StartPoint: Sublist(point05,1)

Jan-10

93

Copyright 2009 Bentley Systems, Incorporated

Using the Series Function

Other Functions Related to Series

Try other values like Sublist(Point05,2)


The Add function can add to a list.

Select Edit Feature and edit line03. Change the following:


Startpoint: point05
EndPoint: Add(Sublist(point06,1),point06[0])

Using the Series Function

94

Copyright 2009 Bentley Systems, Incorporated

Jan-10

Module Review

Optional Exercise:
Try doing the same thing with two circles and a series of lines in between
them.

Module Review
Now that you have completed this module, lets measure what you have learned.

Questions
1

What does a Function do?

How can you define a function for a feature?

What is a Series?

When do you use one?

Answers
1

A Function turns inputs into something else.

Click the fx icon in the feature expression field. Select the Functions tab in
the Script Expression Builder, scroll to Series, and double click it.

A Series is a collection of points along a line or a surface. It is defined


inside parentheses.

When you want multiple sets of points to define geometry, and you know
exactly what the increments between those points should be.

Tips from this module

Jan-10

GC has a more sophisticated way of copying with replication.

You can create a list by using a set (curly braces) or a Series function.

Remember that all lists start with 0, not 1.

Functions have an input type and an output type.

95

Copyright 2009 Bentley Systems, Incorporated

Using the Series Function

Tips from this module

Using the Series Function

96

Copyright 2009 Bentley Systems, Incorporated

Jan-10

Reactors and Object Operators


Module Overview
GenerativeComponents provides real-time feedback on your designing. Several
methods are available to do this. We have already examined using a property of a
feature to supply a new feature with an input. This is a vital tool in the smart
geometricians workflow. When working with functions remember that it is
important to understand what type and value they return.

Module Prerequisites

Basic understanding of Features, Transactions and Editing Expressions

Basic understanding of Functions

Module Objectives
After completing this module, you will be able to:

Jan-10

Use basic construct of a Reactor

Control response of height to the position in a Series

Apply the use of Object Operators to control graphic representation

Use the Distance() function

Control Display Options

97
Copyright 2009 Bentley Systems, Incorporated

Reactors and Object Operators

Reactor for Vertically Dependent Line

Reactor for Vertically Dependent Line


There are several way to control the height of a line based on other information
in the design. A controller simply makes an object respond to the proximity of
another object.
The Reactor is an important concept since it allows the you to address the
metaphor of response and can be implemented in many ways.
We will look at two methods. First, you will use the Distance() function where the
inputs are of type IPoint, so it returns a double that is the distance between two
points.

Exercise: Using the Distance() Function


1

Create a new DGN file, by selecting New File. Provide a name for your file.

Select Create Point and place two points.

Select Create Feature and place a Line, ByPoints between the two points.

Save the transaction by select Record User Changes.

Select Create Feature and create a Line, ByStartPointDirectionLength,


with the following parameters:
Start Point: point02
Direction: baseCS.ZDirection
Length: Distance(point01,point02)

Rotate the View to see the Vertical line.

Hint: The quickest way to Rotate the view about center is to use Shift+Middle

Mouse button click.

Reactors and Object Operators

98

Copyright 2009 Bentley Systems, Incorporated

Jan-10

Reactor for Vertically Dependent Line

Save the Transaction.

Select the Move Feature tool and move point01 and note the change in
the height of the vertical line. Right-click to cancel Move Feature.

Lets see how a Series would affect the Distance() function.

Exercise: Using a Series and the Distance() function


1

Continue in the same file, select Edit Feature, and select point02.

Replace XTranslation with Series(1,9,2).

Rotate to the Front View to see that each line is of a different height.

Try replacing the XTranslation field of point01 with a Series and see what
happens.
Can you explain what you see?

Jan-10

99

Copyright 2009 Bentley Systems, Incorporated

Reactors and Object Operators

Object Operators

Object Operators
The following operators can be applied to any values of any type, since every
value is an object, in addition to whatever other type (IPoint, ICurve, etc.) it is.
Keep thinking of value and type.
val1 == val2
Is the test for equality. The result in a boolean (bool) value. The result is true if the
two values are equal, false if they are not.
val1 != val2
Is the test for inequality. Results in a bool value that is true if the two values are
not equal, false if they are.
b ? val1 : val2
Is a conditional expression. This is a very useful operator and one that is used
widely.
This is another important tool. Remember it.
The value b must be an expression of the type bool. The values val1 and val2 may
be of any types and not necessarily of the same types. For example,

If b is true, the result of this operation is val1 (and val2 is not even calculated).

If b is false, the result of this operation is val2 (and val1 is not even
calculated).

b will be an expression that is testing a condition. For example, if X > Y then


val1 otherwise val2. X > Y? val1:val2

val is type
Is the test for data type. Operators can be words as well as punctuation marks.
The value type is the name of a data type, such as double. Results in a bool value:
true if the value is of the specified data type, false otherwise.
More precisely, the is operator returns true if and only if the value (number,
string, etc) is an instance of the specified type. This means that:

Reactors and Object Operators

100

Copyright 2009 Bentley Systems, Incorporated

Jan-10

Object Operators

The value was created as an instance of the specified type, or of a type thats
derived from the specified type.
or
The specified type is an user type, and the value was created as an instance of a
type that implements that user type, either directly or through derivation.
Note that the is operator tests for what the value actually is, not for what it could
become through automatic type conversion.
val as type
Is another test for data type with a different output than the previous.
The value type is the name of a data type, such as double. Results in val if that
value of the specified type, otherwise results in null.
The as operator is functionally equivalent to - val is type ? val : null

Jan-10

Exercise: Using the Conditional Object Operator to difference in height


1

Continue in the same DGN file.

Select Edit Feature and select line02.

101

Copyright 2009 Bentley Systems, Incorporated

Reactors and Object Operators

Object Operators

In the GC dialog turn on Show Settings Properties.

This gives you access to properties like color, style, and weight among
others.
4

In the Color expression field, type the following:


line02.Length<7?2:3

Reactors and Object Operators

102

Copyright 2009 Bentley Systems, Incorporated

Jan-10

Object Operators

This entry says if the length of line02 is less than 7 (you may need to adjust
this number), then make it green (color 2), if the length is greater than
make the line red (color 3).

Two right-most lines are red while the left are green

Now lets look at another method of a doing a vertically dependent line by using
an inverse relationship.

Exercise: Create a new GC Transaction file


1

From the Main Menu select File > New.

Name it reactor.dgn.

To begin, you will place two Points in a Right Isometric view in the Geometric
view. One of these points will represent a tree within a courtyard. This can also be
called the trigger point. The other point will represent the base point, or grid
point, for a roof.

Exercise: Create the Trigger Point, Base Point, and Line


1

Continuing in reactor.dgn, rotate the Geometric view to Right Isometric.

Click the Create Point tool and enter 2 data points in the Geometric view
to place 2 points.
You will create a Line between these points in order to measure the
distance between the tree and the roof base point.

Jan-10

Scroll to Line in the Feature Type list, expand it and then expand the
ByPoints update method.

103

Copyright 2009 Bentley Systems, Incorporated

Reactors and Object Operators

Object Operators

Hint: To select an existing feature, place the pointer in the desired expression

field, press the Ctrl key, and then click the feature in the Geometric
view with the left mouse button (a data point).
4

Click OK and line01 is created.


GC automatically names new features with their type and then a serial
number starting with 01 and incrementing each new instance of that type
by 1.

Select the Transaction File tab, click Record User Changes and replace the
default name with a more meaningful name, if desired.

Click Save.

Now you will create a point that is vertically offset from the base point of the
roof. You will create another Line, but this one is based on the location of the
base point (as the StartPoint) and in a vertical direction, with a length equal to the
length of first line you created. The Update Method for this new line is
ByStartPointDirectionLength.

Exercise: Create a responsive offset line


1

In the GenerativeComponents task, click the Create Feature tool.

Scroll to Line in the Feature Type list, expand it and then expand the
ByStartPointDirectionLength update method.

Place the pointer in the StartPoint expression field, press and hold the Ctrl
key, and then enter a data point on point02.

Reactors and Object Operators

104

Copyright 2009 Bentley Systems, Incorporated

Jan-10

Object Operators

Place the pointer in the Direction expression field, press Ctrl, and then
select the vertical, Z, axis, of the baseCS.

The tool tip will read baseCS.Zdirection.


You want the length to be the same as line01, so you need to define the
property line01.Length.
5

Place the pointer in the Length expression field, press Ctrl, and then enter
a data point on line01.

Place the pointer after line01 in the Length expression field, and type a
period.
A menu containing valid parameters opens.

Scroll down and double click on Length to select it.


You can use auto-completion by entering the letters le and the Length
property will be highlighted.

Click OK.

Select the Transaction File tab, click Record User Changes.

As before, you can test a model dynamically by moving one of the input points
and observing the resulting behavior.
Note: The length of line02 is always the same as the length of line01.

If the StartPoint of line02 represents the base point of the roof, then EndPoint of
line02 represents the height of the roof. You want the roof to be higher the closer
it is to the tree, which is represented by point01. You have the inverse of the
relationship that is required. You will change this.

Jan-10

Exercise: Adjusting to an inverse relationship

105

Copyright 2009 Bentley Systems, Incorporated

Reactors and Object Operators

Object Operators

In the GenerativeComponents dialog select the Transaction File tab,


expand line02, and select the Length expression.

Change the expression to 5.0/(line01.Length+1.0).

You add the +1.0 to line01.Length, so that if line.01.Length was zero, you
would not divide by zero. Put line01.Length+1.0 in parentheses so that
this is evaluated before the division.
3

Click the Move Feature tool and move point02.


Observe the relationship. The Length of line02 increases as point02
approaches point01.

Experiment with different expression for the Length input property for
line02.

Point02 and line02 represent a sample point within the proposed courtyard. You
now want to replicate point02, and hence line02, to represent a grid of points
within the courtyard.

Exercise: Create a grid of points from the base point


1

In the GenerativeComponents task, click the Edit Feature tool.

Click on point02.
You are going to change the single XTranslation value to a Series.

Type into the XTranslation expression field:


Series(5,10,1)
How many points are you creating here? And what are their names?

Copy and Paste the expression Series(5, 10, 1) into the YTranslation and
ZTranslation fields field and press Enter.

Fit View.

Reactors and Object Operators

106

Copyright 2009 Bentley Systems, Incorporated

Jan-10

Object Operators

Select the Transaction File tab and Unplay all transactions.

Play all remaining transactions.

As you replicate point02, line02 is also replicated.


8

Click the Toggle Replication tool and select point02 in the Symbolic view.
You have a list of points, where each point has a corresponding
YTranslation for each XTranslation. You want a rectangular array of points
and lines, where, for each XTranslation, you iterated through all values of
YTranslation.

Select the Transaction File tab, click Record User Changes.

In order to see what you created, you need to suppress the display of some of the
intermediate construction. To make the length of the vertical lines (line02) more
readable, you can display the EndPoint using the Toggle is Construction tool, then
use the Toggle Visibility of Construction tool.

Jan-10

Exercise: Display options

107

Copyright 2009 Bentley Systems, Incorporated

Reactors and Object Operators

Object Operators

In the GenerativeComponents task, click the Toggle Is Construction tool.

Select point02 and line01 in the Symbolic view to make these elements
Construction elements.

Before and after

Construction elements are shown dashed.


3

In the GenerativeComponents task, click the Toggle Visibility of


Construction tool.

Reactors and Object Operators

108

Copyright 2009 Bentley Systems, Incorporated

Jan-10

Object Operators

Select point02 and line01 in the Symbolic view.

The points representing the courtyard roof points (point02) are fixed in
the X and Y using the Series function. You will move the point
representing the tree (point01).
5

Click the Move Feature tool and select point01s XY handle.


Remember that the red line is X, the green Y and the cyan is Z.

Selecting a handle

Jan-10

109

Copyright 2009 Bentley Systems, Incorporated

Reactors and Object Operators

Object Operators

Move point01 to the center of the vertical lines.

Select the Transaction File tab, click Record User Changes.

Click Save.

You can toggle:

Replication - Turn on/off all replication combinations.

Visibility - Turn on/off element in view (still visible in Symbolic Diagram).

Is Construction- Turn on/off whether an element is a construction element.

Visibility of Construction- Turn on/off display of construction element.

Reactors and Object Operators

110

Copyright 2009 Bentley Systems, Incorporated

Jan-10

Module Review

Deferred Dynamics - Turns on/off the Dynamic response in the view. Not used
very often, sometimes helpful when working with large models.

Deferred Update - Turns on/off prompt for a change as a Transaction save.


Helpful when you want

Visibility of Handles - Turn on/off display of point handles.

Extra Exercises
Try to control the radius of a circle with a proxmity of a point. The closer the point
the lower the radius. Then use a Series to replicate the circle in a squre grid and
then test with moving the point.

Module Review
Now that you have completed this module, lets measure what you have learned.

Questions
1

Describe the Distance function?

Evaluate: Line01.Length < 3 ? A:B


What is returned if Line01.Length is 5?

Toggle Display Options can be found where in the interface.

Answers

Jan-10

A function that returns a double representing the distance between two


IPoints.

111

Copyright 2009 Bentley Systems, Incorporated

Reactors and Object Operators

Tips from this module

Tools > Toogle Feature Settings or the seventh icon in the Main task.

Tips from this module


1

Use variables and associations to produce real-time feedback of a designs


behavior.

Use numerical expressions within expression fields.

Understand and apply object operators inside expresssion fields.

You can Copy and Paste from one expression field to another.

Use Toggle Display option where helpful. Remember they are toggles and
can easily turned on and off.

Use Auto-completion to help find dot properties of a feature.

Reactors and Object Operators

112

Copyright 2009 Bentley Systems, Incorporated

Jan-10

Simple Reactor and Fabrication


Module Overview
In this module you will use the reactor.dgn file to create a responsive roof, and
then examine fabrication techniques. You will get the roof to react to the location
of a point beneath it. So far we have learned basic tools now we will examine the
end result of a working prototype and test it.

Module Prerequisites

Knowledge of Functions and Sets

Module Objectives
After completing this module, you will be able to:

Create B-Spline Surfaces from points

Break up a B-Spline Surface into Polygons

Look at Fabrication Planning techniques

Label Polygons

Module Glossary
Working Prototype
Working prototypes are functioning prototypes developed for the purpose of
proving and testing a concept and design. Working prototypes are not about

Jan-10

113
Copyright 2009 Bentley Systems, Incorporated

Simple Reactor and Fabrication

Your GC Workflow

speculative research or evaluating which is the best theory. It is about having an


already resolved concept and initial design and moving forward to the next stage
which is refining + building and testing a functioning prototype.

CONCEPT + PREPARATION
You will first need to evaluate design challenges and pick one that suits your
interest. You will then need to prepare a method to achieve the desired goal and
determine variables needed. Next an examination of what will be replicated and
what properties you can use for each successive stage. Describe your transaction
names to give yourself a direction to take when you start with GC.

DESIGN
During the Design process you will actually construct your basic GC file.

FABRICATION
Creating a Fabrication plan is essential to a working prototype. Use Fabrication
Planning tools in GC to assist you.

TESTING
Testing is a key step in evaluating a working prototype. The aim is to produce a
physical prototype using 3D Printing, Laser Cutting or other methods.

B-Spline Curve or Surface


B-spline curves and surfaces are mathematically generated geometry that
maximizes smoothness, while control points are minimized and provide local
controllability. Since they do not have resolution like a faceted surface, the curves
and surfaces remain smooth at all zoom levels.

Your GC Workflow
So far you have learned enough to start to create a workflow.
1

Think about the points and coordinate systems you need

Minimize the number of points and coordinate system by using


replication, where possible.

Simple Reactor and Fabrication

114

Copyright 2009 Bentley Systems, Incorporated

Jan-10

Creating a Responsive Surface

Think about the variables you need. Create those first.

Use Names for features and transactions.

Use geometry to your advantage by using properties of existing geometry


as inputs to new geometry.

Use Functions to control geometry and associations better.

The next exercise will take our existing work and build on it to create the
beginning of a working prototype. This prototypical roof will respond to in height
to a single vertical line under the roof. Essentially, you will add the surface and
move a tent pole under a tent and take notice of the different surfaces that
tent makes.

Creating a Responsive Surface

Exercise: Adding a surface


1

Continue in reactor.dgn, and in the GenerativeComponents task, click the


Create Feature tool.

Scroll to BSplineSurface in the Feature Type list, expand it, and then
expand the ByPoles update method.

The ByPoles update method expects a rectangular array of points in order


to create a B-spline surface.
3

Place the pointer in the Poles expression field, press and hold the Ctrl key,
and then select any line in the Geometric view until the name of the
feature appears in the input field.
For example, {line02[2][3]}.

Jan-10

115

Copyright 2009 Bentley Systems, Incorporated

Simple Reactor and Fabrication

Creating a Responsive Surface

You have selected an individual point but you want the entire 2D array
(or, collection of collections). You need to remove the indexs [2][3] and
add .EndPoint

This input property is also expecting a collection, and to anticipate this,


has added an opening { and a closing }. As line02 is already a collection of
collections, you do not need the curly braces and can remove them.
4

Press Enter to confirm the selection.


Once sufficient inputs have been defined, in this case the Poles, the OK
button is enabled.

Click OK and the B-Spline Surface is created.

The surface is displayed in wireframe.


6

Click and hold the View Display Mode icon and select Smooth.

Simple Reactor and Fabrication

116

Copyright 2009 Bentley Systems, Incorporated

Jan-10

Fabrication

Exercise: Testing the model


1

In the GenerativeComponents task, click the Move Feature tool.

Click point01.

You now have a responsive surface using only five features; baseCS,
point01, point02, line01, line02, bSplineSurface01.

Optional Exercise:
1

Place a Point ByUVParametersOnSurface and replicate with a Series.

Fabrication
So how would you build such a roof? GC has a FabricationPlanning feature to help
in this process. The FabricationPlanning feature has many Update Methods, you
will learn about the LayoutPolygons method. You will first create points in the
Surface and then you will turn off the display of the B-Spline Surface and use the
points to create polygons.

Exercise: Creating the Polygons


1

Continue in reactor.dgn, and select Create Feature and select Points,


ByUVParametersOnSurface, with the following:
Surface: bsplineSurface01

Jan-10

117

Copyright 2009 Bentley Systems, Incorporated

Simple Reactor and Fabrication

Fabrication

U: Series(0,1,0.2)
V: Series(0,1,0.2)
This Series controls the granularity of the polygon mesh. Later you can
come back and change the series to add more points, for example,
Series(0,1,0.1)
2

Select Toggle Replication Styles and select the point you just created.

In the GC dialog select Toggle Visibility.

Click on the B-Spline Surface to turn it off.

Only the Point03 instances are visible.


5

Click on Create Feature and select Polygon, with the Update Method
ByPointGrid.

In the Point expression field select Point03 in the Symbolic View and click
OK to create.

If you select point03 in the geometric view then you get an instance of the
point, for example, point03[1][3]. In this case, simply remove (delete) the
instancing, so it should just be point03.

Simple Reactor and Fabrication

118

Copyright 2009 Bentley Systems, Incorporated

Jan-10

Fabrication

To check for planarity of the polygons, select Edit Feature and select a
polygon.

Turn on Show Settings Properties.

In the Color field insert the following:


polygon01.OutOfPlane>0.1?4:0
This says if the polygon instance extends out of its average plane by more
than the maximum distance of 0.1 units, make it yellow (color 4).
otherwise make it white (color 0).

10 Move Point01 and see what happens.

OutofPlane is dynamic too.


11 Click the right mouse button to stop the action.
12 Select Create Feature and select the CoordinateSystem feature type.

Select the method as AtModelOrigin, with the following:

Jan-10

119

Copyright 2009 Bentley Systems, Incorporated

Simple Reactor and Fabrication

Fabrication

Model: UnFoldModel
13 Name this new Coordinate System csUnfold.

This will create a new Model and open a new view.


14 Select Create Feature and choose FabricationPlanning, with the Update

Method of LayoutPolygons and use the following:


CoordinateSystem: csUnfold
Polygons: polygon01
XSpacing: 2
YSpacing: 2
15 Click OK.

Unfolded polygons show in the new view.


16 To see the labels, turn on Construction Visibility and then click on any

polygon in the Unfold view.

Simple Reactor and Fabrication

120

Copyright 2009 Bentley Systems, Incorporated

Jan-10

Module Review

Optional Exercise
1

Try the UnfoldPolygonIntoPlanarStrips Update Method for


FabricationPlanning.

You can also turn the B-Spline surface to turn it on and use the Update
Method SurfaceDevelopmentPanels.

Module Review
Questions
1

A Working Prototype is about proving and testing a _______ and ______.

True or False: A B-Spline Surface and a Mesh of polygons are the same
thing.

Answers

Jan-10

A Working Prototype is about proving and testing a concept and design.

False. B-Spline Surfaces are mathematically generated while polygonal


meshes are geometrically generated.

121

Copyright 2009 Bentley Systems, Incorporated

Simple Reactor and Fabrication

Tips from this module

Tips from this module


1

To call a list (or a list of lists) simply call the feature itself without any
additional syntax. For example, Point01 not {Point01} or Point01[0].

Basic B-Spline surfaces can be built from points, but other methods exist,
for example create the edges of a surface and use the
FromBoundaryCurves update method.

You cannot build a B-Spline surface in real life unless you use a low
stiffness material like the tensile membranes used on the Main Terminal
of Denver International Airport. If you want build out of glass and steel
then you will need to explore the FabricationPlanning feature or later
script your own.

Simple Reactor and Fabrication

122

Copyright 2009 Bentley Systems, Incorporated

Jan-10

Creating a Generated Feature


Type
Module Overview
A Generative Component or Generated Feature Type is a feature type, such as a
group of lines, points, etc, that you create yourself and can use like any other
feature type. The tool to create a generated feature type works more like a
Wizard than a standrad tool. The Generated Feature Type is similar to the
MicroStation Cell or AutoCAD Block, but with more power.

Module Prerequisites

Basic understanding of Features, Functions and Update Methods

Module Objectives
After completing this module, you will be able to:

Jan-10

Define a generated feature type

Create a generated feature type

Define inputs and outputs

More work with graph variables

123
Copyright 2009 Bentley Systems, Incorporated

Creating a Generated Feature Type

Module Glossary

Module Glossary
Generated feature type
A generated feature type can be compared to a MicroStation cell. A cell is a
complex element, composed of a group of elements, that is stored for repeated
placement. However, a generated feature type can contain a graph variable and
all references to that variable will change when the component changes.

Input
You begin to create a generated feature type by defining inputs. Inputs are what
need to be in place before you can place a generated feature type.

Replication and Generated Feature Types


If you have a generated feature type comprised of a line drawn between a start
point and an end point, when you place this feature it would respond to a single
start point and a single end point. However, if you make features within it
replicatable, it can respond to a series of start points and end points. The
resulting generated feature type would be a set of lines.

Defining a Generated Feature Type


GenerativeComponents captures and graphically present both design
components and the abstract relationships between them. Once the underlying
logic and design relationships have been defined, a designer can create new
options without manually building, or rebuilding, a detail design model for each
scenario.
This lets GenerativeComponents go beyond making explicit geometry; it can
capture design intent in a re-executable form.
Other considerations are the complexity of a new Feature Type. There may be
relative advantages in having a few complex but very capable types of Features,
or many separates Feature types each with clearly-defined behavior. This
depends on whether the Feature is for use by an individual or as part of library

Creating a Generated Feature Type

124

Copyright 2009 Bentley Systems, Incorporated

Jan-10

Creating a Generated Feature Type

used within a large organization where conventions and standard may be


important. Once created the new Features can be used, shared among different
transaction files, computers or across the organization.

Creating a Generated Feature Type


Inputs and Outputs
Inputs are what are required to place the geometry in a model. Outputs are
everything that is created. So a generated feature type is similar to a geometric
function.

The first step is to select the inputs of the new Feature. This is best accomplished
by looking at the symbolic diagram for features that act as inputs. Once you have
elected to create a new Feature, the symbolic diagram turns grey. This is done so
the system can highlight the Feature tree based on the input you select. This

Jan-10

125

Copyright 2009 Bentley Systems, Incorporated

Creating a Generated Feature Type

Creating a Generated Feature Type

helps to visualize the components that are part of the new Feature and which
parts are becoming the inputs.
The outputs are everything that is downstream from the inputs in the symbolic
diagram. It is best to start by selecting the inputs if one knows them as then one
can immediately see whether the selection is sufficient to include all the desired
outputs (where the outputs are the new Feature one is trying to create). The
system automatically selects any input necessary in addition to the selected
inputs based on the associated Features. For instance if a StartPoint for a Line is
selected as the input the Line is automatically becoming an output. But since the
Line also relies on the EndPoint it is selected as a suggested input by the system
as well.
Ideally you want minimum inputs to maximum outputs. This would be the case
when you have a complex model, but only you want to experiment with certain
features at one time.

Nested Features
Features created by users can also form the basis of a new Feature with
previously user-created Features inside. This principle is referred to as nesting
and offers powerful options of structuring complex designs into parametric subcomponents reused at different levels. For instance a wall element can be is
made up of several instances of a glass tile component. Those components can be
assembled to form another building part. Parametric adaptability is preserved at
all levels.

Creating a Generated Feature Type

126

Copyright 2009 Bentley Systems, Incorporated

Jan-10

Creating a Generated Feature Type

Other Options

If the Feature is supposed to be replicatable it is necessary to check the


Replicatable field for those inputs that will be able to accept lists and single values
alike. Check the field to select it.
The Optional fields allows you to define the input/output fields as an option
during Feature creation and to give them a Default Value to start out with. These
are input fields that appear in blue once the Feature is used.
In the output settings the Construction property allows you to make a geometry
Feature of the new Feature hidden by default, but visible when the Construction
toggle button is pressed.
Checking the Internal box makes the Feature permanently invisible but it still is
being calculated internally.
The check box Replace the current Feature with an instant of this type, named:
causes the selected Feature outputs to be replaced with a single symbolic model

Jan-10

127

Copyright 2009 Bentley Systems, Incorporated

Creating a Generated Feature Type

Creating a Generated Feature Type

node of the type of the new Feature with the specified name. This is useful to
collapse large symbolic trees into more compact dependency trees. In order to
re-define the Feature upon Feature creation a new transaction step is being
generated that captures the model at its stage just before the replacement.
Rewinding the transaction player back to this point allows the recovery of all the
output elements for re-defining a new version of the user-defined Feature.
If a complicated Feature is being recreated many times over the course of a set of
design iterations, it can become very tedious to refill all the fields and property
names over and over. In this case, you can use the function, which allows you to
use a previously defined user Feature as a starting point to populate all input and
output fields with the settings applied previously and allows you to adjust their
settings for the new version accordingly without having to start from scratch

Exercise: Create a GenerativeComponents feature


1

Open the Pyramid.dgn file containing the transactions that create a foursided pyramid.

Click Play all remaining transactions.

Select Utilities > Manage Feature Types > Generate Feature Type or select
the icon from the GC task.

Type Pyramid_Four in the Type name field.


Start all like feature names with an identifier. The appending the word
_Four indicates that this is a four sided pyramid. Identifiers will help you
locate generated features later in the Feature Types list.

Creating a Generated Feature Type

128

Copyright 2009 Bentley Systems, Incorporated

Jan-10

Creating a Generated Feature Type

In the Input Properties section of the dialog, click Select from Model.

You will use the polygon of the pyramid as inputs.


That means that you must place a polygon before you can place
Pyramid_Four into a model. This is critical to understand.
6

In the Symbolic view, select the polygon01.


The feature becomes blue when selected. Associated features and the
GraphVariable, and their association lines become dashed and blue. This
indicates that you also need to select these dependent features.

Click on the GraphVariable.

Click OK in the Selecting Input Properties dialog.

The features are added to the Input Properties section of the dialog.

Jan-10

129

Copyright 2009 Bentley Systems, Incorporated

Creating a Generated Feature Type

Creating a Generated Feature Type

Enable the Replicatable check boxes for all of the inputs.

10 In the Output Properties section, enable the Construction check boxes for

the coordinate system, line01, point05 and ptTopPoint.

If Construction is enabled you wont see that output when you place the
GenerativeComponents. It will exist, it is just not visible.
The Dynamic property allows you to modify the feature on the fly. This
column is enabled by default.
11 Click OK.
12 Save your transaction.

The Replace the current features with an instance of this type option lets you
replace the features that comprise the drawing of the GenerativeComponent
with the actual GenerativeComponent you are creating. Initially it is a good
practice to save a copy of the pre-GenerativeComponent elements. Saving this
way gives you the greatest flexibility later.
Once a user creates a Feature it is placed in the Create Feature list like all other
Features that already exist. Placing a user-generated Feature is accomplished
using the ByDefault Update Method. For a manually created Feature, the

Creating a Generated Feature Type

130

Copyright 2009 Bentley Systems, Incorporated

Jan-10

Creating a Generated Feature Type

ByDefault, ByFunction, ByImportedData, CopyTransformGeometricContents,


MirrorCopyGeometricCOntentsAboutPlane, SelectFeaturesWithinRange methods
are the Update Methods available.

Exercise: Place the GenerativeComponent feature


1

From the Main Menu, select File > New.

Place 4 points in the Geometric view.

Select Create Feature and choose Polygon with Update Method


ByVertices, and choose the four points as the vertices for the polygon.
This polygon will act as the input of the Pyramid_Four generated feature
type.

Scroll through the Feature Type list to Pyramid_Four and expand it.

The GenerativeComponent feature is included in the feature list. It is


saved as a .dll and can be found in the C:\Documents and Settings\All
Users\Application
Data\Bentley\MicroStation\WorkSpace\Projects\Examples\GC_Default\A
ssemblies folder.
5

Expand the ByDefault update method.

Type in a pyramid height, for example 2 or later you can use the variable,
PyramidHeight.

Place the pointer in the point expression field, press and hold the Ctrl key,
and select the 4 points.

Click OK.
You now have a GenerativeComponent in the model.

Select the Transaction File tab, click Record User Changes and replace the
default name with a more meaningful name, if desired.

When sharing a GenerativeComponent you must remember to provide the .cs file
or the GCT that generates the unique feature type (more common procedure). In

Jan-10

131

Copyright 2009 Bentley Systems, Incorporated

Creating a Generated Feature Type

Alternate Method for Creating Graph Variables

this case, it is a simple matter of supply the transaction to create the Pyramid and
create the generated feature type.

Exercise: Variables as part of a GenerativeComponent feature


1

Expand the new transaction and then expand Pyramid_Four01.

Look at the PyramidHeight expression field.

It is an int value and you cannot change the height using the variable like before.
The Pyramid_Height GraphVariable is part of the GenerativeComponent feature,
but you must now change it by using the Edit Feature tool and adjusting the
height expression. A graph variable belongs only to a particular [symbolic] graph.

Alternate Method for Creating Graph Variables


You can create a new graph variable for this graph and apply it to the pyramid GC
feature so the height can once again be changed dynamically. THis method is the
Feature method, that using the feature type: Graph Variable.

Exercise: Create a graph variable for this graph


1

Select Create Feature

Select feature type Graph Variable.

Use the Update Method of: EvaluateExpression

In the Value field, type in 5.


This is the initial value.

Set the following:


RangeMinimum: 1
RangeMaximum: 10
RangeStepSize: 1

Name the variable PyramidHeight (in the Name of New Feature filed).

Select the Transaction File tab, click Record User Changes.

Click the Edit Feature tool.

In the Symbolic view, click on the Pyramid_Four feature.

Creating a Generated Feature Type

132

Copyright 2009 Bentley Systems, Incorporated

Jan-10

Module Review

10 Remove the value from the PyramidHeight expression field, press the Ctrl

key, and then click the new GraphVariable in the Symbolic view.
11 Click Apply.

You can now use the variable to change the height. That means that if you place
multiple Pyramid_Four GenerativeComponent features in a model and link them
to the graph variable, you can control all their heights at once.

Module Review
Now that you have completed this module, lets measure what you have learned.

Questions
1

When generating a feature type, what are the inputs?

What are outputs?

What is Replication?

Answers
1

Inputs are what need to be in place before you can place a


GenerativeComponent feature.

Outputs are everything that gets created.

It lets generated features respond to a series of inputs, resulting in a more


complex feature.

Tips from this module

Jan-10

A Generated Feature Type is critical to advanced usage of GC.

Carefully select Inputs based on what you will use as the placement
feature. For example, we would place the pyramid by its base so our input
was a four-sided polygon.

Carefully select the outputs for what will be visible. If a feature is not
needed visually, then set the feature to Construction.

133

Copyright 2009 Bentley Systems, Incorporated

Creating a Generated Feature Type

Tips from this module

Creating a Generated Feature Type

134

Copyright 2009 Bentley Systems, Incorporated

Jan-10

Law Curves
Module Overview
This module discusses law curves and how to implement them. LawCurves in
combination with a LawCurveFrame, are a means for interactively defining an
array of variables.
Law curves are very flexible. If there is geometry you cannot create with a sketch
or other curves, a law curve often represents the only way to do it. The Law Curve
function gives you many different ways of defining curves or surfaces.

Module Prerequisites

Knowledge of Features, Functions and Transactions

Module Objectives
After completing this module, you will be able to:

Jan-10

Understand relationships

Create a Law Curve frame

Create control points

Establish a Law Curve

135
Copyright 2009 Bentley Systems, Incorporated

Law Curves

Module Glossary

Module Glossary
Law Curve
A Law Curve is a feature, which has a level of control over its properties,
represented in a Law Curve Frame or graph. The X and Y values of the graph are
both properties of the Law Curve. When you draw a graph you create an X
direction and a Y direction. The X direction is the independent and the Y direction
is the dependant. X can go where it likes, but Y is dependent on where X is, as its
always perpendicular to it.
Law Curves are always created in the XY Plane and hence are 2D only.

String
When you see the word String, you are being asked to provide your own text. Use
quotation marks to provide your own text space. You can type anything you
want, as long as it is enclosed by the quotation marks.

Plane
Each side of a cube is a different plane. There is the Top (the 2D plane), Front and
Side. Everything you draw is dependant on the plane. If you rotate the plane,
everything on it rotates. A plane, unlike the cube, is actually infinite in size. You
can create a series of planes, with each one representing a floor of a building.
Moving a plane would move everything on that floor with it.

Order
A B-spline curves Order defines the curves distance from the control polygons
poles. The greater the order number, the further the curve can lie from the poles
of its control polygon. The order describes smoothness. The higher the order, the
smoother the curve.

Law Curves

136

Copyright 2009 Bentley Systems, Incorporated

Jan-10

Law Curves and Relationships

Dependent Variable
Dependent Variable is a property of a feature. The Dependent Variable does not
have to be defined by a number or a Series, you can define it by assigning the
property.Variable. In a graph, points on the dependent Y-axis can vary as the Law
Curve position alters. A DependentVariable means that Y points can change but
you don't know what theyll change to.

Law Curves and Relationships


A law curve can help describe the relationship between the X and Y axes on a
graph. So far we have been able to control the behaviour of one feature by using
input from another feature.
In the following example, the distance between the points (the Y axis) is
dependent on the law curve, which is dependent on the number of points on the
curve (the X axis), which is independent.

Here the distance between the points is equal but you can change that by
changing the straight line to a curve.

Steps to Create a Law Curve


There is a series of steps when creating the curve.
1. Create a new coordinate system.
2. Optionally create a plane for the frame.
3. Create the law curve frame.

Jan-10

137

Copyright 2009 Bentley Systems, Incorporated

Law Curves

Steps to Create a Law Curve

4. Create control points in the Law Curve Frame.


5. Establish the curve in the Law Curve Frame.
6. Use the curve in the Law Curve Frame as an input to other geometry.
The baseCS coordinate system was used for the geometry. The Law Curve will
have its own coordinate system so you can control the law curve independent of
the geometry.
The following exercises will have you create a Law Curve to control the radii of a
number of circles at once.

Exercise: Create a new coordinate system for the Law Curve


1

Create a New File and name it Law Curve.dgn

In the GenerativeComponents task, click the Create Feature tool.

Scroll to CoordinateSystem in the Feature Type list, expand it and then


expand the AtModelOrigin update method.
The ModelName property requires a string. Use quotation marks around
it, or you will receive an error.

Law Curves

138

Copyright 2009 Bentley Systems, Incorporated

Jan-10

Steps to Create a Law Curve

Type in the ModelName LawCurve1 and name the coordinate system


csLawCurve.

Click OK.
Another view window containing the LawCurve coordinate system opens.
This is a separate DGN model.

Select the Transaction File tab, click Record User Changes.

Law Curves are always created in the XY Plane. You can either create a Plane
ByCartesianCoordinates or you can use the coordinate system you created and
specify the XYPlane property.

Create the Law Curve frame


This is where you need to think about numbers. You will create a Law Curve
Frame with 20 points in X and 10 in Y.

Jan-10

139

Copyright 2009 Bentley Systems, Incorporated

Law Curves

Steps to Create a Law Curve

How many points will you need? A good rule is to have a few more than you tink
you need. For example, if you need to control 10 lines with a law curve use 20
points in both dimensions.

Exercise: Create the Law Curve frame


1

In the GenerativeComponents task, click the Create Feature tool.

Scroll to LawCurveFrame in the Feature Type list, expand it and then


expand the FromPlane update method.

Place the pointer in the Plane expression field, press the Ctrl key, and
select csLawCurve, type a period and select XYPlane.
csLawCurve.XYPlane

Enter the following dimensions, which are the maximum size of the Law
Curve Frame:
XDimension: 20
YDimension: 10

Now enter the axes:


XAxis: Series(0,20,1)
YAxis: Series(0,10,1)
The X axis is the maximum number of geometric objects we control. The Y
axis is the maximum value to control.

Enter a descriptive name in the XAxisName and YAxisName fields to


identify the axes for future reference.
XAxisName: Number of Circles
YAxisName: Radius of Circles

Law Curves

Click OK.

Select Create Feature and select Point with Update Method OnPlane.

140

Copyright 2009 Bentley Systems, Incorporated

Jan-10

Steps to Create a Law Curve

Place a point at:


Plane: csLawCurve.XYPlane
XTranslation: 0
YTranslation: 1

10 Place another point at:


Hint: Use the Create Copy button to speed up the process.

Plane: csLawCurve.XYPlane
XTranslation: 5
YTranslation: 5
11 Place a third point at:

Plane: csLawCurve.XYPlane
XTranslation: 10
YTranslation: 5
12 Place a fourth point at:

Plane: csLawCurve.XYPlane
XTranslation: 20
YTranslation: 7
13 Select the Transaction File tab, click Record User Changes.

Jan-10

141

Copyright 2009 Bentley Systems, Incorporated

Law Curves

Establish the Law Curve

An alternate method of placing these points is to Ctrl + left click on the coordinate
system plane and then place the points freely. This lets you skip freeing the points
later.

Establish the Law Curve


Now you will create a Law Curve through the points just place in the
LawCurveFrame.

Exercise: Establish the Law Curve


1

In the GenerativeComponents task, click the Create Feature tool.

Scroll to LawCurve in the Feature Type list, expand it and then expand the
ByControlPoints update method.

Place the pointer in the LawCurveFrame expression field, press the Ctrl
key, and then select the Law Curve frame.

Place the pointer in the ControlPoints expression field, press the Ctrl key,
and then select the four points in the frame, point01, point02, point03
and point04.

Place the pointer in the CurveControl expression field, type in


CurveOption then a dot (period) and select ByPoints.

Place the pointer in the Order expression field, and type 3.


The IndependentVariable, X, is something you can usually define as a
number or a Series. You previously defined it as a series.

Law Curves

Place the pointer in the IndependentVariable expression field, and type


Series(0, 20, 1).

142

Copyright 2009 Bentley Systems, Incorporated

Jan-10

Establish the Law Curve

Click OK.

Select the Transaction File tab, click Record User Changes.

The next step is to create geometry to tie into the Law Curve and then the Law
Curve will control this geometry. You will return to work in the Default model.

Exercise: Creating the controlled Geometry


1

In the GenerativeComponents task, click the Create Feature tool.

Scroll to Point in the Feature Type list, expand it and then expand the
OnPlane. Create two points and use the same for both (these will be
point05 and point06):
Plane: baseCS.XYPlane
XTranslation and YTranslation: anywhere

Click OK for each point.

Select Create Feature and choose Line, ByPoints. Use the last two points
created.

Select Create Feature and choose Point, ByNumberOfBaysAlongCurve


with the following (this will be point07):
Curve: line01
NumberOfEquallySpacedBays: 20
StartFraction: 0
EndFraction: 0

Jan-10

143

Copyright 2009 Bentley Systems, Incorporated

Law Curves

Establish the Law Curve

IncludeStart: true
IncludeEnd: true
We will now tie a piece of geometry to the Law Curve.

Select Create Feature and choose Circle, ByCenterRadius with the


following:
Center: point07
Radius: LawCurve01.DependentVariable
Support: baseCS.YZPlane

Circles seen from the Front view

An optional step here is to create a PLane. Select Create Feature and


choose Plane, ProjectOnToCurvewith the following:
Curve: line01
PointToProjectOnTo: point07
The Plane is a useful construct for creating other geometry.

Note how the profile of the circles is the same as the Law Curve itself! This s the
connection from the Law Curve to the geometry. Once again we use a existing
feature to act as the input of a new feature.

Law Curves

144

Copyright 2009 Bentley Systems, Incorporated

Jan-10

Establish the Law Curve

Before you can test the Law Curve we must free the point in the Law Curve Frame
so you can move them.

Exercise: Free the Law Curve points


1

Select Edit Feature and click on any one of the points in the Law Curve
Frame.

In the Edit Feature tab, right click on the numerical value for X and select
Free.

Repeat for Y.

Repeat for all other points.

In addition, you can Free these points from the Coordinates dialog.

Exercise: Testing the Law Curve


1

Use the Move Feature tool to move one of the two inside points in the
Law Curve Frame.

Note the changes to the radius of the circles.


You may need to rotate the geometric view to see this better.

Optional Exercises:
1

Suppress the Circle Transaction and try other Features and see if you can
control them with the Law Curve.
For example, Lines or a B-Spline Curve.

Try adding to your circle geometry by covering it with polygons. First use
the Point ByParameterAlongCurve with the T value set to Series(0,1,0.05).
Why is the Series increment set to 0.05?
Second, add a Polygon with Update Method ByPointGrid.

Jan-10

145

Copyright 2009 Bentley Systems, Incorporated

Law Curves

Graph Variables and Law Curves

Graph Variables and Law Curves


You have used a Series of definite points to define a Law Curve Frame. The
number of points, X Independent, was a maximum of 20. If you want to vary this
value, you can create a graph variable.

Exercise: Create a graph variable for the X axis


1

Select File > Save As ... and save the file with a new name.

Select Create Feature and choose Graph Variables with Update Method
EvaluateExpression.

Name the variable Point_On_Line.

Change the Value from Null to 5.

Set the LimitValueToRange to true.


You are going to specify the range of values that can be applied to this
variable as well as the increments in which it can be increased or
decreased.

Set the following:


RangeMinimum: 0
RangeMaximum: 100
RangeStepSize: 1

Select the Transaction File tab, click Record User Changes.

Exercise: Apply the variable to the frame


1

In the GenerativeComponents task, click the Edit Feature tool.

Edit the Law Curve Frame to the following values:


XDimension: Point_On_Line
XAxis: Series(0,Point_On_line,1)
You can apply the same theory to Y later on.

Law Curves

146

Copyright 2009 Bentley Systems, Incorporated

Jan-10

Module Review

Click Apply.

Click the Variables tab and use the slider to change the X axis value and
note the number of Circles shown.

For even more control, use the Edit Feature and replace the following:
lawCurve01 > Independent Variable to: Series(0,Point_On_Line,1)
point07 > NumberOfEquallySpacedBays to: Point_On_Line

Module Review
Now that you have completed this module, lets measure what you have learned.

Questions

Jan-10

What is a Law Curve?

On which plane do they exist?

What is a String?

What is a Plane?

147

Copyright 2009 Bentley Systems, Incorporated

Law Curves

Tips from this module

Answers
1

A Law Curve is a Feature, which has a level of control over its properties,
represented in a Law Curve Frame or graph. The X and Y values of the
graph are both properties of the Law Curve. When you draw a graph you
create an X direction and a Y direction. The X direction is the independent
and the Y direction is the dependant. X can go where it likes, but Y is
dependent on where X is, as its always perpendicular to it.

Law Curves are always created in the XY Plane.

When you see the word String, you are being asked to provide your own
text. Use quotation marks to provide your own text space. You can write
what you want, as long as it is enclosed by the quotation marks.

Everything you draw is dependant on the plane. If you rotate the plane,
everything on it rotates. A plane, unlike the cube, is actually infinite in
size. You can create a series of planes, with each one representing a floor
of a building. Moving a plane would move everything on that floor with it.

Tips from this module

Law Curves

Law Curves can make the application of a profile to geometry much


easier. The profile is your Law CUrve.

You can use a variable in the Series function! For example,


Series(0,myVariable,1). In fact, you can replace all three values with
variables.

Law Curves can be used to establish other relationships such the number
of points on a curve based on its overall length.

The way to connect a Law Curve to geometry is to use the Law Curve as an
input the geometry. By now, this should not be a surprise.

148

Copyright 2009 Bentley Systems, Incorporated

Jan-10

GenerativeComponents Import
and Export
Module Overview
You can import GenerativeComponents data to and export it from a database or
Excel using a transaction. Just as you create a transaction to create a feature, you
create a transaction to import or export. In addition, you can import and export
using MicroStation tools, which include most of the popular CAD formats
available.

Module Prerequisites

Basic Knowledge of Microsoft Excel

Knowledge about how to use and apply Features

Module Objectives
After completing this module, you will be able to:

Jan-10

Load the libraries for Excel

Use the correct syntax

Import from Excel

Export to Excel

149

GenerativeComponents Import and Export

Copyright 2009 Bentley Systems, Incorporated

Module Glossary

Module Glossary
Pre-compiled Assembly File (*.dll)
A DLL, or Dynamic Linked Library, is Microsofts implementation of the shared
library concept. DLLs provide the standard benefits of shared libraries, such as
modularity. Modularity lets you change code and data in a single, self-contained,
DLL. It can then be shared by several applications without any change to the
applications themselves. As with EXEs, DLLs can contain code, data, and
resources, in any combination.

Microsoft Excel
Microsoft Excel is a spreadsheet application. It has calculation and graphing tools,
so you can compute any type of equations and use formulas with data. It uses the
*.xls file as its native format. The *.csv file is the ASCII text format of the *.xls file.

Spreadsheet
A spreadsheet is a rectangular table, or grid, of information. The word came from
spread in its sense of a newspaper that covers two facing pages, extending across
the center fold, treating the two pages as one large page. The compound word
spread-sheet came to mean the format used to present bookkeeping ledgers,
with columns for categories of expenditures across the top, invoices listed down
the left margin, and the amount of each payment in the cell where its row and
column intersect, which were traditionally a spread across facing pages of a
bound ledger or on oversized paper sheets ruled into rows and columns in that
format.

Database
A computer database is a structured collection of records or data that is stored in
a computer system. A database usually contains software so that a person or
program can use it to answer queries or extract desired information. The term
database refers to the collection of related records, and the software is referred
to as the database management system (DBMS). When the context is ambiguous,
however, many database administrators and programmers use the term

GenerativeComponents Import and Export

150

Copyright 2009 Bentley Systems, Incorporated

Jan-10

Excel Import/Export

database to refer to both the data collection and the software that enables it to
be accessed.

Excel Import/Export
Before using the ExcelRange features, you must load the correct library.

Loading the Libraries for Excel

Jan-10

Exercise: Loading Assemblies


1

In the GenerativeComponents dialog, select Tools > Manage Loaded


Assemblies.

Click the Select Pre-compiled Assembly Files (*.dll) button.

Browse to C:\Program Files\Bentley\MicroStation


V8i\GenerativeComponents\Assemblies, select
Bentley.GenerativeComponents.Office.dll and click Open.

Click Load it and click OK.

Enable the Load Automatically in Future Sessions check box so this .dll can
load automatically when you launch GenerativeComponents.

Click Close.

151

GenerativeComponents Import and Export


Copyright 2009 Bentley Systems, Incorporated

Excel Import/Export

Import from Excel


The ExcelRange feature lets you import and export Excel data.

Syntax
A critical aspect of the using this feature is exact syntax, including case sensitivity.
The ExcelRead properties are as follows.

Workbook and File name: Use double quotes and double path separators
unless the Excel file is in the same folder as the .gct, then the path to the Excel
file is not necessary. For example:
C:\\spreadsheets\\my_point_data.xls

Sheet Name: Use double quotes to indicate which sheet within the file is
being read. For example, Sheet1

Range Address: Double quotes are required to indicate the range of cell to be
read into GC. Use standard Excel Range syntax. For example, A1:C4.

The ExcelWrite the properties are the same except the Value field.

Value indicates the feature on which to report, e.g., point01 or


bSplineCurve.Poles.XYZ.

Warning: Do not close Excel during the process, GC will do this.

Exercise: Using ExcelRange for importing Excel data


1

In the GenerativeComponents dialog, select File > Open Transaction File.

Open excel_read.gct from the ...\WorkflowSamples\excel folder.

GenerativeComponents Import and Export

152

Copyright 2009 Bentley Systems, Incorporated

Jan-10

Excel Import/Export

C:\Documents and Settings\All Users\Application


Data\Bentley\MicroStation\WorkSpace\Projects\Examples\GC_Default\g
ct\WorkflowSamples\excel.
3

Expand and review all the transactions.

The first transaction loads the correct .dll. The second loads the .xls file,
sheet and range. The third creates points based on the excel data. The
fourth creates a closed curve and the fifth reports the area of the curve
back to Excel.

Jan-10

Click Play All Remaining Transactions.

Review the Excel file that opens.

In the Excel spreadsheet, make any change you want to the range values
and then, in the GenerativeComponents dialog, unplay and replay all the
transactions to see the dynamic update.

153

GenerativeComponents Import and Export


Copyright 2009 Bentley Systems, Incorporated

Excel Import/Export

Export to Excel
The Export function is similar to the import function, except you need an existing
feature on which to report.

Exercise: Export to Excel


1

In the GenerativeComponents dialog, select File > Open Transaction File.

Open excel_write.gct.

Expand and review all the transactions.

The first transaction loads the correct .dll. The second creates point
features. The third creates a B-Spline Curve based on those points as
Poles. The fourth reports point coordinate data to Excel and the fifth
reports curve area data to Excel. The sixth transaction can be used to alter
the point data for testing.

GenerativeComponents Import and Export

154

Copyright 2009 Bentley Systems, Incorporated

Jan-10

Database Import/Export

Click Play All Remaining Transactions.

Review the Excel spreadsheet that opens.

A good practice in both of these examples is loading the correct .dll as the first
transaction. This is how you ensure that whoever runs the transactions will get
the correct results.

Database Import/Export
GenerativeComponents also includes facilities for accessing data stored in many
types of databases, generally, any kind of database supported by ADO.NET.
GenerativeComponents provides two general techniques for accessing
databases.
The first technique uses the Feature Types, DataImporter and DataExporter. The
second technique uses the GCScript classes, DataConnection and DataTable. The
first technique is generally easier to use, while the second technique is generally
more versatile. In both cases, the underlying implementation is based around
ADO.NET. However, you wont work directly with ADO.NETs classes.
For Access, you can construct DataTables using the standard table design tools in
Access.

Jan-10

The name and type of the columns of the data tables may directly match
properties of the associate Features, or can be mapped to the properties
using an SQL statement.

With a Script transaction, you can directly control access to a database, or


alternatively there are standard update methods for DataImporter and
DataExporter available for all Feature types.

When exporting Features to the database, GenerativeComponents


automatically populates the DataTables from the output of the selected
Features.

When importing data from the database, GenerativeComponents regenerates the required Features by automatically finding an update method
that matches the set of properties from the DataTable. This facility is not
limited to Features delivered with GenerativeComponents, but also applies to
a User Generated Feature, which, of course, was previously unknown to
GenerativeComponents at the start of an interactive session.

155

GenerativeComponents Import and Export


Copyright 2009 Bentley Systems, Incorporated

Image Capture

If the DataTable is constructed with a unique key, then you can interactively
edit the dataTable from within GenerativeComponents.

Both the DataImporter and DataExporter update methods support optional


GCScript functions which allow you to filter or modify data.

Image Capture
Besides the MicroStation methods for image capture (Utilities > Image >
Capture), there is another method of capturing an image from a view. The
Feature is called ImageCapture. This feature allows the capture of a sequence of
images of a specified window, dependant on the Update of a specified object.

Inputs

ViewNumber is the View number from which to capture image.

Image Height is in pixels.

DirectoryPath is the folder path as a string for saved images.

ImageFileSeedName is the Seed name, as a string, for images.

StartFrame (optional) default value is 0 is the frame number for first image
capture.

The RenderMode (optional) default value is Phong. This specifies Render


mode for captured images.

Driver object (optional) will specify the driver for image capture. Modification
of the driver object triggers image capture. The default value is null.

More detail on this later.

GenerativeComponents Import and Export

156

Copyright 2009 Bentley Systems, Incorporated

Jan-10

Module Review

Module Review
Now that you have completed this module, lets measure what you have learned.

Questions
1

What is an Excel range?

Which feature can be used for Excel import and export?

Answers
1

A range of cells in the form XX:YY.

ExcelRange.

Tips from this module

Jan-10

Excel provides a powerful way to control geomtery in GC.

Excel provides a powerful way to report on geometry in GC.

Syntax is very important here. Be careful.

Do not close the GC instance Excel until you close GC.

157

GenerativeComponents Import and Export


Copyright 2009 Bentley Systems, Incorporated

Tips from this module

GenerativeComponents Import and Export

158

Copyright 2009 Bentley Systems, Incorporated

Jan-10

Designing a Simple Tower


Module Overview
This module discusses and applies more advanced applications of features and
functions.

Module Prerequisites

Knowledge of Feature Types, Functions, and Transactions

Module Objectives
After completing this module, you will be able to:

Design Flexible Massing Models

Create a Building Floor Plates

Use Excel Import and Export in the design process

Module Glossary
Building Envelope
The building envelope is a critical component of any facility since it both protects
the building occupants and plays a major role in regulating the indoor
environment. Consisting of the building's roof, walls, windows, and doors, the
envelope controls the flow of energy between the interior and exterior of the
building. The building envelope can be considered the pathway for a building to

Jan-10

159
Copyright 2009 Bentley Systems, Incorporated

Designing a Simple Tower

Flexible Building Floor Plates

work with the climate, by responding to heating, cooling, ventilating, and natural
lighting needs.

Array
An array is a group of individual items.
A one-dimensional array looks like a simple linear list: {value1, value2, value3}.
A two dimensional array is a Matrix or Grid: {value1, value2, value3},{value4,
value5, value6}.
When a feature requires an input of an array, it is indicated by [].
When a feature requires an input of a single value, or an array, it is indicated by
([]).
These two approaches can also be combined []([]), meaning that the property
expects an array of points, but optionally can be given an array of an array of
points.

Transpose
Transpose is to: swap/reverse/switch/invert/reorder/rearrange/change. In
simple terms it swaps the rows and columns of a two dimensional array.
For example array {{A,B},{C,D}} becomes {{A,C},{B,D}}.

Flexible Building Floor Plates


You will build a floor plate, stack it to make several stories and then a building
envelope, or skin, using the GC features and principles learned so far.
Please note that you need Microsoft Office 2003 on your system to save the
metrics into a file.

Designing a Simple Tower

160

Copyright 2009 Bentley Systems, Incorporated

Jan-10

Flexible Building Floor Plates

Jan-10

Exercise: Getting Started


1

Create a new GCT file.

Click Create Feature and create a Graph Variable with Update Method of
EvaluateExpression. Name it Height with a minimum of 5, maximum of
100, and step size of 5, and make Limit Value to Range, true.

Save your transaction.

Place four, or more (go ahead, have some fun), XY planar points as the
building base.

Draw the height lines for the building using the Line Feature, with the
Update Method ByStartPointDirectionLength. Use the baseCS.Zdirection
for the Direction of the lines and the GraphVariable Height as the length.

161

Copyright 2009 Bentley Systems, Incorporated

Designing a Simple Tower

Flexible Building Floor Plates

Click the Create Copy button and change the point number to the next
point number (point01 to point02), keeping the other properties the
same.

Next you want to create Planes, one for each of the floors.
6

Use the Plane Feature, with the Update Method ByCartesianCoordinates.


The X and YTranslations define the position of the planes from the BaseCS.
You want the planes to be at the coordinate 15,0 from the baseCS. You
want a Plane on each floor of the building, so you have to use a Series to
define the position of each plane in the Z direction (start, end, increment),
or start at 0, end at GraphVariable Height, in increments of 5 meters.
CoordinateSystem: baseCS
XTranslation: 15

Designing a Simple Tower

162

Copyright 2009 Bentley Systems, Incorporated

Jan-10

Flexible Building Floor Plates

YTranslation: 0
ZTranslation: Series(0,Height,5)

The GraphVariable Height is now controlling the height of the lines and
the number of planes.
7

Save your Transaction.


Now you want to create a parametric relationship between the lines and
the planes. You want a point located at the intersection of the Lines and
the Planes.

Jan-10

Use the Point Feature with the Update Method


AtDirectionPlaneIntersection. Choose any of the planes, but remove the
incidence number in brackets. This means that you are dealing with all the
Planes, not just a specific Plane. Choose a line for the Direction.

163

Copyright 2009 Bentley Systems, Incorporated

Designing a Simple Tower

Flexible Building Floor Plates

You must do the same for the other lines.


9

Click the Create Copy button, change the line number to the next line
number, and then click Apply.

10 Save the Transaction.

Now you want to create a shape for each of the floors.

Designing a Simple Tower

164

Copyright 2009 Bentley Systems, Incorporated

Jan-10

Flexible Building Floor Plates

11 Examine (use Move Feature and put your cursor over one) the points on

the lines so far. They are arranged so that the instance increments on
each line. Points 5-8 instances rise in the Z direction.
If you drew this in a two dimensional array, or matrix, it would appear as
the following:

Point05
Point06
Point07
Point08

First Floor Polygon


Points

Second Floor Polygon


Points

Third Floor Polygon


Points

Point005[0]
Point006[0]
Point007[0]
Point008[0]

Point005[1]
Point006[1]
Point007[1]
Point008[1]

Point005[2]
Point006[2]
Point007[2]
Point008[2]

12 For all the floors you want to create a polygon from the vertices

point05[0] to point06[0] to point07[0] to point08[0] using the Feature


Polygon, with the Update Method ByVertices. Select in the Geometric
view.
Hint: Use the tool tips to help you select the points in order.

This only results in one floor. You can repeat the polygon, or use a built in
function to fix the data.
First you will remove the index information, the [1], from each point and
create a matrix of points. Then Transpose the matrix index of all points.
The matrix is read from left to right. This means that even though you
place the correct collection of points, it wants to create the shape up the Z
axis through Point05[0], Point05[1], Point005[2], Point05[3] instead. As a
result, you don't see the polygon you want.
You need to use the Transpose function. Transpose will change the Matrix
so that the rows are columns, and the columns are rows. Now when you
read the matrix from left to right, you get the points that match the
collection.
Remember, when you write the collection you take off the [i] instance
number to indicate that you want polygons on all the points, not just the
defined ones.
Note: The () round brackets are used to define functions like Transpose. The {}

curly brackets are defining the collection of points.


13 Select Edit Feature and change definition of polygon01, Vertices to the

following:

Jan-10

165

Copyright 2009 Bentley Systems, Incorporated

Designing a Simple Tower

Flexible Building Floor Plates

Transpose({point05,point06,point07,point08})

Polygons with Height set to 35

Polygons with Height set to 48

14 Save the Transaction.

Designing a Simple Tower

166

Copyright 2009 Bentley Systems, Incorporated

Jan-10

Flexible Building Floor Plates

Now that you have the polygons, you want to be able to create text for the area
calculations. First, create a new Coordinate System for the text.

Exercise: Adding Text


1

Use the Feature CoordinateSystem, with the Update Method


ByCatesianCoordinates.

Define the new CS (default name coordinateSystem01) as (17,5,0) from


the BaseCS.

Record the transaction and Save.

Now you can place the text field.


4

Use the Feature Text, with Update Method


ByPointOrPlaneOrCoordinateSystem.

For Placement, select coordinateSystem01.XZPlane in the Symbolic view.


You want the text to show the total area of all the floors. Because you do
not know what this will be, you need to use the property
polygon01.TotalArea. When you place a dot operator, you usually select
the property from a list. This time you need to enter the value yourself.
You also need to convert this property into text. To do this you use the
function ToString. This means, convert to text string.
So for, TextString: use ToString(polygon01.TotalArea)

If you are looking for the Area of one floor use:


TextString: string use ToString(polygon01[10].TotalArea) will give the total
area of shape 10 only.

Jan-10

167

Copyright 2009 Bentley Systems, Incorporated

Designing a Simple Tower

Flexible Building Floor Plates

Bool = false. This makes the text flat on the XY plane. True would make the
text vertical on the XZ plane.
6

Change Height and review the changes to the text.

Save the Transaction.

Now you need to put the area into an Excel file. Please note that you need
Microsoft Office 2003.

Exercise: Export to Excel


1

Open Excel and create C:\Floor_area.xls, save it, and exit Excel.

In GC, use the Feature ExcelRange, with the Update Method WriteValue.
Use sheet name Sheet1 (no spaces) and cells A1 through A20 and range
address.

Remember the double quotes for strings

Open Excel and review the values.

Save your Transaction.

Optional Exercise: Adding the Skin


1

Add the following to the end of the transaction file, by clicking on the
Edit this Transaction file icon.

transaction modelBased "Add Walls to one side"

Designing a Simple Tower

168

Copyright 2009 Bentley Systems, Incorporated

Jan-10

Flexible Building Floor Plates

{
feature walls01 GC.Polygon
{
Function = function (point08,point07)
{
for (int j = 0; j < point08.Count -1; ++j)
{
Polygon poly = new Polygon(this);
poly.ByVertices({point08[j], point08[j+1], point07[j+1], point07[j]}, false,
true, 0, null, null);
}
};
FunctionArguments = {point08, point07};
}
}

Jan-10

169

Copyright 2009 Bentley Systems, Incorporated

Designing a Simple Tower

Tips from this module

How would you add the walls for the other faces?

How might you automate that?

How else could you have added the walls? Hint: How did we skin other
objects?

Tips from this module


1

Creating geometry can be quick if you think about the relationships


beforehand starting with number of point you need.

Once the basic schema is done, changing it with other options is quick and
easy. For example, replace the first four points (the base) with four points
on a circle. Replace the vertical lines with variable radius arcs, i.e. radius
changes as Height changes.

The Transpose function can fix many potential matrix problems.

Adding Text that is tied to a variable is very helpful for quick reporting.

Designing a Simple Tower

170

Copyright 2009 Bentley Systems, Incorporated

Jan-10

GenerativeComponents and
Other Formats
Module Overview
This module looks at MicroStation models and references, and explores working
with them in GenerativeComponents. MicroStation is the graphics engine for
GenerativeComponents, and the basis for all the features types available.

Module Prerequisites

Basic knowledge of MicroStation

Knowledge of Referencing in Design Applications

Knowledge of Feature and Functions

Module Objectives
After completing this module, you will be able to:

Work with References

Promote elements to features

Understand MicroStations Import/Export Functionality

Models
When you create elements in a design file, or DGN, you are creating a model. A
model is stored as a discrete object within a DGN file. Each DGN file, therefore,
contains one or more models. It may be helpful to think of a DGN file as a box that

Jan-10

171

GenerativeComponents and Other Formats

Copyright 2009 Bentley Systems, Incorporated

References

can contain both 3D and 2D drawings, or models, any of which you can view
individually.

Models are very similar to Sheets in Excel. Each Sheet in Excel can hold different
data that is separate from another Sheet, yet they can both be in the same file.
You saw how handy multiple models are with Law Curves.
Models are also useful when printing or plotting sheets.
Hint: You have access to thousands of MicroStation tools while using

GenerativeComponents. Explore at any time by looking at the Tools menu.

References
References can also be attached to a design file and used as a guide for drawing
construction. Although you cannot modify reference elements, you can snap to
them, measure them, and even copy all or part of a reference into the active
design file. Remember the essence of a reference file is look [and plot] but do
not touch/edit.
You have two ways of referencing in GenerativeComponents, the traditional
MicroStation way, which is convenient for one time look at other files or the
GenerativeComponents way in which the referencing action is a Feature Type.

Exercise: MicroStation Referencing

GenerativeComponents and Other Formats

172

Copyright 2009 Bentley Systems, Incorporated

Jan-10

References

Click the References tool in the Primary Tools tool box at the edge of the
application window.

You can also select File > MicroStation Reference File Dialog in the
GenerativeComponents dialog.
2

In the References dialog, click the Attach Reference tool.

In Windows XP Navigate to the C:\Documents and Settings\All


Users\Application
Data\Bentley\MicroStation\WorkSpace\Projects\Examples\General\Dgn
folder, select Base Geometry.dgn, and click Open.
In WIndows Vista and 7 navigate to:
C:\ProgramData\Bentley\MicroStation\WorkSpace\Projects\Examples\G
eneral\Dgn folder.

MicroStation Reference Attachment settings


The first option you can select in the Reference Attachment Settings dialog is the
model you want to attach. All models in the file you have selected are listed.
Since the same model can be attached many times, the Logical Name field helps
you to distinguish between references.

Orientation options set the view of the model that you will see. Coincident, the
default, aligns the references with regard to design plane coordinates only.
Coincident World aligns the references with the active model with regard to both
Global Origin and design plane coordinates. You can also select to attach any
standard view, saved view or name fence that is in the selected model.

Jan-10

173

GenerativeComponents and Other Formats


Copyright 2009 Bentley Systems, Incorporated

References

Toggles define settings for the reference. The first one is Display. If on, the
reference is displayed. Second is Snap. If on, you can snap to elements in the
selected reference. Next is Locate. If on, you can select elements in a reference
for construction purposes. Enable Treat Attachment as Element for Manipulation
so you can manipulate references, as a whole, with the standard MicroStation
manipulation tools. True Scale uses units in the active model and those in the
referenced model to calculate an appropriate scaling factor so that the reference
scale reflects a true real-world scale.

Scale (Master:Ref) sets the ratio of the master units in the active model to the
master units in the attached model. Use this if the reference elements need to be
scaled. For example, 2 to 1 would make the referenced elements twice as large as
elements in the master.

The primary reason to do this is to reference other non-GC graphics for context.

Exercise: Select a model and attach the file


1

Continuing in the Reference Attachment Settings dialog, select the Arcs


model.

Set scale to 10:1.

Click OK.
You have attached a model to your work file for reference purposes.

Referencing as a Feature type


In addition to the MicroStation method of referencing you can also reference
DGN data using the ModelAttachment feature. You can attach a V8 DGN model as
a Feature. This makes it a transaction that you can record. Use the
ModelAttachment Feature with the AttachFromFile Update Method.
Inputs

DesignFileToAttach: This is the file path to dgn as a string. Use the green fx
button and Files tab to navigate to browse file location and then insert.

GenerativeComponents and Other Formats

174

Copyright 2009 Bentley Systems, Incorporated

Jan-10

References

ModelWithinDesignFileToAttach: (optional) This is a string and the


defaultValue is Default. Specify the model within the dgn that you wish to
attach.

NestLevel: (optional) Defined as int, the default value is 0.

CoordinateSystemToHostAttachment: Defines a CoordinateSystem in GC


which ModelAttachment should be hosted.

Warning: Remember for strings you must use double quotes.

Exercise: Using the ModelAttachment Feature


1

Continuing in the work file, select Create Feature.

Use ModelAttachment, with the AttachFromFile Update Method.

Use the following inputs:


DesignFileToAttach: C:\\Documents and Settings\\All Users\\Application
Data\\Bentley\\WorkSpace\\Projects\\Examples\\General\\Dgn\\Base
Geometry.dgn
ModelWithinDesignFileToAttach: Arcs
NestLevel: 1
CoordinateSystemToHostAttachment: baseCS

Hint: There is also a RasterAttachment Feature type to attach files such as .jpg

and .tif.

Jan-10

175

GenerativeComponents and Other Formats


Copyright 2009 Bentley Systems, Incorporated

Promoting Elements to Features

Using Range
A Range is a cubic volume delineating part of model space and can be used in
conjunction with ModelAttachment and many other feature types.
This is a very handy Feature Type as it allows you to capture part of a model for
use [usually] as an attachment to another model. Though there are many other
uses for Range once you have created it. The process is as follows.
1. Create a Range - The most common update method is
ByLowHighRangePoints.
2. Use the Range - Use the Range feature type and the update method
SelectFeaturesWithinRange.

Promoting Elements to Features


Use Promote MicroStation Element to Feature to make an existing MicroStation
element into a feature.
The key here is to choose an appropriate Update Method.
Now you will use a GenerativeComponents tool to promote the element. You
have the option to keep the elements symbology the same or to make it the
same as the symbology that is active in the design file.
Set active symbology for the file using the Attributes tool box that is at the edge
of the application window.

Sets the active level, color, line style and line weight

Exercise: Promote the element

GenerativeComponents and Other Formats

176

Copyright 2009 Bentley Systems, Incorporated

Jan-10

Using MicroStations Import/Export Functionality

In the GenerativeComponents dialog, select Tools > Promote MicroStation


Element to Feature > Using Element Symbology.

Enter a data point on a circle to identify it, and another to accept.

Select the Feature Type as Circle and the Update Method as


ByPointsOnCircle.

Three point features are added to both views and the circle is promoted
to circle01, a Line ByPoints.
4

Review the Symbolic View.

Record the transaction and Save.

If the element is eligible to be more than one type of feature, or the update
method is not definite, the Select Feature Type and Update Method dialog
appears so you can define these.
This workflow applies to DWG elements as well.

Using MicroStations Import/Export Functionality


MicroStation supports conversion to and from various external file formats.
GenerativeComponents makes use of some of these.

Jan-10

177

GenerativeComponents and Other Formats


Copyright 2009 Bentley Systems, Incorporated

Using MicroStations Import/Export Functionality

Import IGES
IGES is a public domain, neutral file format that serves as an international
standard for the exchange of data between different CAD/CAM systems. The
fundamental unit of data in an IGES file is the entity. There are 2 major categories
of entities. Geometry entities define physical shapes, such as points, curves,
surfaces, solids, and relations, which are collections of similarly structured
entities. Non-geometry entities provide specific attributes or characteristics for
geometry entities. Non-geometry entities include view, drawing, general note,
dimension, property, and associativity entities.
Select File > MicroStation Import From > IGES in the GenerativeComponents
dialog to import .igs files.

Exporting to DGN, DXF or DWG


Geometric constructions can be exported to DGN, DXF or DWG. To Export, select
File > MicroStation Export To > Dgn, Dxf, Dwg. In the Export file dialog, select the
type of file you wish to save as.
To set parameters for the export file, click the Options button.

Save As V8 Options
Remapping
Options on the Remap tab control how element parameters such as levels,
symbology, fonts, or cell names are remapped to different values when the file is
saved to a V8 file. For example, you can remap elements on level 24 of the active
file to level Annotation in the V8 file. Remapping is useful when you need to
convert standards to comply with organizational requirements.
To remap element parameters, you use a remapping table. This table is saved in a
CSV (comma separated value) file that is created by a macro embedded in a
spreadsheet program.
The Remap tab of the Save As V8 Options dialog box lets you create and edit the
remapping table through the Microsoft Excel spreadsheet program. You can also
control which sections of the remapping table to use when the file is saved.

GenerativeComponents and Other Formats

178

Copyright 2009 Bentley Systems, Incorporated

Jan-10

Using MicroStations Import/Export Functionality

References
The References tab contains controls that determine how references are handled
when you save a file as a V8 file. This is dependent on the Geometry setting in the
Filter tab.

If Geometry is set to Everything you can choose to keep references as


attachments, combine a file and its references into a single output file, or
omit the reference attachments from the output file.

If set to Selection Set, or Fence, only the Allow Optimized Clip For Reference
Merge setting is enabled. All other settings are disabled with the result that
all selected geometry, or fence contents, will be merged and references
discarded in the saved file.

You can choose to keep references as attachments, combine a file and its
references into a single output file, or omit the reference attachments from the
output file.

Filtering
The Filter tab contains controls that are used to filter the data that is saved to the
output file. Options let you select the file geometry you want to include, letting
you filter by fence or selection set. You can also select specific models to save.

Jan-10

179

GenerativeComponents and Other Formats


Copyright 2009 Bentley Systems, Incorporated

Using MicroStations Import/Export Functionality

You can choose to save or eliminate saved views, shared cells, named groups,
frozen levels and tags.

Save As DWG/DXF Options


General options tab
Settings here are used to set basic options for saving to DWG and DXF files.
There are Advanced options, as well as those for References, Line Weights, Entity
Mapping, Classes, Cells, Fonts, Dimensions, and TriForma. See the online Help
topic Menus > File Menu > Save As DWG/DXF Options dialog box General Tab for
details.
Remapping
Options here are similar to those when saving as V8 DGN. You set element
parameters such as levels, symbology, fonts, or cell names are remapped to
different values when the active file is saved to a DWG/DXF file. For example, you
can remap elements on level Space Plan of the active file to level Space Planning
in the DWG file.
Remapping is useful when you save to DWG/DXF files, since current DGN files
support more line styles than AutoCAD files. Remapping lets you decide how to
handle differences between these types of files.
To remap element parameters, you use a remapping table. This table is saved in a
CSV (comma separated value) file that is created by a macro embedded in a
spreadsheet program. The Remap tab of the Save As DWG/DXF Options dialog
box lets you create and edit the remapping table through the Microsoft Excel
spreadsheet program. You can also control which sections of the remapping table
to use when the file is saved.

GenerativeComponents and Other Formats

180

Copyright 2009 Bentley Systems, Incorporated

Jan-10

Exporting to STL and 3D Printing

References
Options here control how references are handled when you save a DGN file to a
DWG or DXF file. The DWG file format does not support all the reference
attachments possible in MicroStation.
Options here are similar to those when saving as V8 DGN. There are additional
options for Non-Default Models Attachments, as AutoCAD is limited to one
default model per file with one or more sheets. The Masked Attachments option
controls how clipping masks in attachments are handled.

Exporting to IGES
You can also export to IGES using similar operations.
By default, the file name is the design file name with the extension .igs. A
different directory and file name can be specified by choosing Export As from the
File menu in the Export IGES File dialog.
The Start Section File fields are used to input information that is included in the
IGES file's start section; the Author, Organization, and Product Name.
The status area displays progress messages during the conversion. These are also
saved in the log file.

Exporting to STL and 3D Printing


Stereolithography is a technology for producing parts with high accuracy and
good surface finish. You can export to a Stereolithography file, setting facet
parameters in the Export STL File dialog.

Jan-10

181

GenerativeComponents and Other Formats


Copyright 2009 Bentley Systems, Incorporated

Export Feature Type

The STL format is poular as an input to many 3D Printers. Using the Export STL
command allows you to prepare your 3D model for 3D printing.

How to use the Export STL command for 3D Printing


1

Select File > Export > STL

Left-click in the view you wish to export.

Select the objects to export. You can draw a window around them.

A Save As ... dialog opens. Name your file and choose the folder location.

Progress bar shows the operation underway.

Also, VRML now supports meshes for color 3D printing.

Export Feature Type


There is a corresponding feature type to the MicroStation tools. The advantage is
that you can create a DGN as a transaction. The disadvantage is that there are
fewer options.

The Export feature type has two Update Methods.

ExportFeatureAsElementsToAnotherDesginFile

ExportFeatureAsElementsToAnotherModelWithinActiveDesignFile

GenerativeComponents and Other Formats

182

Copyright 2009 Bentley Systems, Incorporated

Jan-10

Module Review

Module Review
Now that you have completed this module, lets measure what you have learned.

Questions
1

What is a model?

What is a reference?

When attaching references, what does the Scale (Master:Ref) option do?

True or False: When you promote an element GenerativeComponents


determines what the feature type and update method will be.

Answers
1

A DGN file component that contain elements. A DGN file can contain
many individual models.

A model attached to, and displayed with, the active model for printing or
construction purposes. A reference cannot be modified. You can attach,
as a reference, a model that resides in either the open DGN file or some
other DGN file.

It sets the ratio of the master units in the active model to the master units
in the attached model. Use this if the reference elements need to be
scaled.

False. It is determined by the type of element. If the element is eligible to


be more than one type of feature, or the update method is not definite,
the Select Feature Type and Update Method dialog appears so you can
refine these.

Tips from this module

Jan-10

Promoting elements from existing CAD drawings can be a good way to get
started for certain workflows.

Referencing in other project data can be helpful to the context of your GC


design.

183

GenerativeComponents and Other Formats


Copyright 2009 Bentley Systems, Incorporated

Tips from this module

3D Printing relies on closed meshes.

GenerativeComponents and Other Formats

184

Copyright 2009 Bentley Systems, Incorporated

Jan-10

Using Patterns
Module Overview
This module is loosely based on the excellent work of Rob Woodbury at the
Simon Fraser University in Canada. You will examine concepts regarding applying
patterns to learn parametric software.

Module Prerequisites

Knowledge of Functions, Features and Transactions

Module Objectives
After completing this module, you will be able to:

Apply the basic principles of patterns to parametric design

Design Patterns
The idea of Design Patterns is to use a pattern to control parametrics.
A pattern in this context is a type of theme of recurring events of or objects,
sometimes referred to as elements of a set. These elements repeat in a
predictable manner.
The following is taken with permission from Rob Woodbury.

Jan-10

185
Copyright 2009 Bentley Systems, Incorporated

Using Patterns

The Controller Pattern

The Controller Pattern


This pattern is used to control geometry, or part of a geometric assembly,
through a separate piece of simplified geometry.
You can use this pattern when you want to interact with your geometry in a clear
way, or when you want to show others how you intend the geometry to be
changed.
Isolating manipulations to another place away from the complex detail of a model
means that you can change the model more easily. Using a logic for control that is
different from the way the model is defined means that you can use the most
appropriate interaction concept. Changing a collection of objects through a single
interface simplifies the interaction task.
As models grow, so does the need for a carefully considered set of controllers. In
particularly complex models, you may well design and implement a separate
control panel that collects all of the controllers into a single place in the interface.
As one property changes in your model, one or more parts changes; you can
connect this property to a Controller. Then, you can simply change the Controller
and see the result in your model. Controllers are therefore independent. The idea
is that they have minimal connection to the model they control and are easily
connected and disconnected as needed. This separation is the hallmark of a
controller: every well-designed controller will have a symbolic model that shows
only one or a scant few links between it and the model it controls.
In the following exercise, you have a curve and a vertical line on this curve. The
start point of this line PointOnCurve is a parametric point on the curve. The
Controller is a line and a parametric point on it. The idea is to make the
parameter of the PointOnCurve dependent on the point in the Controller which
transfers control from the curve to a straight line.

Using Patterns

186

Copyright 2009 Bentley Systems, Incorporated

Jan-10

The Controller Pattern

Exercise: Control the position of a vertical line on a curve with a Controller.


1

Create a new file and provide a name.

Select Create Point and place four points for a B-Spline Curve.

Select Create Feature and choose BSplineCurve with Update Method


ByPoles and use the following:
Poles: {point01,point02,point03,point04}
Order: 4
Name: Curve01

Select Create Feature and choose Point with Update Method


ByParameterAlongCurve and use the following:
Curve: Curve01
T: 0.5

Jan-10

187

Copyright 2009 Bentley Systems, Incorporated

Using Patterns

The Controller Pattern

Name: curvePoint
After typing in the 0.5 tab out of the field, right click on T property, and
select Free.

Next you will define a direction that is usable by both the controller and
the geometry to control.
5

Select Create Feature and choose Direction with Update Method


ByCrossProduct and use the following:
Origin: baseCS
XDirection: baseCS.XDirection
YDirection: baseCS.YDirection
Name: VertDirection
Next is to create Vertical line from our parameter point.

Select Create Feature and choose Line with Update Method


ByStartPointDirectionLength and use the following:
StartPoint: curvePoint
Direction: VertDirection

Using Patterns

188

Copyright 2009 Bentley Systems, Incorporated

Jan-10

The Controller Pattern

Length: 2

Select Create Point and place two points for a controller line. Name the
two points: cPoint01 and cPoint02.

Select Create Feature and choose Line with Update Method ByPoints and
use the following:
StartPoint: cPoint01
EndPoint: cPoint02
Name: cLine01

Jan-10

Select Create Feature and choose Point with Update Method


ByParameterAlongCurve and use the following:

189

Copyright 2009 Bentley Systems, Incorporated

Using Patterns

The Controller Pattern

Curve: cLine01
T: 0.5
Name: cPoint03
After typing in the 0.5 tab out of the field, right click on T property and
select Free.

Finally, you can connect the point on the controller to the point on the
curve.
10 Select Edit Feature and click on curvePoint and change the following:

T: cPoint03.T

Using Patterns

190

Copyright 2009 Bentley Systems, Incorporated

Jan-10

References

11 Toggle the Visibility of the Handles to clean up the look.

12 Test the Controller by moving the point on the controller line (cPoint03).

References
Rob Woodbury has produced many other useful GC based pattern tools. Please
review:
http://www.designpatterns.ca
Also, look for the upcoming book on Design Patterns from Rob at the Bentley
Institute Press.
For further generic reading on this topic please review:

Jan-10

Frank Buschmann, Kevlin Henney, Douglas C. Schmidt. On Patterns and


Pattern Languages

Christopher Alexander. A Pattern Language

Erich Gamma et al. Design Patterns: : Elements of Reusable Object-Oriented


Software

Wolfgang Pree. Design Patterns for Object-Oriented Software Development

191

Copyright 2009 Bentley Systems, Incorporated

Using Patterns

Tips from this module

Tips from this module


1

Using Patterns

Visit http://www.designpatterns.ca

192

Copyright 2009 Bentley Systems, Incorporated

Jan-10

Advanced Topics
Module Overview
There are many advanced topics in GenerativeComponents. You will examine two
specific advanced topics in this module. The first is working with BIM applications
from Bentley such as Bentley Architecture, Bentley Structural, and Bentley
Building Mechanical Systems. In addition, you will look at solid modeling
techniques unique to GenerativeComponents.

Module Prerequisites

Knowledge of Features, Functions and Transactions

Basic understanding of BIM technology

Basic understanding of Solid Modeling

Module Objectives
After completing this module, you will be able to:

Use BIM Features with GenerativeComponents

Working with Solids

Working with other interesting functions

BIM Objects
BIM features for GenerativeComponents is an add-in which introduces Walls,
Structural members, Doors and Windows. It also re-introduces Drawing

Jan-10

193
Copyright 2009 Bentley Systems, Incorporated

Advanced Topics

BIM Objects

Extraction which was removed from core GC accompanying the transition to


Bentley.Parasolid libraries which replaced GC dependency on TriForma.

Overview

With BIM Features for GenerativeComponents you can create traditional


architectural content inside GC which could be used with Bentley Building
products such as the following.

Bentley Architecture

Bentley Structural

Bentley Building Mechanical Systems

Bentley Building Electrical Systems

The concept of BIM Objects relies on the installation of Bentley Architecture. You
can out more about Bentley Architecture at:
http://www.bentley.com/en-US/Products/Bentley+Architecture/
BIM Features for GenerativeComponents 08.11.07.xx are:
One model One source
Use your conceptual model directly, for further detailing without any loss of data.

Advanced Topics

194

Copyright 2009 Bentley Systems, Incorporated

Jan-10

BIM Objects

Real World Features


Enables GC not only to create graphical primitives but real elements like walls,
beams, doors and windows. These BIM Features could be used directly in the
previous target applications.

GenerativeComponents Integration
Fully integrated in the GC feature tree. Acts like a normal GC feature. One session
with GC running together with a Building application like Bentley Architecture
BIM Integration
Elements created are compatible with Building products like Bentley Architecture
or Bentley Structural and can be used and edited in the target application. No
translation or conversion is needed.

Parts and Families for GC features


Permanent Properties could be added to regular GC features to maximize the
degrees of freedom in the design process and to overcome limitations of existing
forms.
Simplified Doors and Windows
New element types have been introduced. These are no longer based on PCStudio files to increase flexibility and performance.

Jan-10

195

Copyright 2009 Bentley Systems, Incorporated

Advanced Topics

BIM Feature Type

Namespace concept
GC's concept of Namespaces is incorporated to allow advanced users to classify
feature instances and generated feature types. New features will show up as
(Bentley.Building.Wall, Bentley.Building.Beam, etc)
Native language
Completely rewritten in C# to match GC's native language.

Installation and Setup


The following pre-requisites are required:

Desktop Prerequisites Pack 08.11.07.03

MicroStation08.11.07.171

GenerativeComponents08.11.07.66

Bentley Architecture08.11.07.69

For now you can get BIM Features, since this software is in Beta, as a Select
Download.

BIM Feature Type


If the BIM feature does not load properly, you can do so manually by going to
Tools > Manage Loaded Assemblies and clicking on Select Pre-compiled Assembly
File (*.dll) and, select the Bentley.GenerativeComponents.BIM.dll then click Load
It! Make sure you turn on Load Automatically in Future Sessions.
The BIM feature types are available as New Features.
Since we do not expect that you have Bentley Architecture/Structural/
Mechanical Systems installed for this class, there are no exercises.

Drawing Extraction
There are two ways of getting your production drawings from your GC and BIM
model. The first is to use Dynamic VIews from MicroStation. Dynamic VIews

Advanced Topics

196

Copyright 2009 Bentley Systems, Incorporated

Jan-10

Working with Solids

allows you to dynamically move a section plane or detail area through a 3D model
to see and produce production drawings. This method relies on a deeper
understanding of MicroStation.
The second way is to use the DrawingExtraction feature type.

The method is as follows.


1. Create the DrawingExtractionSettings feature type and run the wizard
there.
2. Create the DrawingExtraction. Which produces a DGN file.

Example GCT file using BIM Elements


There are several example files showing each Update Method available when you
download and install BIM Features.

Working with Solids


GenerativeComponents defines Solids as:
A Solid is any limited portion of space bounded by surfaces.

Jan-10

197

Copyright 2009 Bentley Systems, Incorporated

Advanced Topics

Working with Solids

Solid modeling tools are available from the Feature Type Solid. In addition, you
can promote solids created in MicroStation.

Common update methods can create the following solids:

Cone

Protrusion

Slab

Sphere

Torus

BetweenSurfaces

OffsetFromClosedCurve

Plus many more methods.


In addition, there are several update methods here to allow you to edit Solids,
with the Solid Feature Type. for example:

Cut - Cut a solids with a curve

ThinShell - Shell out the interior of a solid leaving a thin outer solid.

TrimWithSurface

BooleanOperation

Advanced Topics

198

Copyright 2009 Bentley Systems, Incorporated

Jan-10

Scripting Basics
Module Overview
This module presents the basics of the GCScript language and tools. GCScript is a
C style programming language, like C, C++, Java, and C#, that is optimized to work
with Bentley GenerativeComponents.

Module Prerequisites

Use Script Editor and its tools

Use Script Expression Builder and Function tools

Create a GCScript file

Develop Application Logic

Module Objectives
After completing this module, you will be able to:

Jan-10

Apply basic scripting principles to automate design

Use basic functionality of The Script Editor and Script Expression Builder

Write basic GCScripts

Be able to Debug your GCScripts

199
Copyright 2009 Bentley Systems, Incorporated

Scripting Basics

Module Glossary

Module Glossary
C# (sharp)
C# is an object-oriented programming language developed by Microsoft as part
of the .NET initiative and later approved as a standard by ECMA and ISO. The C#
language has a procedural, object-oriented syntax based on C++ and includes
aspects of several other programming languages (most notably Delphi and Java)
with a particular emphasis on simplification.

Top level Feature


Top Level Features are Features that are shown with their own node in the
Symbolic view and have a name, such as point01. They require the most memory
and allow for the full set of interactions provided in GC. Top level Features are the
default types of Features created in modeling based design.

Temporary Feature
Temporary Features can be created in scripting. They are created only locally in a
function for as long as the function is running and afterwards erased. Temporary
are often used in scripts to create intermediary Points for instance to construct
something else from. They do no appear in the Symbolic view either, but can still
be full fledged GenerativeComponent Features.

Child Feature
Replication of a point is an example of a child feature.

Reflection
The process by which a program can read its own metadata. A program is said to
reflect on itself, extracting metadata from its assembly and using that metadata
either to inform you or to modify its own behavior. Figuratively speaking, it is
then said that the program has the ability to observe and possibly to modify its
own structure and behavior.

Scripting Basics

200

Copyright 2009 Bentley Systems, Incorporated

Jan-10

Module Glossary

Objects
Objects are key to understanding object-oriented technology. Look around right
now and you'll find many examples of real-world objects: your dog, your desk,
your television set, your bicycle.
Real-world objects share two characteristics: They all have state and behavior.
Dogs have state (name, color, breed, hungry) and behavior (barking, fetching,
wagging tail). Bicycles also have state (current gear, current pedal cadence,
current speed) and behavior (changing gear, changing pedal cadence, applying
brakes). Identifying the state and behavior for real-world objects is a great way to
begin thinking in terms of object-oriented programming.
You will notice that real-world objects vary in complexity; your desktop lamp may
have only two possible states (on and off) and two possible behaviors (turn on,
turn off), but your desktop radio might have additional states (on, off, current
volume, current station) and behavior (turn on, turn off, increase volume,
decrease volume, seek, scan, and tune). You may also notice that some objects, in
turn, will also contain other objects. These real-world observations all translate
into the world of object-oriented programming.
Software objects are conceptually similar to real-world objects: they too consist
of state and related behavior. An object stores its state in variables and exposes
its behavior through functions. Functions operate on an object's internal state
and serve as the primary mechanism for object-to-object communication. Hiding
internal state and requiring all interaction to be performed through an object's
functions is known as data encapsulation a fundamental principle of objectoriented programming.

Function
A function represents an independent block of GCScript statements. In computer
science, a function, sub-routine, method, procedure, or sub-program) is a portion
of code within a larger program, which performs a specific task and can be
relatively independent of the remaining code. The syntax of many programming
languages includes support for creating self contained functions, and for calling
and returning from them. A function has inputs (of type: int, double, etc) and
output of type.

Jan-10

201

Copyright 2009 Bentley Systems, Incorporated

Scripting Basics

Module Glossary

Static and Void Functions


Static
The function is only visible to other functions in the file in which it is defined.
Void
A function that does not return a value.

Class
In object-oriented programming, a class is a construct that is used as a blueprint
to create objects. This blueprint includes attributes and methods that the created
objects all share.
Usually, a class represents a person, place, or thing. It is an abstraction of a
concept within a computer program. Fundamentally, it encapsulates the state
and behavior of that which it conceptually represents. It encapsulates state
through data placeholders called member variables; it encapsulates behavior
through reusable code called methods.

Enum
Enum provides methods to compare instances of this class, convert the value of
an instance to its string representation, convert the string representation of a
number to an instance of this class, and create an instance of a specified
enumeration and value.

Namespace
A namespace is an abstract container or environment created to hold a logical
grouping of unique identifiers or symbols (i.e., names). An identifier defined in a
namespace is associated with that namespace. The same identifier can be
independently defined in multiple namespaces. That is, the meaning associated
with an identifier defined in one namespace may or may not have the same
meaning as the same identifier defined in another namespace.
For example, if you install the BIM add-on you will it uses Namespaces, seen as:

Scripting Basics

202

Copyright 2009 Bentley Systems, Incorporated

Jan-10

GCScript Basic Components

Building.Beam
Building.Door
Building.Wall
You can create Namespaces to help categorize and sort out different useddefined features (generated feature types). Some examples might be:
myCompany.utilities.triangulate
myCompany.components.crossbar
Structure.Steel.Ibeam

GCScript Basic Components


GCScript is a robust programming language providing type, conditional
statements, repeating statements, block statements, functions and subfunctions, objects and methods, arguments passed by value or by reference, a
rich set of expression operators, and many more aspects.
GCScript provides its own unique tools, including automatic replication, the
ability to use a list, or a nested set of lists, wherever a single value is expected.
GCScript is the glue that connects together all of the Features in a
GenerativeComponent model. GCScript appears at several different levels.

Feature Properties
Whenever you fill in the value of a property, that value is a GCScript expression,
which can be as simple or as complex as you like.

Here the Expression for X, Y and Z Translation is a simple number

Jan-10

203

Copyright 2009 Bentley Systems, Incorporated

Scripting Basics

GCScript Basic Components

Here the Expression is an existing feature

Here the Expression is scripted entry

Scripting Basics

204

Copyright 2009 Bentley Systems, Incorporated

Jan-10

GCScript Basic Components

How to Operate the Script Console


To open the Script Console you can select the Show Console icon in the
GenerativeComponents task.

Jan-10

205

Copyright 2009 Bentley Systems, Incorporated

Scripting Basics

GCScript Basic Components

or select Utilities > GCScript > Show Console.

You can dock the dialog where you like.


The Script Console not only tells you what has happened, but is a testing area for
quick statements.

Scripting Basics

206

Copyright 2009 Bentley Systems, Incorporated

Jan-10

GCScript Basic Components

You type text into the entry field, which is across the bottom of the page. You can
type any GCScript expression or statement, then press the Enter key.

You can scroll to review your previous entries using arrow keys. You may
optionally edit any of your previous entries, and re-issue them by highlighting and
pressing the Enter key.
Alternately, you can click the drop-down button (to the right of the entry field) to
see and/or select any of your previous entries.
Finally, you can click the Clear Log button to clear the log display.
Single Lines Only, Please
The script console handles only expressions and statements that fit into single
entries. It cannot handle larger passages of code, such as a multi-line function
definition. Try the following.

Jan-10

207

Copyright 2009 Bentley Systems, Incorporated

Scripting Basics

How to write and use GCScript functions

Exercise: Using the Script Console


1

Create a new file and provide a name.

Open and dock the Script Console.

Type the following text into the data entry field of the Console window:
2+3

You will see the result in the output (log) portion of the page:
* 2+3
5 (the result)
4

Type in the following:


int i=2
3*i
6 should be your result.
You can perform repetitious operations with looping statements.

Type in the following:


for (int i = 0; i < 10; i++) Print(i)
Result should a list of numbers from 0 to 9.

How to write and use GCScript functions


All of the functions, regardless of where you create them, are written entirely in
GCScript.
GraphFunctions are feature types and can be used in other transactions, they can
also easily be suppressed and copied and edited. It is the preferred way to write
functions.

Scripting Basics

208

Copyright 2009 Bentley Systems, Incorporated

Jan-10

How to write and use GCScript functions

Calling functions
Functions provide a very good way organizing code into modules that do specific
tasks. Calling functions allows a user to easily utilise this encapsulated
functionality. Writing code in functions makes code more reusable. The same
function can be called repeatedly again and again.
In GenerativeComponents it is possible to distinguish between three functions:

Local functions that are local in scope

Global functions that are global in scope

Anonymous functions

Functions which are global in scope can be called anywhere within a transaction
file. Functions which are local in scope are callable only locally within the scope of
the function. GC has a number of built-in global functions such as Abs(), Cos(),
MembersAt(), Series().
Functions can be called in one of two ways. The usual way is by calling the
function directly by name followed by a list of the arguments:
functionName(functionArguments);
A second way is normally only used in very particular circumstances uses the GC
script function CallFunction:
CallFunction(string functionName, functionArguments )
When calling a function the arguments must be listed in the same order as they
are defined in the function. The values must also be of the same type as specified
by the function arguments.
The built-in global function SeriesByCount accepts three arguments all of which
must be numbers and returns a single array of numbers.
transaction script "New script transaction"
{
double list = SeriesByCount(0, 10, 2.5);
//list has the value {0.0, 2.5, 5.0, 7.5, 10.0}
}

In the example below, the built-in global function Abs is called. This accepts a
number as an input and returns a number.
transaction script "New script transaction"

Jan-10

209

Copyright 2009 Bentley Systems, Incorporated

Scripting Basics

How to write and use GCScript functions

{
double theta = -53.2;
double result

= Abs(theta);

//result has the value 53.2


}

Creating your own Functions


To create your own functions you use the GraphFunction feature type.

Local Functions
Another way to create a function in GenerativeComponents is by using the
statement builder and selecting function. Local functions are limited in scope to
the file that you define them in.
This gives the basic construction.
function (arguments)
{
}

Functions, like variables must be defined above the place where they are called in
the code otherwise the compiler will throw an error.

Function Name and Type


The syntax for declaring a function is type of function then the name of the
function followed by arguments in parenthesis. The user can and should omit the
word function when creating a named function. The word function is intended
only when creating anonymous functions, as described below. Specifying the type
of a function is not required by GenerativeComponents but it can be regarded as
good practice. Specifying the type allows an extra level of checks such as that the
return value is of the same type. The Type can additionally be specified as an
array or multidimensional array using square brackets.
Type NameOfFunction(Type nameWithinFunction, Type nameWithinFunction, )
double multiply(arguments)

Scripting Basics

210

Copyright 2009 Bentley Systems, Incorporated

Jan-10

How to write and use GCScript functions

Arguments
The Arguments (essentialy inputs) for a function are listed in parenthesis to the
right of the function name. The type of each argument is normally written before
each value. In the example below the function type is double, the function name
is multiply and the arguments are two doubles number1 and number2.
double multiply(double number1, double number2)
{
return number1*number2;
}

GenerativeComponents does not require that the type is given for any argument.
Specifying the nature of the any input argument does however restrict the input
which is often advantageous. If any of the arguments are arrays, etc, the rank can
be indicated using the appropriate number of sets of opening and closing square
brackets after the Type.
Inputs are generally given specific names within the function, to distinguish them
from variables outside of the function. This gives the user the opportunity to
clarify, by appropriate naming, their role within the function.

Return Value
The return statement is used to indicate what is returned from the function. The
type of the return value must be the same as the type of the function. Only one
value can be returned from a function, although this can be an array or a multiple
array of values.
There are other ways to passing more than one value out of a function such as
using ref or out values as function arguments.
It is possible to create functions which do not return any values; these are known
as void functions.
transaction script "New script transaction"
{
void showValues(int x, int y)
{
ShowMessageBox("The values selected are " + x + " and " + y +
".");
}

Jan-10

211

Copyright 2009 Bentley Systems, Incorporated

Scripting Basics

How to write and use GCScript functions

int x = 2, y = 4;
showValues(x, y);
}

The following exercise will allow you to draw a point with a function. You will
need to use unique names for your arguements and variables. In other words,
you cannot use the same name for two different variables.

Exercise: Writing a simple function


1

Create a new file and provide it a name.

Select Create Feature and choose Point.

Expand the ByFunction Update Method and click n the blue icon for the
Script Editor.

In the Script Editot click on the Statement Builder icon and select function.

You can also right-clcik in the text window and select Statement Builder.

Scripting Basics

The Script Editor returns the basic form of a function.

Type in the following:

212

Copyright 2009 Bentley Systems, Incorporated

Jan-10

How to write and use GCScript functions

function (CoordinateSystem myCS)


{
Point myPoint = new Point();
myPoint.ByCartesianCoordinates(myCS, 3, 5, 0);
return myPoint;
}

Lets examine each line independently.


function (CoordinateSystem myCS)
function
(

tells the software that you are declaring a function.

indicates that you are about to enter arguments to the function.

is the type of arguement. Remember a type can be a double,


int or a GC type, like, Point, Line, CoordinateSystem)

CoordinateSystem

myCS

is the name you give the argument.

indicates you are finished declaring your arguments.

the open curly brace indicates the beginning of the actual function contents.

Point myPoint = new Point();


Point

is the type being declared, it is a GC type.

myPoint

is the name of the variable (of type Point).

the equals sign says: Take the value on the right of the equal sign and put it into
the variable on the left, after processing this line of code.
=

the word new is reserved for GCScript, so you cannot use it to name a
variable. That is why the text is blue. New indicates a new feature is being
created. Another way to say it is: new instantiates (creates an instance) the
memory for this object.
new

Jan-10

213

Copyright 2009 Bentley Systems, Incorporated

Scripting Basics

How to write and use GCScript functions

Point() this tells what new thing to create. Note the (), indcating that this is
the Point function and it will return a point to the screen (if asked too).

tells the computer that the line has ended, and that it can start the next one.
Almost all statements will have this at the end.

myPoint.ByCartesianCoordinates(myCS, 3, 5, 0);
myPoint. is your variable of type Point. Typing in the dot provides you with a list

of possible options.
ByCartesianCoordinates
(myCS, 3, 5, 0)
;

is the Update Method used with the Point feature.

is the coordiante system, x value, y value and z value.

Do not forget to finish a statement with the ;

return myPoint;

the keyword return is a function which puts the point on the screen for
you to see. Here you are returning the type Point.

return

myPoint

what you are returning as defined in the line above.

end of this statement.

end of function.

Note the general form of calling a feature:


featurename.UpdateMethod(arguments to the feature)

Click on OK in the Script Editor.


You will no need to supply a real argument to the function.

In the Function Argument field enter:


(baseCS)
this is the Coordiante System that the function is looking for as an input. It
must be in parentheses.

Scripting Basics

214

Copyright 2009 Bentley Systems, Incorporated

Jan-10

How to write and use GCScript functions

Click on OK to see the point.

This is the basic structure that you will use to create and show features.
Lets enhance what has been written by adding a set. You will split the singular
point into several points by giving it a {list} for its X translations.

Exercise: Adding more to the script


1

Open the Script Editor.

Change the following to:


myPoint.ByCartesianCoordinates(myCS, {2,4.5,7},5,0)

Click OK and see the results.


You should see three points now.
To make future, more advanced edits to features it is better if you make
the following changes in bold text:
function (CoordinateSystem myCS)
{
double XValue = {2,4.5,7};
Point myPoint = new Point();
myPoint.ByCartesianCoordinates(myCS, XValue, 5, 0);
return myPoint;
}

The only difference here is that we define a variable of the type double, then fill
it up with a list and use the variable instead of the list itself.
Both of these variations will produce exactly the same outcome, three points will
appear when you click Apply.

Optional values
Arguments can be optional. In the following example the built-in GC script global
function Round takes an option second argument which sets the precision In the
example below, uses the built-in global function Round and the global variable PI.
When the precision is not given the value is rounded to a whole number. This
function will use a rounded value for Pi called pie.
transaction script "New script transaction"
{

Jan-10

215

Copyright 2009 Bentley Systems, Incorporated

Scripting Basics

How to write and use GCScript functions

double pie = Round(PI, 3);


int pie2 = Round(PI);
//The value of pie is 3.142
//The value of pie2 is 3
}

Writing your own global functions


Global functions can be created by using the global keyword. For example:
global int Plus(int x, int y) { return x + y; }

This creates a new global function that is just like the built-in functions. It is not
associated with the current graph, and therefore, it persists through the entire
session, regardless of opening/creating of new/existing files.
The user can also create global variables.
global double Tolerance = 0.01;

Like global functions, global variables persist through the entire session.

Anonymous Functions
Every function is a kind of object, which can be assigned to a variable, passed as
an argument to a method call, or returned as the result of another function.
Furthermore, like a number or a string, a new function can appear spontaneously
within an expression or statement, without needing an associated name. These
ad hoc functions are called anonymous functions.
To create an anonymous function, use the keyword function instead of a name.
Also, its conventional to omit the types of the return value and the arguments,
but you can include those types if you prefer.
For example,
double Plus(int x, int y) { return x + y; }
// A named function that, when called, will add two numbers.
function(x, y) { return x+ y; }
// An anonymous function that, when called, will add two numbers.

Scripting Basics

216

Copyright 2009 Bentley Systems, Incorporated

Jan-10

How to write and use GCScript functions

As an example of when and how to use an anonymous function, following is a


code snippet that calls the Select method. That method can be applied to any list,
and returns a new list comprised of only those members that satisfy a certain
condition. The condition is specified by passing a function, which typically is an
anonymous function:
int[] source = {9, 3, 6, 34, 2, 10};
int[] largeValues = source.Select(function(x) { return x > 8; });
Anonymous function passed as argument.

//

// Now the value of largeValues is {9, 34, 10}.

It is sometimes useful to create an anonymous function and then immediately


call it within the same expression. For example,
int n = 5;
int[] squares = function(limit) { int[] result = {}; for (int i = 0; i <
limit; ++i) result.Add(i * i); return result; } (n);
// Note the text (n) following the anonymous function; this denotes that
were calling the anonymous function
// with the argument, n.
// Now the value of squares is {0, 1, 4, 9, 16}.

As an alternative to defining a named function, we can define an anonymous


function, assign it to a variable, and subsequently use that variable to call the
function. For example:
function Plus = function(x, y) { return x + y; }
int sum = Plus(3, 4);

You might be interested to know that, from the standpoint of the GCScript
compiler, the following two statements are identical:
int Plus(int x, int y) { return x + y; }
int function(int x, int y) Plus = int function(int x, int y) { return x +
y; }

Script Transactions
In a transaction file, a script transaction lets you enter any number of arbitrary
GCScript statements, which are executed in sequence when that transaction is
performed.

Jan-10

217

Copyright 2009 Bentley Systems, Incorporated

Scripting Basics

GCScript Basic Components

Script Files
A script file is a text file designed to contain a complete GCScript program. You
can run the program, manually, whenever you wish, or you may run it
automatically within any other GCScript code.
Using the Script Console to learn and experiment with GCScript
As you read the rest of this manual, please feel free to use the script console as a
way to learn and experiment with the GCScript language.

GCScript Basic Components


The following is a review of GCScript:

Syntax

Keywords

Types

Variables

Basic GCScript Syntax


Any comment
An end-of-line comment begins with the symbol // (two consecutive forward
slash characters) and continues through the end of the line. For example,
Print((temperature 32) / 1.8); // Print the result as degrees Celsius.

Block comment
A block comment begins with the symbol /* (a slash followed by an asterisk) and
continues through the symbol */ (an asterisk followed by a slash).

Spaces
Generally, the GCScript language processor ignores spaces and line breaks that
occur between adjacent symbols. You should use as much or as little spacing as
you wish, to make your script code readable to yourself and others.

Scripting Basics

218

Copyright 2009 Bentley Systems, Incorporated

Jan-10

GCScript Basic Components

From GCScripts point of view, the following examples are identical. Which is best
depends on your programming style.
(temperature32)/1.8
(temperature 32) / 1.8

Exercise: Use the Script Conslole to test validity before using


1

Test the statements above for validity in the Script Console.

Names
The names of variables and other symbolic values follow the standard
convention: A letter or an underscore character, followed by any number of
letters, digits, and/or underscore characters.

Correct syntax
count
Point01
k
TOTAL_HEIGHT

Incorrect Syntax
Examples of syntactically incorrect names. The reason why they are incorrect
follows the example:
3pointcounter (starts with a digit).
pointsandcircles (includes illegal characters).
Names are case-sensitive, for example, lineLength and LineLength are two
different names.

Jan-10

219

Copyright 2009 Bentley Systems, Incorporated

Scripting Basics

GCScript Basic Components

Keywords
A keyword is a name that has a special meaning within the language, and
therefore cannot be used as the name of a variable or other symbol. Following is
a complete list of GCScript keywords.
as

enum

namespace

this

break

false

new

true

breakpoint

for

null

typeof

case

foreach

optional

using

class

function

out

void

const

global

params

while

continue

goto

ref

default

if

replicatable

do

in

return

else

is

switch

Keywords appear in blue text in the Script Editor.

Fundamental Types
The following types are built-in to the GCScript language processor.

bool
A bool value represents either true or false.
char
A char value represents a single text character. You specify a char value by
enclosing it within apostrophe characters. For example,
'm'
'4'
'?'
To specify an apostrophe character, itself, preface it with a backslash within the
outer apostrophes. For example,

Scripting Basics

220

Copyright 2009 Bentley Systems, Incorporated

Jan-10

GCScript Basic Components

\
To specify a backslash character, itself, preface it with another backslash within
the apostrophes. For example,
'\\'

datetime
A datetime value represents a point in time ranging from year 0001 A.D. through
year 9999 A.D., precise to the millisecond (thousandth of a second).
new datetime(year, month, day, hour, minute, second, millisecond)

Each item in the list is an integer.

year ranges from 1 through 9999.

month ranges from 1 through 12.

day ranges from 1 through the number of days in that month.

hour ranges from 0 through 23 (o.e., a 24-hour clock).

minute ranges from 0 through 59.

second ranges from 0 through 59.

millisecond ranges from 0 through 999.

Any of the items may be omitted from the end of the list; those items are treated
as zero.
For example:
new datetime(2007,2,12)

This represents the date February 12th, 2007.

double
A double value represents a floating-point (real) number ranging from -10E08
through +10E08, with approximately 14 digits of precision.
Double values are distinguished from integer values by the presence of a decimal
point.

Jan-10

221

Copyright 2009 Bentley Systems, Incorporated

Scripting Basics

GCScript Basic Components

Extremely large or extremely small double values can be expressed in scientific


notation, where the power of ten is indicated by the character e (or E). In this
case, the decimal point is optional.

function
A function value represents an independent block of GCScript statements. This is
covered in more depth in a later section. For example:
function(x, y) { return x + y; }

int
An int value represents an integer ranging from -2,147,483,648 through
+2,147,483,647.

long
A long value represents an integer ranging from -9,223,372,036,854,775,808
through +9,223,372,036,854,775,807.
Unless you have specific reason to use the long type, you should instead use the
int type, which operates much faster.

object
The object type is a universal type: Any item of any type can be automatically
converted to and from an object type.
Another way of saying this is: Every value is an object, in additional to whatever
other type it is.
There are no specific examples of object types, because all of the examples
herein can be examples of object types!

string
A string value represents a sequence of text characters, treated as a single unit.
To specify a string, enclose the text characters within quotation characters. It
doesnt matter whether the text would otherwise be interpreted as a value of
another type. For Example:
bebo ergo sum

Scripting Basics

222

Copyright 2009 Bentley Systems, Incorporated

Jan-10

GCScript Basic Components

12.34
// an empty string
To include a backslash character, itself, within a string, preface it with another
backslash. For example:
C:\\My Files\\Survey Data.xls

timespan
A timespan value represents a length of elapsed time, measured as days + hours +
minutes + seconds + milliseconds (thousandths of a second).
new timespan(days, hours, minutes, seconds, milliseconds)
Each item in the list is an integer. Any of the items may be omitted from the end
of the list; those items are treated as zero.

type
A type value represents a data type, itself.

typeof(type)
Examples:
typeof(int)
typeof(timespan)

Variables
A variable is a storage area that can hold a value, and it is labeled with a name.
The stored value can be retrieved simply by using the variables name.
You can store as many values as you want into a variable, but only one value at a
time. Each new value replaces the previous value.

Declaring Variables
Before you can use a variable for the first time, you must declare it. This means
telling GCScript the name of the new variable, and the type of values you expect
to store into it. For example:

Jan-10

223

Copyright 2009 Bentley Systems, Incorporated

Scripting Basics

GCScript Basic Components

int poleCount
string levelName
bool isImageInverted
As a convenience, you can define multiple variables of the same type with one
statement.
double minorRadius, majorRadius, angle, chordLength
Each variable may contain only a value of the type that you specified in its
declaration. For example, a variable of type int can contain any of the values 5,
1094, or -13, but not the string value one dozen.
Sometimes, you dont know precisely what types of values will be stored into a
variable, or you want to be able to store different types at different times. In that
case, you can use the generic type, object. An object-type variable can hold any
value of any type because every value is an object, in addition to whatever other
type it is.
object resultOfOperation // Could be a number or perhaps an error message.

Storing a Value into a Variable


By default, every newly-declared variable contains the special value null, which
effectively means no value.
To store a value into a variable, you use the assignment operator, an equals sign.
name = expression
This means, calculate the expression and store its result into the variable,
replacing the variables previous contents.
poleCount = 300
levelName = "Lighting Fixtures"
isImageReversed = false
As a convenience, you can declare a new variable and store a value into it at the
same time.
int cardsInDeck = 52

Scripting Basics

224

Copyright 2009 Bentley Systems, Incorporated

Jan-10

GCScript Basic Components

Retrieving Values from Variables


To retrieve a value from a variable, you simply use the name of that variable.
Within GCScript expressions (formulas), the names of variables serve as
placeholders for the actual values that will be used when the expression is
processed.
newBalance = previousBalance + deposit
fenceLength = 4 * (patioDiameter + 20)
myAge = new datetime(2007,2,12) myBirthDate

Variable Operators
Variable operators provide a convenient way to modify a variables value based
on its current value.
For example, instead of saying
accountBalance = accountBalance + deposit
you can say
accountBalance += deposit
which has the same effect.

Variable Operations Are Expressions


Although variable operations are usually used as statements, theyre actually
expressions, which can be used within the context of larger expressions or
statements.
Except as noted, the result of a variable operation is the resultant value of the
variable.
For example, this sequence of statements:
accountBalance += deposit;
if (accountBalance > 500.00)
Print(Checks may now be written for free.)
Can be shortened to this:
if ((accountBalance += deposit) > 500.00)

Jan-10

225

Copyright 2009 Bentley Systems, Incorporated

Scripting Basics

Some additional thoughts

Print(Checks may now be written for free.)


The best form for you depends on your own programming style.

Some additional thoughts


There are several ways to start scripting. Each way has its benefits and after some
experience you will find a way that works best for you.
There are only really two important things in scripting, loops and conditional
statements. Most everything else can be built up from a combination of these
two.
Loops do something many times. The Loop sets up some conditions and then do
something repetitively until that condition is met.
Conditional statments are of the form: if this is true then do the following
otherwise, skip past this section of code. It is a quick and easy way to ask a
question and to make a decision about your data.

Exercise: First For Loop


1

Continue in the same file and open the Script Editor.

Make the following changes in bold text:


function (CoordinateSystem myCS)
{
double XValue = {};
//creates an empty list, that is ready to be filled

for (int i = 0; i < 10; i++)


//this is the loop control line, more below about this
{
XValue[i] = i; //the number at position i in the list is i
}
//from here is the same as before
Point myPoint = new Point();
myPoint.ByCartesianCoordinates(myCS, Xvalues, 2, 2);
return myPoint;

Scripting Basics

226

Copyright 2009 Bentley Systems, Incorporated

Jan-10

Some additional thoughts

Lets examine each new line.


double XValue = {};
double

this is the type variable you are declaring.

XValue

is the variable name

is saying equal to an empty list. Implying you will add more than one
number here.
= {}

is the end of statement.

for (int i = 0; i < 10; i++)


for
(

declares that you are writing a for loop.

start of for loop declaration.

declares a variable, i, for use within the loop. This variable is our
counter and is set to start at 0.
int i = 0;

sets the condition, for a value of i of less than ten then continue into the
loop, if the value for i is 10 or greater then exit the loop now (without going
through the loop).
i < 10;

i++
)

says to increment i by 1 each time it completes the loop.

end of loop declaration.

{
XValue[i] = i; //the number at position i in the list is i
}
{

opens for loop statement.

XValue[i]
= i

Jan-10

is the instance in the set of XValue, for example, XValue[0], XValue[1]

says the indexed value is equal to the index number. For example,

227

Copyright 2009 Bentley Systems, Incorporated

Scripting Basics

Point ByFunction Script

XValue[0]=0, XValue[1]=1, ... , XValue[9]=9


;

close the for loop statement.


3

Click on OK and Apply.


You should now see 10 points.

Point ByFunction Script


In this exercise you will build up a function-based script to create a Point feature,
using ByCartesianCoordinates as the update method. THen turn the point into a
circle of points, then a spiral of points, then replicate the spiral and addpoint to
the sprial, then modify the sprial tops, then create polygons in-between the
spirals.

Exercise: Create a new file


1

From the File menu select New File.

Name the transaction file point_script.dgn.

You will be creating a point feature using the Feature Type list, but rather than
using one of the model based methods to define it, you will use a function.

Exercise: Create a Point using the ByFunction update method


1

In the GenerativeComponents dialog, scroll to Point in the Feature Type


list, expand it and then expand the ByFunction update method.

Optionally, you can do this as a GraphFunction feature type.

Scripting Basics

Click in the Function expression field and click the script editor icon to
open a script editor where you will create the function.

Click the Statement Builder tool in the script editor.

228

Copyright 2009 Bentley Systems, Incorporated

Jan-10

Point ByFunction Script

You see a list of script statement templates that make it easier to create
standard scripting expressions. You will use it to create a transaction
wrapper.
4

Double click function.

The brackets {} denote the beginning and the end of the function body.
Inside the parenthese, the word arguments is the placeholder for any
input arguments you may define for the function. You define the input
arguments by replacing the placeholder with your own inputs for this
specific function.

Since you want to create a Point ByCartesianCoordinates, you need to


reference a coordinate system. To do so, you need to specify the Feature
Type of the input argument and a variable name that will contain the
input value, within the boundaries of the function.
This concept is also referred to as scope. It means the variable you define
here is only defined within the scope, or range, of this function.
You can use any variable name, but to make it easy to understand, you will
use cs, short for CoordinateSystem. You will declare it to be of Type
CoordinateSystem. Be sure to type things in exactly as shown. Syntax is a
killer!
5

Jan-10

Replace the word argument with the following:

229

Copyright 2009 Bentley Systems, Incorporated

Scripting Basics

Point ByFunction Script

CoordinateSystem cs

Next you need to define a variable of Type Point to hold the Point feature
inside the function.
6

Declare a new Point variable and call it pt01.

Click the fx tool to open the Script Expression Builder.

Click the Feature Types tab.

Scroll to the Point feature type and expand it.

10 Select new Point(parentFeature) and click Insert.

You want the Point in the function to become a parent of the Point
feature you are creating using the ByFunction update method.
The reason for creating the Point as a child to the top level Point in the
function is so you can refer to it using the same name as its parent. This is
useful if you make a list of points later.

Scripting Basics

230

Copyright 2009 Bentley Systems, Incorporated

Jan-10

Point ByFunction Script

11 Click Close.

In order to complete this step you need to replace the parentFeature


placeholder with a reference to the parent. You want the parent to point
to the Point in which you are creating the function.
12 Replace the string parentFeature with the keyword this to indicate the

reference to the parentFeature.


this appears in blue because it is a keyword.
13 The last step is to add a semi-colon at the end of the line to indicate that it

is the end of the expression.

Although you initialized the Point, pt01, it still is not created. To do so you need to
select an update method from the list for Points. You will use
ByCartesianCoordinates.
You will use the variable pt01 that refers to the new Point object to call the
update method using the dot operator. Once you type pt01, a list of available
update methods will display.

Exercise: Instantiating the Point feature using ByCartesianCoordinates


1

Continuing in the script editor, press Enter and then type


pt01

Jan-10

Double click the ByCartesianCoordinates update method in the menu.

231

Copyright 2009 Bentley Systems, Incorporated

Scripting Basics

Point ByFunction Script

Add a open parenthesis (.


The result appears as follows.

You must insert the input arguments with values, or variables, that are
valid to the function.
4

Add the following:

CoordinateSystem is replaced with a reference to your input argument


CoordinateSystem, which is named cs in this function

Replace the X, Y, and Z translations with fixed values 3, 1, and 0

[, Origin} is an optional value which you will not use for now, so
remove it

Type a semi-colon.
The function appears as follows.

Click OK in the lower right of the dialog to save the script.

Now that the function is complete, you need to pass it one input argument, since
you defined an input argument of Type CoordinateSystem.

Exercise: Using the ByFunction update method with input arguments


1

On the New Feature tab of the GenerativeComponents dialog, enter


{baseCS} in the FunctionArguments field.

Click OK.
This passes the argument to the function through the cs variable you
defined as the ByCartesianCoordinates update method, and that creates

Scripting Basics

232

Copyright 2009 Bentley Systems, Incorporated

Jan-10

List Points with a Loop script

the Point at x=3, y=1, and z=0. The Point appears in red, as a child feature
of the top level Point point01 that hosts the function.

Select the Transaction File tab, click Record User Changes.

Click Save.

Hint: Remember to Save often during the remainder of these exercises.

List Points with a Loop script


Once you have created a Point feature you can use a For programming loop to
create multiple instances of it. This is similar to using a Series as an input to the X
position. However, in this case you are writing the script yourself rather then
using an existing global function like Series. This gives you more flexibility later.

Jan-10

Exercise: Adding a For loop

233

Copyright 2009 Bentley Systems, Incorporated

Scripting Basics

List Points with a Loop script

Select the Edit Feature tab and click on the Script Editor icon in the
Function expression field.

Place the pointer into a new line after the opening bracket of the function,
right click and select Statement Builder.

Double click for in the menu.

Note: To indent a section, highlight the lines and click the Increase Line Indent

tool in the tool bar.

Scripting Basics

234

Copyright 2009 Bentley Systems, Incorporated

Jan-10

List Points with a Loop script

Replace the count placeholder with the value of 10 and move the closing
bracket of the For loop after the pt01.ByCartesianCoordinates statement.

You usually use single letters such as i, j or k as the index variable. Count specifies
how many times the content in the loop is being run. You can use 10 as a fixed
value and replace it later with a variable that may become an input argument, like
cs, to change the number of Points from the outside.

The For loop statement


You have the statement:
for (int i = 0; i < 10; i++)
It declares a local variable i of Type int (integer), sets its start value to 0, and
increments its value by 1 based on the statement ++i, which adds 1 every time
the loop is iterated, as long as i<10.
The Point creation inside the For loop creates ten Points, but they will all be
positioned in the same location. You need to adapt their X position with respect
to the loop variable, i.

Exercise: Using the For loop variable


1

In the script editor change the X position of pt01 by editing the line as
follows:
pt01.ByCartesianCoordinates(cs, 3*i, 1, 0);
This will increment the X position of the Point by 3 with each cycle of the
loop.

Jan-10

Click OK to close the script editor

235

Copyright 2009 Bentley Systems, Incorporated

Scripting Basics

List Points with a Loop script

Click Apply.

Geometric view after applying changes to the Point function

If you want to control the number of Points through the input arguments, rather
than using the hard coded 10, you can add it to the input argument list.

Exercise: Making the number of for loops an input variable


1

Open the Script Editor in the Function expression field.

Add a new argument called num to the input arguments, separated by a


comma, and of Type int.
function (CoordinateSystem cs, int num)

Replace the explicit value 10 in the For loop with the new variable, num.
for (int i = 0; i < num; ++i)

Scripting Basics

236

Copyright 2009 Bentley Systems, Incorporated

Jan-10

List Points with a Loop script

Click OK to close the script, and then click Apply.

The error in the GCScript Debugger indicates that the Function requires at
least 2 arguments, but only 1 was provided. This means that you did not
add a second argument in the argument list to the ByFunction update
method.
5

Close the GCScript Debugger window.


Add a value to {baseCS} for the second argument.

Type {baseCS,5} and click Apply.


This will produce 5 Points.

Run the transaction, Name it For Loop and Record User Changes.

Click Save.

In order to describe more complex forms then a straight line you can use the
Cosine and Sine equations to define the X, Y, Z position of the point list. You start
with the script from you created and add variables of Type double for xPos, yPos
and zPos.

Jan-10

237

Copyright 2009 Bentley Systems, Incorporated

Scripting Basics

List Points with a Loop script

Start with xPos and yPos only to specify the Points to form a circle. Using
trigonometry you can define a circle with Cos for the xPos and Sin for the yPos.
The following expression gives a unit circle, meaning a circle with a radius of 1.
double xPos = Cos(360/num*i);
double yPos = Sin(360/num*i);
pt01.ByCartesianCoordinates(cs, xPos, yPos, 0);

Using simple equations to describe forms

Scripting Basics

Exercise: Defining the X,Y,Z position using a Sine and Cosine equation
1

On the Transaction File tab, expand the For Loop transaction, then expand
point01. Click in the Function field and open the script editor.

Add xPos and yPos variables and replace the hard coded X and Y values.

238

Copyright 2009 Bentley Systems, Incorporated

Jan-10

List Points with a Loop script

Jan-10

To control the radius, create a radius variable of Type double, value = 5


and multiply the result of the Sin and Cos function with the radius.

Click OK.

239

Copyright 2009 Bentley Systems, Incorporated

Scripting Basics

List Points with a Loop script

The result would appear as follows, using a radius of 5 and the number of
points (num) set to 25.

With a simple addition you can make a climbing spiral of fixed radius from the
circle by defining the zPos to be a factor of the i variable.

Exercise: Making a spiral based on the circle


1

Open the script and add the following line after the yPos definition:
double zPos = i;

Edit the line to add the zPos variable:


pt01.ByCartesianCoordinates(cs, xPos, yPos, zPos);

To make the climbing rate independent of the number of points on the


circle you may want to add a total height variable to create a spiral. You
can replace the i assignment for zPos with a step that is a fraction of the
total height based on the number of points in the circle. The total height
becomes another input variable.

Scripting Basics

240

Copyright 2009 Bentley Systems, Incorporated

Jan-10

List Points with a Loop script

Add the input variable double h.

The zPos will be defined by the height h divided by the number of steps,
times the current loop count i, or zPos = h/num*i.

Click OK.
Height (as defined by h) is now an input argument and needs to be
added to the FunctionArguments expression field. Youll also change the
number of points to 25 if you have not already done so.

Jan-10

Change 5 to 25 and add a height of 20.

Play the transaction and Save.

241

Copyright 2009 Bentley Systems, Incorporated

Scripting Basics

List Points with a Loop script

You must rotate the view dynamically (Shift+Middle Mouse Button click)
and see result.

You have a spiral with a constant radius. Now you will make the radius adjust
based on the height of the point to create a more interesting outline. To achieve
this you will replace the simple assignment radius = 5 with a Sine expression
based on the i count.
You will reduce the range of the Sine function to one that creates positive values
only, so that there is no crossing of the spiral over the central axis.

Exercise: Adjusting the radius of the spiral as a function of height


1

Open the script and change the radius definition to the following:
double radius = Sin(180/num*i)*5;

Five is the scaling factor for the maximum radius when the sine function
returns a value of 1. Remember sine varies from 0 to 1.

Scripting Basics

242

Copyright 2009 Bentley Systems, Incorporated

Jan-10

List Points with a Loop script

Click OK.

Change the FunctionArguments expression so it creates 45 points:


{baseCS, 45, 20}

Play the transaction and Save.


This creates a spiral with its StartPoint and its EndPoint at x and y = 0.

Rotated view

Top view

Jan-10

243

Copyright 2009 Bentley Systems, Incorporated

Scripting Basics

List Points with a Loop script

Think of the spiral defining a path on a possible surface for a tower. For instance,
one similar to free-form towers such as Fosters Swiss Re or Jean Nouvels Torre
Agbar tower in Barcelona.

You may want to adjust the range 0-180 degrees so that the spiral does not start
at 0 at the towers base. To reduce the range to 80-180 degrees you will scale the
loop range defined by i to cover the difference between 80 and 180 or 100, and
then shift those results by 80 so the start value is 0+80 =80 and the end value
100+80=180.

Exercise: Adjusting the spiral


1

Open the script editor and change the radius expression to the following:
double radius = Sin ((100/num*i)+80) *5;

Scripting Basics

Click OK.

244

Copyright 2009 Bentley Systems, Incorporated

Jan-10

List Points with a Loop script

Play the transaction and Save.

Rotated view

Top view

The new spiral has a base that is wider at the bottom, but converges to a
point at the top.
Now you will create a variable number of spirals in a circular pattern to create a
Point cloud which you could use to define a surface. To do this you will add a
second For loop surrounding the inner loop that is used to start each spiral at a
different point in the circle.

Jan-10

245

Copyright 2009 Bentley Systems, Incorporated

Scripting Basics

List Points with a Loop script

Exercise: Replicating the spiral in a circle to define a Point Cloud


1

Open the script editor.

Right click above the first For loop, select Statement Builder, and double
click for in the menu.

Change i in the outer For loop to j so the counter variable does not conflict
with i, which is already being used.

Move the closing For loop curly bracket so it is after the closing bracket of
the inner for loop.
Use the Increase and Decrease Line Intent tools as necessary.

Scripting Basics

Add another input argument to define the number of spirals around the
perimeter of the tower named spNum and of Type int.

246

Copyright 2009 Bentley Systems, Incorporated

Jan-10

List Points with a Loop script

Replace count in the For loop with spNum.

You now need to adjust the xPos and yPos definitions to take the changing
starting Point of the spirals into account, otherwise all the spirals appear
in the same spot and it will look like you have one spiral.
You shift the value inside the Sine and Cosine function with each new
spiral by a fraction of 360 degrees.
Define this as the variable shift and define it again as a fraction of the
overall circle 360 (360/spNum where spNum is total number of spirals)
multiplied by the spiral number counter from the outer for loop j.
7

Add following the variable, before the radius variable:


double shift = 360/spNum*j;

Add this shift value to the values in the Sine and Cosine expression of xPos
and yPos:
double xPos = Cos((360/num*i) + shift)*radius;

Jan-10

247

Copyright 2009 Bentley Systems, Incorporated

Scripting Basics

List Points with a Loop script

double yPos = Sin((360/num*i) + shift)*radius;

Click OK.

10 Add a value in the FunctionArguments expression field for spNum.

For example, {baseCS, 45, 20, 12}


11 Play the transaction and Save.

Rotated view

Scripting Basics

248

Copyright 2009 Bentley Systems, Incorporated

Jan-10

List Points with a Loop script

Top view

Using the same script structure but a different set of equations one can generate
different tower outlines. Rounding of the top of tower can be done with cubic
function.
The difference here is that the height of the spiral is defined by the function (not
h) and the radius is defined by the even increments. This is necessary in order to
flip the x and y axis to fit the tower. It also is mirrored to not stand upside down
and shifted to start at the z=0 level.
The Function Pow is double Pow (double x, double y). The result is x raised to the
y power.
To do this you use the cubic equation to define hShift to be the incremental shift
in height through the loop and start with an inverted cubic (height) by using the
minus sign. Otherwise, the tower would be upside down. Youll make it based on
i, so that you draw circles that converge cubically in height. A good place to find
3D information like this is:
http://mathworld.wolfram.com

Exercise: Modifying the top of the tower


1

Make the following modifications, indicated in bold, to your script:

for (int i = 0; i < num; ++i)


{

Jan-10

249

Copyright 2009 Bentley Systems, Incorporated

Scripting Basics

Generating Polygons

double radius = i;
double shift = 360/spNum*j;
double hShift = ((1.0/num)*(Pow((num-1),3))*0.2);
double height = ((-1.0/num) * (Pow(i,3))*0.2)+ hShift;
double xPos = Cos((360/num * i) + shift)*radius;
double yPos = Sin((360/num * i) + shift)*radius;
2

Delete: double zPos = h/num*i;

Using other functions for hShift and height you can control the form of the circles
in height.

Generating Polygons
The generation of the Surface or the Polygons could also be integrated into the
function itself but then the parent Feature would have to be of the Type of the
final outcome and the Point would become an internal Feature that is not drawn.
The script would adapt for the last tower case, using a Polygon.ByFunction
method because the Feature that is supposed to be drawn and seen is a Polygon
not the Point. Generally, one should not mix Feature Types for children.
The method is to remove the return type and instead creates a Polygon variable
called poly here and makes it a child of the Polygon created ByFunction method
using the this keyword as in the beginning of the Point function example. The
Points are not parented to anything but only passed into the Polygon.ByPointGrid
method and therefore are not displayed in the final result.
Remember this script has to be placed inside the Polygon.ByFunction method,
not, as in the previous example, in the Point.ByFunction method. This is because
you are making the Polygon a child of the parent Polygon.

Exercise: Generating Polygons


1

Cut and Paste the code from the Point feature to the Polygon feature,
with Update Method ByFunction.
With a GraphFunction we could called it in either the point or polygon
feature type.

Scripting Basics

Replace or add the lines in bold:

250

Copyright 2009 Bentley Systems, Incorporated

Jan-10

Generating Polygons

function (CoordinateSystem cs, int num, int spNum)


{
Point pt01 = {};
for (int j = 0; j < spNum+1; ++j)
{
pt01[j] = {};
for (int i = 0; i < num; ++i)
{
double radius = i;
double shift = 360/spNum*j;
double hShift = ((1.0/num)*(Pow((num-1),3))*0.2);
double height = ((-1.0/num) * (Pow(i,3))*0.2)+ hShift;
double xPos = Cos((360/num*i) + shift)*radius;
double yPos = Sin((360/num*i) + shift)*radius;
pt01[j][i] = new Point();
pt01[j][i].ByCartesianCoordinates(cs, xPos, yPos, height);
}
}
return new Polygon().ByPointGrid(pt01);
}

Jan-10

251

Copyright 2009 Bentley Systems, Incorporated

Scripting Basics

Generating Polygons

You can now attach the cross bar or the pyramid to the replicated polygon.

Polygon grid (alternative)


To add a transaction just type in the following around your functions:
transaction modelBased First Point
{
function ...
}

Scripting Basics

252

Copyright 2009 Bentley Systems, Incorporated

Jan-10

Generating Polygons

For example:
transaction modelBased "First Point"
{
feature point01 GC.Point
{
Function

= function (CoordinateSystem cs)


{
Point pt01 = new Point(this) ;
pt01.ByCartesianCoordinates(cs, 3, 1, 0);
};

FunctionArguments

= {baseCS};

}
}
transaction modelBased "For Loop"
{
feature point01 GC.Point
{
Function = Point [][] function (CoordinateSystem cs, int num, double h, int spNum)

{
Point pt01 = {};
for (int j = 0; j < spNum+1; j++)
{

Jan-10

253

Copyright 2009 Bentley Systems, Incorporated

Scripting Basics

Generating Polygons

pt01[j] = {};
for (int i = 0; i < num+1; i++)
{
double shift = 360/spNum*j;
double radius = Sin ((100/num*i)+80)*5;
double xPos = Cos(360/num*i + shift) * radius;
double yPos = Sin(360/num*i + shift) * radius;
double zPos = h/num*i;
pt01[j][i] = new Point();
pt01[j][i].ByCartesianCoordinates(cs, xPos, yPos, zPos);
}
}
return pt01;
};
FunctionArguments

= {baseCS, 45, 20, 12};

}
}

transaction modelBased "B-spline surface", suppressed


{
feature bsplineSurface01 GC.BSplineSurface
{

Scripting Basics

254

Copyright 2009 Bentley Systems, Incorporated

Jan-10

Generating Polygons

Points

= point01;

}
}
transaction modelBased "Polygon Grid"
{
feature polygon01 GC.Polygon
{
Points

= point01;

}
}
Results are seen on the Transaction File tab.

You can now use the New Feature tool to add crossbars to the polygon.

Jan-10

255

Copyright 2009 Bentley Systems, Incorporated

Scripting Basics

More Scripting Examples

More Scripting Examples


These examples illustrate the different ways scripts can be used in
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 GenerativeComponents.

B-Spline Curve
The first example uses a script transaction that creates a set of top level Point
Features. Therefore the Features appear as individual Points in the Symbolic view
and can be referenced by their top level name. The disadvantage of this approach
is that the points are separate from the script that generated them and will only
be regenerated if the transaction script is replayed.
Exercise: Creating a Script

Create a new GCT file.

From the Transaction tab open the Script Editor and type in the following
script:

transaction 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 modelBased "First BSpline curve using full point Features"

Scripting Basics

256

Copyright 2009 Bentley Systems, Incorporated

Jan-10

More Scripting Examples

{
feature curve1 GC.BSplineCurve
{
Points = {p_0, p_1, p_2, p_3, p_4, p_5, p_6, p_7, p_8, p_9};
SymbolXY = {103, 103};
Color

= 2;

}
}

B-Spline curve using child Feature points


In this script the Points are created inside a ByFunction method. They are defined
as children of the Top level parent Feature point2 by using the this keyword. This
way all the Points are added to a List which in turn can be passed to the
BSplineCurve.ByPointsOnCurve method to create a BSplineCurve.

Exercise: Create a second script


1

Create a new script in the script editor.

transaction modelBased "Point (compound) defined by internal function"

Jan-10

257

Copyright 2009 Bentley Systems, Incorporated

Scripting Basics

More Scripting Examples

{
feature points2 GC.Point
{
Function = function (CoordinateSystem cs, int num, double 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 = {baseCS,10,1};
SymbolXY

= {102, 99};

}
}
transaction modelBased "Second (using child Feature points) BSpline curve"
{
feature curve2 GC.BSplineCurve
{
Points
SymbolXY
Color

Scripting Basics

= points2;
= {103, 99};
= 4;

258

Copyright 2009 Bentley Systems, Incorporated

Jan-10

More Scripting Examples

}
}

B-Spline curve defined by internal function


The third option uses a light weight geometry provided for generating large
amounts of geometry without the overhead of the full Features. These DSeries
geometric elements are created temporarily and use very little memory in the
system and therefore are a fast and robust way to script geometry when only the
minimal geometric information is needed. There are a number of Features that
have methods that can directly use DSeries geometry to create Features such as
the ByPointsOnCurveAsDPoint3ds method for the BSplineCurve.
transaction modelBased Third (using DSeries lightweight points) B-spline curve
defined by internal function
{
feature curve3 GC.BSplineCurve
{
Function = function (CoordinateSystem cs, int num, double scale)

Jan-10

259

Copyright 2009 Bentley Systems, Incorporated

Scripting Basics

More Scripting Examples

{
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 = {baseCS,10,1};
SymbolXY

= {103, 97};

}
}

Scripting Basics

260

Copyright 2009 Bentley Systems, Incorporated

Jan-10

More Scripting Examples

Fourth B-Spline curve only as point


The forth option is not showing either Points nor BSplineCurve but generates
them as DSeries geometry and as internal Features only. Even though the
geometry is not visible, it still can be used as input for other Features, such as the
Point shown.
transaction modelBased "Fourth BSpline curve only as point"
{
feature p5T GC.GraphVariable
{
Value

= 0.5;

LimitValueToRange

= true;

RangeMinimum

= 0.0;

RangeMaximum

= 1.0;

SymbolXY

= {109, 98};

}
feature point4 GC.Point
{
Function = function (CoordinateSystem cs, int num, double scale, double 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);

Jan-10

261

Copyright 2009 Bentley Systems, Incorporated

Scripting Basics

More Scripting Examples

}
BSplineCurve childBSpline = new BSplineCurve();
childBSpline.ByPointsAsDPoint3ds(cs, dPoint);
this.ByParameterAlongCurve(childBSpline,t);
};
FunctionArguments
SymbolXY

= {baseCS, 10, scale, p5T};


= {104, 95};

}
}
Sequence these scripts as four separate transactions in one gct file.

Creating a user defined function


Creating a user defined GraphFunction is possible by simply defining a
GraphFunction Feature. A GraphFunction can be anything that can be written in a
GCScript. It may be a mathematical function similar to Cos or Sin, or it may be a
data processing function that sorts Lists or used to create geometry.
An example of a user defined GraphFunction is shown here, it is creating a series
of Points along a curve and makes these points children of the GraphFunction you
are defining. Here the replication happens by creating several point instances and
making them children of the GraphFunction Feature using the this keyword.
transaction modelBased "create graph function A"
{
feature pointsAtParamterAlongCurve_A GC.GraphFunction
{
Definition = bool function (ICurve supportCurve, int numPoints)
{

Scripting Basics

262

Copyright 2009 Bentley Systems, Incorporated

Jan-10

More Scripting Examples

double t_spacing = 1.0/(numPoints-1);


for (int i = 0; i < numPoints; ++i)
{
Point childPoint = new Point(this);
childPoint.ByParameterAlongCurve(supportCurve, i*t_spacing );
}
return true;
};
}
}
Another example of a user defined function in this case the GraphFunction
Feature becomes the parent of the Points created and the replication happens by
passing a List of T values to the ByParameterAlongCurve method.
transaction modelBased "create graph function B"
{
feature pointsAtParamterAlongCurve_B GC.GraphFunction
{
Definition = bool function (ICurve supportCurve, int numPoints)
{
double t_spacing = 1.0/(numPoints-1);
double t_space_list = {};
for (int i = 0; i < numPoints; ++i)
{

Jan-10

263

Copyright 2009 Bentley Systems, Incorporated

Scripting Basics

More Scripting Examples

t_space_list[i] = i*t_spacing;
}
this.ByParameterAlongCurve(supportCurve, t_space_list );
return true;
};
}
}
An example of a mathematical GraphFunction you define, could be a very simple
user-defined square function. You would define one input argument of type
double to allow a user to specify the value to be squared. Then you can define a
local variable to store the result of your calculation called result. Finally, you need
to return that variable so the GraphFunction square_user(3) returns the value 9,
for instance, and can be used anywhere where a double value is expected.
transaction modelBased "create a square function"
{
feature square_user GC.GraphFunction
{
Definition = double function (double number)
{
double result = number * number;
return result;
};
}
}

Scripting Basics

264

Copyright 2009 Bentley Systems, Incorporated

Jan-10

References

Once this function is defined you can use it to define for instance the Xtranslation
of a Point Xtranslation = square_user(3);
And Xtranslation will take on the returned value of the function, in this case
3*3=9,

References

Jan-10

http://mathworld.wolfram.com

Numerical Recipes in C++, Second Edition, Saul A. Teukolsky

265

Copyright 2009 Bentley Systems, Incorporated

Scripting Basics

References

Scripting Basics

266

Copyright 2009 Bentley Systems, Incorporated

Jan-10

Design Problems
Module Overview
Several Design Problems are worked out for you in this module.

Module Prerequisites

Knowledge of Features, Functions and Transactions

Module Objectives
After completing this module, you will be able to:

Tunnel with Crossbar roof

Conveyor Belt design

Module Glossary
Hierarchical Control
Theory of the control of large systems which is always organized in a distributed
hierarchy. In all kinds of hierarchical systems, the common feature is the fact that
the decision-making process has been divided. There are several decision-maker
units in the structure, but only some of them directly access the control system.
The other decision-maker units are at a higher level on the hierarchy and they
define the tasks and coordinate the lower units.

Jan-10

267
Copyright 2009 Bentley Systems, Incorporated

Design Problems

Tunnel with a Crossbar Roof

Reference
Mesarovic, Macko, and Takahara book called Theory of Hierarchical, Multilevel
Systems. Also, Bailey, and Brdys wrote the book Control and Coordination in
Hierarchical Systems.

Free Form Surfaces


Free form surface, or free form surfacing, is used in CAD and other computer
graphics software to describe the skin of a 3D geometric element. Freeform
surfaces do not have rigid radial dimensions, unlike regular surfaces such as
planes, cylinders and conic surfaces. Most systems today use nonuniform rational
B-spline (NURBS) mathematics to describe the surface forms; however, there are
other methods such as Gorden surfaces or Coon surfaces.
The forms of free form surfaces (and curves) are not stored or defined in CAD
software in terms of polynomial equations, but by their poles, degree, and
number of patches (segments with spline curves). The degree of a surface
determines its mathematical properties, and can be seen as representing the
shape by a polynomial with variables to the power of the degree value. For
example, a surface with a degree of 1 would be a flat cross section surface. A
surface with degree 2 would be curved in one direction, while a degree 3 surface
could (but does not necessarily) change once from concave to convex curvature.
Some CAD systems use the term order instead of degree. The order of a
polynomial is one greater than the degree, and gives the number of coefficients
rather than the greatest exponent.

Tunnel with a Crossbar Roof


The exercise will start with a new file and all geometry will be defined.

Design Problems

Exercise: Create a new file


1

Select the New File icon or File > New.

Arrange the windows in such a way that they don't overlap and both the
Symbolic view and the Geometric view are visible as well as the GC control
panel.

Save the file with the name reactor.dgn.

268

Copyright 2009 Bentley Systems, Incorporated

Jan-10

Tunnel with a Crossbar Roof

Remember that GC does not save geometry, but the instructions to


generate geometry, so the .gct file cannot be opened in MicroStation or
other CAD programs directly.
To begin the model select the Create Point tool and place four points in an
isometric view. These points are the base for the path that goes through the
landscape.

Jan-10

Exercise: Placing the Path Control Points


1

Select Create Point and place four points. in the Isometric view.

Select New Feature.

Click on the BSplineCurve feature and expand it.

From the available feature method (the different possible ways to create
this feature based on various combinations of inputs) select ByPoles.

269

Copyright 2009 Bentley Systems, Incorporated

Design Problems

Tunnel with a Crossbar Roof

The Poles variable expects a List of points to create a BSplineCurve. The


syntax for a List in GC is: {point1, point2, point3} where each element is
separated by commas between opening and closing curly brackets {}.
5

In order to construct the list of points, click in the Poles input field.

To select an existing feature, hold down the Ctrl key, then hover over the
point in the Geometric or Symbolic view until the name of the feature
appears in the input window. Clicking will confirm the selection and add a
comma. Repeat until all four points are filled in, then press Enter to
confirm the selection.

In the Order field fill in: 3.


This is the order of the BSplineCurve. The Order is maximum the number
of Control Points, which is 4. It defines the type of curve that is
constructed from the point, an Order of 2 would create a line. Maximum
order is 15 and minimum is 2.

To complete the command click OK.


You should now see a BSplineCurve that follows the control polygon
defined by the four points.

Record User Changes into Transaction file.

The next step is to create some working planes that are parallel and
perpendicular to the path.

Design Problems

Exercise: Creating the Planes

270

Copyright 2009 Bentley Systems, Incorporated

Jan-10

Tunnel with a Crossbar Roof

Click Create Feature, or click Create New.

Select Feature Type Plane and select the Update Method as


ByParameterAlongCurve.

Select BSplineCurve01 by holding down the Ctrl key as your Curve.

For the T Parameter, type in 0.5, and then press Enter.

Use Edit Feature and select plane01, then right click on the T variable and
make sure the free option is checked so the plane can be moved along the
curve for testing.

Select the Move Feature and click on the red circle handle that is around
the plane you just created. and test the attachment to the curve.
Now you will create a second plane that will be horizontal at all times.

Select Create Feature and choose Plane and choose


ParallelToPlaneThroughPoint as the Update Method.
For the Origin, you want the new Plane to follow the initial Plane on the
path so you can intersect the two.

Select plane01 using the Ctrl key, as the origin.


As the ReferencePlane, you will use the baseCS.XYPlane of the baseCS
CoordinateSystem.

First select the baseCS, pressing the Ctrl key, and then type a period after
the feature name.
A menu containing valid parameters opens.

10 Select the XYPlane from that list by double clicking on it and then click OK.

11 Record User Changes into Transaction file.

Jan-10

271

Copyright 2009 Bentley Systems, Incorporated

Design Problems

Tunnel with a Crossbar Roof

This should create the second Plane, plane02 at the same location as
plane01 but with a different orientation.

The next step is to create one inverted "T" cross section of the roof along the
path. In order to complete the roof you will construct one cross section first and
later replicate it along the path. For the section you need a plane that is
perpendicular to the path and one that is parallel to the horizontal component of
the path.
Now you can use plane02 to create a line that defines the height of the roof.

Design Problems

Exercise: Creating one sample "T" cross section


1

Select Create Feature, choose the Line feature, and as the Update Method
choose ByStartPointDirectionLength.

The StartPoint is plane01, the direction is the plane02 (a plane is basically


a vector normal to the plane at its origin and therefore can be used as a
direction). As Length use a fixed number to start with, depending on the
scale of your model, for example, 3 then click OK.

272

Copyright 2009 Bentley Systems, Incorporated

Jan-10

Tunnel with a Crossbar Roof

If you want to jump ahead use the expression 5-plane01.Z instead, which
makes the length responsive to the path. The 5 ensures that the top of the
roof is at least 5 units above ground plane.

Creating the ribs or outrigger of the roof you need to first define the
direction the cross members should be pointing to. You can derive this
direction from intersecting the two planes you already have, since their
intersection will create a Direction that is always horizontal and always
perpendicular to the curve.
3

To create a Direction, select the feature type Direction and the


PlaneIntersection method. Fill in plane01 and plane02 and click OK.
Now that you have the direction of the ribs, you can create two lines that
point in opposite directions from the planes.

Select the Line feature and the ByStartPointDirectionLength method. The


StartPoint is plane01 and the Direction is the direction01. As the length,
use a fraction of the length of the vertical line. In order to create that
reference you select the vertical line line01 then enter a period to access
valid parameters, and double click on Length. Multiply the result by 0.5.
The final expression should look like this:
Length = line01.Length * 0.5

Click Apply, not OK, to keep the dialog open, because you need it for the
next step.

To repeat the line to the other side you can use the Create Copy button to
the left of Apply.
Create Copy keeps the current values but creates a new Line instance.

Jan-10

The only change you need to make is inverting the direction of the Line by
changing the Length from 0.5 to -0.5 and pressing OK.

273

Copyright 2009 Bentley Systems, Incorporated

Design Problems

Tunnel with a Crossbar Roof

You should see an upside down T now, which is the roof section.

Record User Changes into Transaction file.

Now you will replicate the single section multiple times along the curved path.
You can replace a single input value for a feature with a List of values, which
causes anything that depends on that feature to be replicated for each of the
values in the array. In this case you will use the T parameter of plane01. Instead of
a single T = 0.3 value you will replace it with a List of values. The syntax for a list
requires curly brackets and coma separated values. T = {0, 0.2, 0.4, 0.6, 0.8, 1.0}.

Exercise: Replicate the Section along the curve


1

To change the T value you use Edit Feature on plane01. Select the Edit
Feature tool and click on plane01 (the plane with the red handle circle).

In the edit window click on the T value and replace the single value T = 0.3
with the list, T = {0, 0.2, 0.4, 0.6, 0.8, 1.0}

Click Apply and observe what happens to the section.


It will replicate along the curve for as many times as there are values in
the List.

Design Problems

274

Copyright 2009 Bentley Systems, Incorporated

Jan-10

Tunnel with a Crossbar Roof

Alternatively you could also use the function Series(0,1.0,0.1) here, a


function that generates the list for you.

Record User Changes into Transaction file.

You can now use the Lists of Line.Endpoints of the sections to define a
BSplineSurface, which will be the design surface for the roof.

Exercise: Creating a Surface from the Line.EndPoints


1

To create a BSplineSurface select it from the feature list. As the Update


Method select ByPoints.
One could also use ByPoles but then the surface would not pass through
the high point.
For the Points input you need to create a nested List. A nested list is of
rank 2, which means it is a list of lists, which is essentially Lists nested
inside another List. For instance { {0, 0.2, 0.3}, {0.1, 0.5, 0.4} } But here you
need references to Points instead of numbers so you can construct the
surface.

Jan-10

275

Copyright 2009 Bentley Systems, Incorporated

Design Problems

Tunnel with a Crossbar Roof

The lines are replicated already and therefore form Lists of Lines.
Therefore their EndPoints are also Lists, so you can reference to them
directly. For example, line01.EndPoint is such a List.

line01.Endpoint[0] would refer to line01's EndPoint only so you need to


remove the index ( [0] ). To construct a nested List of points you need to
construct a List of the EndPoint's of line01, line03 and line02 The
expression should look like this
Points = {line02.EndPoint, line01.EndPoint, line03.EndPoint}

Be sure to remove the [0] indexes after selecting the lines with the Ctrl
key, since you want the entire List of endpoints, and not just one.

Record User Changes into Transaction file.

Currently the roof height is constant in height and width even as the path goes up
and down. To make it more interesting you can make it responsive to the
undulation of the path. To do so, you replace the fixed length of the vertical line,
line01, of the sections with an expression that calculates the height as a function

Design Problems

276

Copyright 2009 Bentley Systems, Incorporated

Jan-10

Tunnel with a Crossbar Roof

of the desired maximum height of the roof and the height of it base point along
the path.

Exercise: Making the Roof Height Responsive to the Path Elevation


1

Edit the vertical line line01 by selecting on the Edit Feature tool and then
the line. or select the line in the Symbolic diagram.

In the length field of the line subtract the Z value of plane01 from a fixed
value. This value will be the maximum elevation of the roof in absolute Z
of the baseCS CoordinateSystem: Length=5-plane01.Z.
This will adjust the height of the roof so that it will always exactly reach
the height of absolute 5 in the Z-Axis of the baseCS. This is possible
because the simple equation varies the line01.Length to compensate for
the ups and downs of the path.

Use the move command to vary the initial four points height and position
to see the roof respond.

This completes building the roof surface - the next step explains how to
create a users defined component and populate it on the surface.

Record User Changes into Transaction file.


Additional steps could be placing a grid of components on the surface that
responds to the distortions of the roof.

You will see one way to place a user defined cross bar panel along the surface
using a point grid on the surface and a intermediary ShapeGrid.

Exercise: Creating a User Defined Roof Panel


You will first place a point on the roof surface.

Jan-10

277

Copyright 2009 Bentley Systems, Incorporated

Design Problems

Tunnel with a Crossbar Roof

Use the Create Point and hold down Ctrl before clicking on the
BSplineSurface. Click to place it anywhere on the surface.

Once the point is placed on the surface use the Edit Feature command to
edit the point.

Replace the current U and V value with a Series functions to obtain a grid
of point rather then a singular point.
U should be set to U = Series(0.0,1.0,0.05)
V should be set to V = Series(0.0,1.0,0.1)

Click Apply.

You will see a diagonal set of points. In order to get the full grid of points
you need to toggle the replication option of the point. Choose the Toggle
Replication command and click on the points once. That should turn the
diagonal into a full grid of points.

Next you create a Polygon.ByPointGrid based on the point grid just


created. This grid serves as the placement method for a diagonal cone grid
of the roof.

Design Problems

278

Copyright 2009 Bentley Systems, Incorporated

Jan-10

Tunnel with a Crossbar Roof

Select the feature Polygon and as the creation method used ByPointGrid.
Set the PointGrid variable to the point you just created on the surface,
most likely point05. Remove the curly braces, {}. When selecting the point
make sure to erase the index's [0][1] to get the entire array not just one
point of it.

Record User Changes into Transaction file.

Next you will create a simple crossbar panel. You use a placeholder shape to
create it on the side. Then you create a new feature from it. After that you can
use the new feature to populate the roof surface using the grid of shapes instead
of the placeholder as the input to the crossbar panel. This will create an elegant
lattice as a roof, which still can be manipulated moving the initial four points of
the path.

Exercise: Creating the geometry of a Crossbar


In order to create a crossbar feature you first have to create a placeholder
to simulate the roof input point grid.

Jan-10

279

Copyright 2009 Bentley Systems, Incorporated

Design Problems

Tunnel with a Crossbar Roof

Place four planar points in a square configuration away from the roof
using the point shortcut.

Using those points create a Polygon from the feature list using the
ByVertices as the Update Method. The input needs to be in the form of a
list of points.
Vertices = {point06, point07, point08, point09}

After creating the shape, hide the original points using the Toggle Visibility
command. This is so you do not accidentally select them. Use the
Symbolic view for easier selection.
In order to be able to replicate the Generated Feature Type (a generative
component) using a polygon grid you need to use only the polygon
vertices as input, not the underlying points.

Create the crossbar members by first creating a diagonal line in each


direction. Select the Line feature from the list and create it using the
ByPoints Update Method. As StartPoint type in: polygon02.Vertices[0]
and EndPoint is: polygon02.Vertices[2]

For the other diagonal click Apply and then the Create Copy button and
replace [0] with [1] and [2] with [3] in the Vertices index.
Remember that a Polygon counts its Vertices in a circular fashion, not row
by row. In this case you have four vertices therefore the index goes from
0-3. You now have a diagonal cross.

Add a Cone feature from using the Update Method ByLine.


As the Line use the diagonal. As the starting radius you do not want a fixed
number as the scale of the component is not fixed. In order to make it
responsive you need to tie the radius proportionally to the length of the
diagonal.

Design Problems

Set StartRadius = line04.Length/25.0

280

Copyright 2009 Bentley Systems, Incorporated

Jan-10

Tunnel with a Crossbar Roof

25 is an arbitrary scaling factor to scale down the radius, feel free to


adjust it. Repeat for EndRdius. Also, repeat adding a cone to the other
diagonal as well.

Record User Changes into Transaction file.


Extra: Add a Graph Variable to control the cone radii.

Think of other geometry besides a crossbar that you can substitute here.

Exercise: Creating a Generated Feature Type from the Crossbar


1

Now you create a new user defined feature from the crossbar. To do so,
select the Generate Feature Type tool.
The Generate Feature Type window opens.

Click on Select from Model to select the geometry of the new feature.

The symbolic model turns grey to prepare for the selection. As input,
choose the placeholder polygon (polygon02) you created for the
component. Click OK.

In the Symbolic view you see the line and cone icons in green, which
confirms your selection. This will be the Output of the new feature, the
input, the shape appears in cyan.
4

In the Generate Feature Type dialog, be sure to enable the Replicatable


check box in the input list for the shape.
This makes it possible to multiple shapes as inputs and not just one.

Enable the Construction check box for the two diagonal lines so you dont
see the lines in the final placed crossbar feature check.

Enable Make this feature available in future sessions.

Name the feature, crossbar01 in the Type name field.


Add a number as you are likely to create several versions and it becomes
hard to distinguish them in the feature list.

Jan-10

281

Copyright 2009 Bentley Systems, Incorporated

Design Problems

Tunnel with a Crossbar Roof

Click OK to create the new feature.

Record User Changes into Transaction file.

In the final step, place the new feature crossbar01 onto the polygon grid on the
roof.

Exercise: Placing the generated feature


1

Select Create Feature.


It lists the new feature you just created called crossbar01.

Use the ByDefault update method and select the grid of shapes on the
BSplineSurface, polygon01 as the input.
Be sure to remove the index square brackets when selecting the
polygon01 with the Ctrl key, as you want to use all shapes, not just one.

Design Problems

Click OK and you will see the crossbar grid populating the surface.

Toggle Visibility on the shape grid polygon01 in order to see the


crossbar01 grid more clearly.

282

Copyright 2009 Bentley Systems, Incorporated

Jan-10

Tunnel with a Crossbar Roof

Shade the view by selecting the Set View Display Mode and Smooth as the
shading type.

Record User Changes into Transaction file.

Optional exercises: Further editing and adjustments


Try some of the following to see the dynamic nature of the design.

Jan-10

Use the Pyramid feature type you created earlier in the class. It, too, is
looking for a polygon input type.

Adjust the Series function for U and V for the point on the surface
(point05) by adding finer increments. For example, change to
Series(0,1.01,0.25).

Adjust the line length equation.

In order to be able to move the initial points you may want to toggle the
BSplineSurface update property to Deferred using the Toggle Deferral
tool. Click on the bSplineSurface01 in the Symbolic tree model. Since it is
hidden, you cannot select it from the geometry model). This will cause the

283

Copyright 2009 Bentley Systems, Incorporated

Design Problems

Conveyor Belt Design

BSplineSurface and all its children (the crossbar etc.) to not update while
moving the path points. Once the path is adjusted, you need to toggle the
deferred property of the surface again to update its position.

Conveyor Belt Design


There are many applications of GC in disciplines other that Architecture, this is an
example that can be applied to Plant and Process design.

Exercise: Setup
1

Create a new GCT file.

Select Create Feature and choose GraphVariable with Update Method of


EvaluateExpression.

Create the following seven GraphVariables:


Name: ConHeight
Value: 1000
LimitValueToRange: true
RangeMinimum: 0
RangeMaximum: 3000
RangeStepSize: 50
Name: ConLength
Value: 3000
LimitValueToRange: true
RangeMinimum: 0
RangeMaximum: 6000
RangeStepSize: 50
Name: ConWidth
Value: 1000
LimitValueToRange: true

Design Problems

284

Copyright 2009 Bentley Systems, Incorporated

Jan-10

Conveyor Belt Design

RangeMinimum: 0
RangeMaximum: 2000
RangeStepSize: 50
Name: RollerDia
Value: 40
LimitValueToRange: true
RangeMinimum: 0
RangeMaximum: 100
RangeStepSize: 5
Name: SideHeight
Value: 100
LimitValueToRange: true
RangeMinimum: 0
RangeMaximum: 500
RangeStepSize: 5
Name: SideWidth
Value: 20
LimitValueToRange: true
RangeMinimum: 0
RangeMaximum: 100
RangeStepSize: 5
Name: SupportDim
Value: 50
LimitValueToRange: true
RangeMinimum: 0

Jan-10

285

Copyright 2009 Bentley Systems, Incorporated

Design Problems

Conveyor Belt Design

RangeMaximum: 200
RangeStepSize: 5
4

Select Toggle Visibility and turn of the display of baseCS.

Record User Changes into Transaction file.

Select Create Feature and choose Point with Update Method


ByCartesianCoordinates and create six Points with the following
parameters:
point01
CoordinateSystem: baseCS
XTranslation: 0
YTranslation: 0
ZTranslation: 0
point02
CoordinateSystem: baseCS
XTranslation: 0
YTranslation: ConWidth/2
ZTranslation: 0
point03
CoordinateSystem: baseCS
XTranslation: 0
YTranslation: -ConWidth/2
ZTranslation: 0
point04
CoordinateSystem: baseCS
XTranslation: ConLength
YTranslation: 0
ZTranslation: 0

Design Problems

286

Copyright 2009 Bentley Systems, Incorporated

Jan-10

Conveyor Belt Design

point05
CoordinateSystem: baseCS
XTranslation: ConLength
YTranslation: ConWidth/2
ZTranslation: 0
point06
CoordinateSystem: baseCS
XTranslation: ConLength
YTranslation: -ConWidth/2
ZTranslation: 0
7

Select Create Feature and choose Line with Update Method ByPoints and
create two lines as follows:
line01
StartPoint: point03
EndPoint: point06
line02
StartPoint: point02
EndPoint: point05

Next you will create the sidebars of the conveyor. These will be small in
comparison to the length of the conveyor so in order to see them you will
need to Rotate to the Left (or Right) View and zoom in.
8

Jan-10

Record User Changes into Transaction file.

287

Copyright 2009 Bentley Systems, Incorporated

Design Problems

Conveyor Belt Design

Select Create Feature and choose BSplineSurface with Update Method


SweepRectangleAlongPath and create two surfaces as follows:
bsplineSurface01
Path: line01
XDimension: SideWidth
YDimension: SideHeight
bsplineSurface02
Path: line02
XDimension: SideWidth
YDimension: SideHeight
You will now turn these surfaces into Solids.

10 Select Create Feature and choose Solid with Update Method

BySurfaceCapping and create two solids as follows:


solid01
SurfaceToCap: bsplineSurface01
solid02
SurfaceToCap: bsplineSurface02

The next step is to create points to attach the rollers to.


11 Record User Changes into Transaction file.
12 Select Create Feature and choose Point with Update Method

ByNumberAlongCurve and create two sets of points as follows:


point07
Curve: line01

Design Problems

288

Copyright 2009 Bentley Systems, Incorporated

Jan-10

Conveyor Belt Design

NumberAlongCurve: line01.Length/(RollerDia*2+25)
IncludeStart: false
IncludeEnd: false
point08
Curve: line02
NumberAlongCurve: line02.Length/(RollerDia*2+25)
IncludeStart: false
IncludeEnd: false

You will now create the rollers as cones.


13 Select Create Feature and choose Cone with Update Method ByPoints and

create one set of cones as follows:


cone01
StartPoint: point07
EndPoint: point08
StartRadius: RollerDia

Jan-10

289

Copyright 2009 Bentley Systems, Incorporated

Design Problems

Conveyor Belt Design

EndRadius: RollerDia

Now you will create a support line and support points.


14 Record User Changes into Transaction file.
15 Select Create Feature and choose Line with Update Method ByPoints and

create a line as follows:


StartPoint: point01
EndPoint: point04
16 Select Create Feature and choose Point with Update Method

ByNumberAlongCurve and create one set of points as follows:


point09
Curve: line03
NumberAlongCurve: line01.Length/ConLength
IncludeStart: true

Design Problems

290

Copyright 2009 Bentley Systems, Incorporated

Jan-10

Conveyor Belt Design

IncludeEnd: true

To aid with further editing, it is helpful to add another coordinate system


and define a direction of flow.
17 Select Create Feature and choose Direction with Update Method

ByOriginDirectionPoint and create the direction as follows:


Origin: point01
DirectionPoint: point04
18 Select Create Feature and choose CoordinateSystem with Update Method

ByOriginPrimarySecondaryDirections and create the coordinate system as


follows:
Origin: point09
PrimaryDirection: baseCS.ZDirection
PrimaryXAxis: AxisOption.Z
SecondaryDirection: direction01
SecondaryXAxis: AxisOption.X
19 Record User Changes into Transaction file.

Now you will create several points for a support for the conveyor.
20 Select Create Feature and choose Point with Update Method

ByCartesianCoordinates and create seven Points with the following


parameters:

Jan-10

291

Copyright 2009 Bentley Systems, Incorporated

Design Problems

Conveyor Belt Design

point10
CoordinateSystem: baseCS
XTranslation: 0
YTranslation: 0
ZTranslation: 0
point11
CoordinateSystem: baseCS
XTranslation: 0
YTranslation: ConWidth/2+SupportDim/2+SideWidth/2
ZTranslation: 0
point12
CoordinateSystem: baseCS
XTranslation: 0
YTranslation: ConWidth/2+SupportDim/2+SideWidth/2
ZTranslation: -ConHeight
point13
CoordinateSystem: baseCS
XTranslation: 0
YTranslation: ConWidth/2+SupportDim/2+SideWidth/2
ZTranslation: -ConHeight+25
point14
CoordinateSystem: baseCS
XTranslation: ConLength
YTranslation: ConWidth/2+SupportDim/2+SideWidth/2
ZTranslation: -ConHeight+125

Design Problems

292

Copyright 2009 Bentley Systems, Incorporated

Jan-10

Conveyor Belt Design

point15
CoordinateSystem: baseCS
XTranslation: 0
YTranslation: ConWidth/2+SupportDim/2+SideWidth/2
ZTranslation: 250
point16
CoordinateSystem: baseCS
XTranslation: 0
YTranslation: ConWidth/2+SupportDim/2+SideWidth/2
ZTranslation: -ConHeight+250
The remaining points will mirrored copies of the first points.
21 Record User Changes into Transaction file.
22 Select Create Feature and choose Point with Update Method

MirrorCopyGeometricContentsAboutPlane and create six Points with the


following parameters:
point17
FeatureToMirrorCopy: point11
Plane: baseCS.XZPlane
point18
FeatureToMirrorCopy: point12
Plane: baseCS.XZPlane
point19
FeatureToMirrorCopy: point13
Plane: baseCS.XZPlane
point20

Jan-10

293

Copyright 2009 Bentley Systems, Incorporated

Design Problems

Conveyor Belt Design

FeatureToMirrorCopy: point14
Plane: baseCS.XZPlane
point21
FeatureToMirrorCopy: point15
Plane: baseCS.XZPlane
point22
FeatureToMirrorCopy: point16
Plane: baseCS.XZPlane

23 Select Create Feature and choose Line with Update Method ByPoints and

create three lines with the following parameters:


line04
StartPoint: point11

Design Problems

294

Copyright 2009 Bentley Systems, Incorporated

Jan-10

Conveyor Belt Design

EndPoint: point14
line05
StartPoint: point17
EndPoint: point20
line06
StartPoint: point15
EndPoint: point21

24 Record User Changes into Transaction file.

Next you will create the solids from bsplineSurfaces.


25 Select Create Feature and choose BSplineSurface with Update Method

SweepRectangleAlongPath and create three surfaces as follows:


bsplineSurface03
Path: line04

Jan-10

295

Copyright 2009 Bentley Systems, Incorporated

Design Problems

Conveyor Belt Design

XDimension: SupportDim
YDimension: SupportDim
bsplineSurface04
Path: line05
XDimension: SupportDim
YDimension: SupportDim
bsplineSurface05
Path: line06
XDimension: SupportDim
YDimension: SupportDim
You will now turn these surfaces into Solids.
26 Select Create Feature and choose Solid with Update Method

BySurfaceCapping and create three solids as follows:


solid03
SurfaceToCap: bsplineSurface03
solid04
SurfaceToCap: bsplineSurface04
solid05

Design Problems

296

Copyright 2009 Bentley Systems, Incorporated

Jan-10

Conveyor Belt Design

SurfaceToCap: bsplineSurface05

27 Record User Changes into Transaction file.

Next is to create cones (cylinders).


28 Select Create Feature and choose Cone with Update Method ByPoints and

create six cones as follows:


cone02
StartPoint: point14
EndPoint: point13
StartRadius: 10
EndRadius: 10
cone03
StartPoint: point13
EndPoint: point12
StartRadius:75

Jan-10

297

Copyright 2009 Bentley Systems, Incorporated

Design Problems

Conveyor Belt Design

EndRadius: 75
cone04
StartPoint: point20
EndPoint: point19
StartRadius: 10
EndRadius: 10
cone05
StartPoint: point19
EndPoint: point18
StartRadius: 75
EndRadius: 75
cone06
StartPoint: point15
EndPoint: point22
StartRadius: 10
EndRadius: 10
cone07
StartPoint: point21
EndPoint: point16
StartRadius: 10

Design Problems

298

Copyright 2009 Bentley Systems, Incorporated

Jan-10

Conveyor Belt Design

EndRadius: 10

29 Record User Changes into Transaction file.


30 Select Create Generated Feature Type, use the following parameters.

Name: SupportConveyor
Inputs (select from Symbolic View):
baseCS - make replicable
ConHeight
ConWidth
SideWidth
SupportDim
Outputs:
Keep default but:
Make all bsplineSurfaces Construction
Make all lines Construction

Jan-10

299

Copyright 2009 Bentley Systems, Incorporated

Design Problems

Conveyor Belt Design

Make all points Construction


Make this feature type available in future sessions: Enabled

31 Select Create Feature and choose SupportConveyor with Update Method

ByDefault and the following parameters:


ConHeight: ConHeight
ConWidth: ConWidth
SideWidth: SideWidth
SupportDim: 50

Design Problems

300

Copyright 2009 Bentley Systems, Incorporated

Jan-10

Conveyor Belt Design

baseCS: coordinateSystem01

32 Record User Changes into Transaction file.

Jan-10

301

Copyright 2009 Bentley Systems, Incorporated

Design Problems

Conveyor Belt Design

Design Problems

302

Copyright 2009 Bentley Systems, Incorporated

Jan-10

Appendix A: Visualization with


Luxology
Module Overview
Visualization requires lighting, cameras, materials and good renderer. This
module discusses how GenerativeComponents provides all of these.

Module Prerequisites

Basic understanding of GenerativeComponents or 3D modeling software

Helpful if you have done Visualization before

Module Objectives
After completing this module, you will be able to:

Display Styles

Camera Setup and Navigation

Luxology Manager

Materials

Lighting

Output to 3D PDF

Display Styles
A Display Style consists of a shading mode plus other settings and overrides
(color, transparency, etc) that you can specify. Display styles are created and

Jan-10

303

Appendix A: Visualization with Luxology

Copyright 2009 Bentley Systems, Incorporated

Camera Setup and Navigation

managed in the Display Styles dialog. They are typically saved as shared resources
in DGN libraries, but can be stored in the active file.
The point of using Display Styles is to have a permanently shaded (until you
change it back to wireframe) view. You can zoom, pan and rotated in shaded
mode with Display Styles turned on.
Display styles apply to saved and dynamic views, as well as normal views. The list
of styles is sub-divided by Display mode. Wireframe display styles are followed by
hidden line, filled hidden line, and shaded display styles.

Exercise: Using Display Styles


1

Select Open Transaction File and select WorkflowSamples\solid_modeling


and open solid_between_related_surfaces.gct.

Review different Display Styles by clicking and pressing and holding the
Display Style icon and selecting different modes.

Camera Setup and Navigation


Setup Camera
The Setup Camera tool is designed specifically to set up views for rendering.
When using this tool, a camera view is selected and you have the option of

Appendix A: Visualization with Luxology

304

Copyright 2009 Bentley Systems, Incorporated

Jan-10

Camera Setup and Navigation

displaying its viewing cone in all other views that display the same volume of the
design file. When this tool is selected you are prompted to select an active view.
In this example View 2 the Right Isometric view is selected. You now have the
option of selecting the camera position and target using any of the other open
views. You can work in one view and use AccuDraw to manipulate the camera
and target position.
After an active view is selected you can then select the type of lens available from
the options list and enable Camera Height, Target Height or select these positions
using AccuDraw and AccuSnap on the view geometry.

Finding the tool


There are several ways to find the Camera tool, from the Visualization Task, the
View Control tool bar or a key-in. When setting up or using a Camera it is useful to
have multiple views open.

Jan-10

Exercise: Finding the Camera Tool


1

Continue in solid_between_related_surfaces.gct.

Open Views 2 and 3 and set them to Top and Front and set View 1 to
Isometric.

305

Appendix A: Visualization with Luxology


Copyright 2009 Bentley Systems, Incorporated

Camera Setup and Navigation

In the View Control tool bar, right click on any tool and from the menu
select Camera Setup.

The tools is now available in your View Control tool bar.

Exercise: Setting up the Camera


1

Select Setup Camera and left click once in View 1 (the Isometric view).

Then, left click in the Front View as shown, to set the camera position.

Appendix A: Visualization with Luxology

306

Copyright 2009 Bentley Systems, Incorporated

Jan-10

Camera Setup and Navigation

Left click in the Top view to set the camera target.

View 1 now shows the geometry through the camera lens.

You can use other tools to manipulate the camera as needed. The most common
method is to choose the Navigate View tool (you might need to right click and
turn this tool on like you did with the Camera Setup tool) in the View Control tool
bar.

Jan-10

307

Appendix A: Visualization with Luxology


Copyright 2009 Bentley Systems, Incorporated

Scripting the Camera for Animation

You can now manipulate one of the three dots or handles.

Scripting the Camera for Animation


MicroStation, the CAD engine that GC is built upon, has an Animation tool set.
However, at the present time you cannot use it with dynamic GC elements. Other
options do exist.
It is possible to create an animation of a GenerativeComponents model in
dynamics by using a script transaction to control graph variables and a camera. To
record an animation, every iteration in the script transaction can be exported to a
JPEG file and stitched together in a video editing program. GC does not export
video.
If you are animating a static model, it is suggested that you save your file as a
DGN and use MicroStation's animation functionality. In this case, you will see the
dynamics through the animation tools.

Animating Graph Variables


The first step in creating a simple animation is setting up your model so that is
controlled by at least one graph variable. In the Pyramid example, the Pyramid is
a user-defined feature that is controlled by one graph variables: height.
In order to animate the graph variables, we have to write a simple For loop in a
script transaction.

Appendix A: Visualization with Luxology

308

Copyright 2009 Bentley Systems, Incorporated

Jan-10

Scripting the Camera for Animation

Exercise: Adding in Animation Scripting


1

Right-click on the last transaction.

In the pop-up menu select New Script Transaction, and select Insert After.
This opens a new window within which we write the following code:
transaction script "Animate Pyramid Height"
{
int frames = 15;
/* double otherVar= othervalue; */
double heightStep = 0.75;

for (int i = 1; i <= frames; i++)


{
PyramidHeight = PyramidHeight + heightStep;
UpdateGraph();
}
}

Click on OK and save the transaction.

Play and Unplay the transaction to see the result.

In the code above, each of the variables perform the following task:

Frames - Set how many frames to capture

heightStep - The increments that the height graph variables will increase at
every iteration.

One very important line to note is the UpdateGraph() function. This instructs
GenerativeComponents to regenerate all open geometry windows at every
iteration.

Animating a Camera
The code necessary for animating a camera is similar to the code for animating
graph variables, except rather than modify the value of a graph variable, this time
the code modifies the camera eye point's T value on the curve. Again, create a
new script transaction and write code to do this. YOu wil first need to create a GC
Camera Feature Type.

Jan-10

Exercise: Animating the camera

309

Appendix A: Visualization with Luxology


Copyright 2009 Bentley Systems, Incorporated

Scripting the Camera for Animation

Continue in the same file.

Draw a B-Spline ByPoles using Points ByCartesianCoordinates as the


inputs. You will need to create the points first and then the curve.

Save the transaction.

Select Create Feature and choose Point ByParameterAlongCurve.


Curve: bsplineCurve01
T Value: 0
This is point10

Select Create Feature again and select Point ByParameterAlong Curve.


Curve: line01
T Value: 0.333
This is point11

In the GenerativeComponents task, select Create Feature.

Select Camera with Update Method ByPoints.


EyePoint: point10
TargetPoint: point11
ViewAngle: 50
ViewNumber: 2
UseViewAspectRatio: true
This will setup the camera and open View 2 as the Camera View.

Right-click on the last transaction.

In the pop-up menu select New Script Transaction, and select Insert After.
This opens a new window within which we write the following code:
transaction script "Animate Camera"
{
int frames = 15;
double tVal = 0;
double tInc = 1/frames;

for (int i = 0; i <= frames; i++)


{
point10.T = tVal;

Appendix A: Visualization with Luxology

310

Copyright 2009 Bentley Systems, Incorporated

Jan-10

Scripting the Camera for Animation

UpdateGraph();
tVal = tVal + tInc;
}
}

The frames variable indicates how many frames will be iterated, the tVal variable
holds the T parameter value for the camera point, in this case named point10,
and the tInc variable contains the increment value to step the point along the
curve. For this animation we would like the camera to move along the entire
curve, regardless of how many frames are iterated. Instead of calculating the T
value increment manually, a simple equation based on the number of frames will
work. Again, note the UpdateGraph() function and remember that this function
instructs GenerativeComponents to regenerate all open geometry windows at
every iteration.

Exporting Frames
This simplest way to export individual frames to stitch together later is to use the
SaveViewToImageFile() function. As arguments, you can specify which view
window to export, the height of the image to export in pixels (the width will be
derived proportionally from the aspect ratio of the window), and a file path for
the exported JPEG. The current view's shading settings will be used for rendering
the image before exporting it. Replace the code in the last transaction with the
following:
transaction script "Animate Camera and Capture Image"
{
int frames = 15;
double tVal = 0;
double tInc = 1/frames;

for (int i = 0; i <= frames; i++)


{
point10.T = tVal;
UpdateGraph();
SaveViewToImageFile(1, 1080, "file path here including name of
file.jpg" + (i+1));
tVal = tVal + tInc;
}
}

Jan-10

311

Appendix A: Visualization with Luxology


Copyright 2009 Bentley Systems, Incorporated

Luxology Manager

Note that the file path argument in the SaveViewToImageFile function is


concatenated (the lists are combined) using the plus sign (+) to add an increment
counter at the end of each file exported. This will allow the images to be exported
as an image sequence, which will facilitate importing them into your preferred
video editing software. Without the increment counter, every new file exported
would replace the previous image file until the script had finished, at which point
only the final frame would be present in your animation folder.
To see an example please open roof_with_tree.gct and examine.

Luxology Manager
The Luxology Manager allows you to control Rendering, Materials and Lighting.
You can open Luxology from MicroStation > Utilities > Render > Luxology, or click
on the Render icon in the View control tool bar. Once again you can turn this tool
on by right clicking on the View Control tool bar and selecting Render from the
menu.

Render

Render Options
Lighting
Materials

View to Render

Left click on the Render icon to see the rendered image. The time to render is
dependent on several variables like: complexity of model, lighting, materials and
hardware.
Note: To remove the points select Render Settings and turn on Ignore Open Elements

and Text.

Appendix A: Visualization with Luxology

312

Copyright 2009 Bentley Systems, Incorporated

Jan-10

Materials

Materials
Materials allow you to add realistic imagery to surfaces, like wood, marble, glass,
etc. Luxology allows for many types of formats, like JPG or TIF or specialized
Luxology materials to add Fur or 3D materials.
By default, Luxology rendering assumes that each design file surface is made of a
material with a smooth shiny surface, such as plastic. Material definitions let you
specify that an element is water or wood or brickwork. When rendered, instead
of seeing the plastic element, you see the specified material. Each material
definition can include a pattern map and/or a bump map, as well as other settings
determining the finish and transparency/translucency of the material plus much
more. Pattern maps and bump maps are image files that are applied to surfaces
during the rendering process.

Pattern maps
A pattern map is an image file that is applied to an element. You can think of this
in terms of wall-papering a wall. When you render an element that has a pattern
map applied to it, instead of seeing the element (wall) you see the pattern map
(wall-paper). MicroStation provides a large range of image files, in JPG and TIF
format, that can be used for pattern maps. These are stored in the
\Workspace\system\materials\pattern folder. Additionally, you can use your
own image files as pattern maps.

Bump maps
Like pattern maps, a bump map is an image file that is applied to an element.
Where it differs from a pattern map is that a bump map applies roughness or
texture to a rendered surface. While it is not mandatory for bump map images to
be grey-scale, quite often they are. MicroStation uses the contrast in the bump
map image to calculate texture, or bumps, in the rendered image. As part of the
material definition, you can vary the height of these bumps. This lets you use the
same bump map image file, for example, to create cast metal from very roughcast through to nearly smooth.

Jan-10

313

Appendix A: Visualization with Luxology


Copyright 2009 Bentley Systems, Incorporated

Materials

Working with Materials


To apply materials you can Assign them to a Level and Color combination or
Assign them to an individual face of a 3D object.

Exercise: Assigning a Material


1

Open solid_between_related_surfaces.gct.

Click on the Material icon in the Luxology Manager.


This opens the Material Editor.

Click on Open Palette or select the menu item Palette > Open.

Select the Luxology_Presets.pal (Bentley_Materials.dgnlib).

You now have access to all materials in that palette.

Appendix A: Visualization with Luxology

314

Copyright 2009 Bentley Systems, Incorporated

Jan-10

Lighting

Right click on Fabric - Velvet and select Assign.

Left click once on the geometry in any view and left click again on nothing
(empty space).
The second left click is to Accept the assignment of the material.

Render the model by selecting Render in the Luxology Manager.

Explore other materials and try them out. You can Remove Assignment the same
way, by right clicking and choosing Remove.

Lighting
Lighting is the key to photo realism. Spend more time with lighting and you will
have better results.

Jan-10

315

Appendix A: Visualization with Luxology


Copyright 2009 Bentley Systems, Incorporated

Lighting

There are two basic types of lighting: Global Lighting and Source Lighting. To open
the Light Manager, select the Light icon in the Luxology Manager.

Global Lighting
Global lighting affects all elements in a file.

Ambient
Ambient lighting affects every element in the model. It adds lighting equally to all
elements. As you increase the value of Ambient lighting, the amount of contrast
diminishes. Ambient lighting is useful for illuminating surfaces that would not
otherwise receive light. No shadows are cast by Ambient light. Settings for this
light source let you adjust its Lux, Color, and Temperature.

Flashbulb
Like a flashbulb on a camera, this light source illuminates all elements that are
facing the viewing position or camera. Useful for checking models during
construction, you also can use it to add light to a final image. No shadows are cast
by this light source. Settings in the Global Lighting dialog, let you adjust the Lux,
Color and temperature of the Flashbulb.

Appendix A: Visualization with Luxology

316

Copyright 2009 Bentley Systems, Incorporated

Jan-10

Source Lighting

Solar
Used to simulate lighting from the Sun, Solar lighting has settings that let you set
any of the following:

Latitude, longitude, time and date of the rendering.

Solar Direction Vectors of the sunlight.

Azimuth Angle and Altitude Angle of the Sun.

You can input this data manually in the appropriate fields, or you can use dialogs
to select a city from a list or pick a location from a map of the world. These
dialogs are opened by clicking one of the following options in the Location section
of the Global Lighting dialog:

Cities opens the Location By City dialog from which you can select a city
from the list.

Map opens Google Earth. Enable View > Grid to display longitude and
latitude and View > Show Time>Automatically. With this method, you must
still enter the GMT Offset manually.

Zones opens the GMT Offset By Time Zone dialog from which you can
select a time zone.

Optionally, you can turn on Solar Shadows to view the effect of shadows
generated by the Solar lighting (sunlight) when rendering with the Phong or Ray
Trace options. As with other Global light sources, you can specify the Lux, Color
and temperature of the simulated sunlight.

Source Lighting
Unlike Global Illumination, which is controlled solely from a dialog, Source
lighting consists of light sources in the form of special cells that you place in the
design. This is done with the Define Light tool, which you will look at shortly. First,
a brief description of source lighting.
Source lighting cells are stored in the cell library lighting.cel, which is accessed
automatically by the Place Light tool. You do not have to attach this cell library
before placing light sources. The Place Light tool has various settings for each
light source type, which you enter prior to placing the light source. The same tool
lets you modify them, if necessary, at a later date. The cells consist of
construction class elements and are placed by default on level Default.

Jan-10

317

Appendix A: Visualization with Luxology


Copyright 2009 Bentley Systems, Incorporated

Source Lighting

Shadow generation from source lighting


Not all rendering modes support the generation of shadows, even if the Shadow
setting is enabled in the light source and for the view. For general rendering, only
Phong and Ray Trace modes support the generation of shadows. Where Radiosity
solving or a Particle Tracing solution is used, Smooth rendering also can display
shadows.

Place Light tool


Source lighting provides a choice of 4 lighting types; Point, Spot, Area, Directional
and Sky Opening. These light sources provide lighting as follows.

Point
Similar to a light globe, point light sources radiate light in all directions, from a
point light source. Shadows can be generated by this light source in Ray Trace
rendering only; they are not supported by Phong rendering.

Spot
Directional light source that behaves similar to a flashlight. Spot Lights have a
conical beam. This can be defined to taper off to zero at the edge of the beam.
You can define the Cone Angle for the beam and a Delta Angle through which the
beam reduces from full intensity to zero. Shadows can be generated by this light
source for Phong and RayTrace rendering.

Area
Created from existing polygons in the design, these light sources are useful for
simulating fluorescent lighting, for example.

Directional
Directional light source that produces parallel light rays throughout the design,
similar to sunlight. It does not matter where in the model that you place one of
these light sources, all surfaces that face the direction of a Distant light source are
illuminated by it. Shadows can be generated by this light source for Phong and
RayTrace rendering.

Appendix A: Visualization with Luxology

318

Copyright 2009 Bentley Systems, Incorporated

Jan-10

Output of Imagery

Sky Opening
Used with Ray Tracing, Radiosity solving, and Particle Tracing, to generate more
efficient solutions for indoor scenes lit with Solar Lighting, Sky Light, or Distant
Light sources, through an opening in a wall or ceiling. Rather than consider the
entire sky for calculating the lighting effect, only the lighting that is visible
through the opening is considered.
Each source lighting cell that you place in a design can have different settings for
such things as Intensity and Color. You can specify whether or not they cast
shadows for the supported rendering modes.

Output of Imagery
There are many ways to share your computer graphics imagery (CGI). One way is
to create a 3D PDF of your rendered model, another is to Save an image to disk.

Jan-10

Exercise: Output to 3D PDF


1

Select the menu item MicroStation > File > Print.

Change the Windows Driver to Bentley Driver.

Click on the magnifying glass, next to Bentley Driver and choose,


pdf.pltcfg.

319

Appendix A: Visualization with Luxology


Copyright 2009 Bentley Systems, Incorporated

Output of Imagery

Enable Print to 3D.

Click Print.

Note: Take note where you are creating the PDF.


6

Open the PDF in Acrobat to review and test the 3D controls.

Appendix A: Visualization with Luxology

320

Copyright 2009 Bentley Systems, Incorporated

Jan-10

Output of Imagery

Save Image
To save an image to disk you can use MicroStation > Utilities > Image > Save.

Here you can choose several things, including: Format, DPI and Render Mode. For
a quick test choose Luxology from Render Mode.

Jan-10

321

Appendix A: Visualization with Luxology


Copyright 2009 Bentley Systems, Incorporated

Output of Imagery

Appendix A: Visualization with Luxology

322

Copyright 2009 Bentley Systems, Incorporated

Jan-10

GenerativeComponents Quick
Reference
Tools
Plane Selector

Set Construction Plane

New

Open

Save

Save As...

Record New User Changes to Transaction File

Show Symbolic Diagram

Jan-10

323

GenerativeComponents Quick Reference

Copyright 2009 Bentley Systems, Incorporated

Tools

Update Graphs
Promote MicroStation Element to Feature
using Element Symbology
Create Feature

Create Point

Create Plane

Create Coordinate System

Move Feature

Switch Support

Copy Feature

Mirror-Copy Feature

Edit Feature

Delete Feature

GenerativeComponents Quick Reference

324

Copyright 2009 Bentley Systems, Incorporated

Jan-10

Tools

Toggle Dynamics

Toggle Visibility

Toggle Deferral

Toggle Replication

Toggle Is Construction

Apply Active Symbology

Toggle Visibility of Construction

Toggle Visibility of Handles

Split Points

Merge Points

Create Model

Jan-10

325

GenerativeComponents Quick Reference


Copyright 2009 Bentley Systems, Incorporated

Symbolic Diagram

Generate Feature Type

Symbolic Diagram

Blue: Feature has no inputs or outputs.


Pale Blue: Feature has no inputs but serves as inputs to other features.
Grey: Feature whose Display is Hidden (does not appear in Geometric view).
Red: Error in feature.
Right click menu when you click on feature in Symbolic Diagram.

GenerativeComponents Quick Reference

326

Copyright 2009 Bentley Systems, Incorporated

Jan-10

Feature Input Parameters Color Codes

Feature Input Parameters Color Codes

Black: Value required


Blue: Value optional (default value)
Grey: Value fixed, since it is an output property
Red: Incorrect value. Usually wrong type.

General Tips and Hints


Press CTRL to select a feature.
Curly Braces { } signify a collection or set.
Round brackets ( ) signify a function. For example, Series (start, finish, increment)
so Series(0,1,0.2) returns {0,0.2,0.4,0.6,0.8,1.0}.
Square brackets [ ] signify an index number of a collection.
INTEGER: A whole number, for example,1, 5, 30.
DOUBLE: A number with decimal fraction, for example, 1.3, 2.5, 30.5.
STRING: Use double quotation marks " " .

Jan-10

327

GenerativeComponents Quick Reference


Copyright 2009 Bentley Systems, Incorporated

General Tips and Hints

Dot Operator: Use . (period, dot) to get pull down list of feature properties.

GenerativeComponents Quick Reference

328

Copyright 2009 Bentley Systems, Incorporated

Jan-10

Das könnte Ihnen auch gefallen