Ijac 201210108
Ijac 201210108
Programming Languages
For Implementing
Computational Design
Concepts:A Comparison
From A Pedagogical Point
Of View
Gabriela Celani and Carlos Eduardo Verzola Vaz
Abstract
This paper compares the use of scripting languages and visual
programming languages for teaching computational design concepts to
novice and advanced architecture students. Both systems are described
and discussed in terms of the representation methods they use.With
novice students better results were obtained with the visual
programming language. However, the generative strategies used were
restricted to parametric variation and the use of randomness. Scripting,
on the other hand, was used by advanced students to implement rule-
based generative systems. It is possible to conclude that visual languages
can be very useful for making architecture students understand general
programming concepts, but scripting languages are fundamental for
implementing generative design systems.The paper also discusses the
importance of the ability to shift between different representation
methods, from more concrete to more abstract, as part of the
architectural education.
122
1. INTRODUCTION
The insertion of new technologies in architectural education has been the
target of many discussions and publications, and the theme of many
conferences, especially in the 1980’s and 1990’s, when computers became
accessible for most architecture schools.The central issue in these
discussions has progressively evolved from the introduction of software
packages with simple representation purposes, to those with more complex
analytical purposes, and finally to those which could be truly integrated in
the design process, allowing automated form generation and exploration [1].
The interest in generative software has become more evident after the
introduction of digital fabrication machines in the architecture field, which
allow free-form exploration and mass-customization in a way that has never
been possible before.
Generative design systems have been described by Mitchell in his
seminal paper “The theoretical foundations of computer-aided architectural
design” [2] as devices that are capable of generating potential solutions for
a given problem. Most generative design systems use parametric variation
and/or transformation rules as their main strategies. Although they do not
necessarily need to be implemented in the computer, it is possible to
automate otherwise time-consuming, repetitive tasks to increase the
complexity of compositions in a way that would be impossible by hand.
Until the 1980’s generative design systems were hard to implement,
because they required not only expensive hardware, such as graphic displays
and high memory capacity, but also very specialized programming skills. One
of the first practical guides for implementing computer-based generative
design systems was Mitchell, Ligget and Kvan’s book The art of computer-
graphics programming [3], which used Pascal programming. After this book,
other guides for implementing generative design have followed, such as
Schmitt’s [4], Coates’s [5], Celani’s [6], and Terzidis’s [7]. Although using
different generative strategies, they had in common the fact that they all
used scripting languages that were available within CAD packages, such as
Mini Pascal, GDL, Lingo, AutoLisp,VBA and MEL [8].
However, with the recent introduction of parametric tools and visual
programming in CAD software the interest in textual programming for
teaching generative design is decreasing. A search for papers containing the
keywords “education” and “programming” in Cumincad’s database, for
example, returns 19 entries between 1977 and 1993 and only one in 2003.
A search in the same database for papers containing the keyword “visual
programming” returns 4 papers between 2006 and 2011, and a search for
keywords “education” and “parametric” returns 8 papers between 2003 and
2011.This shows a tendency to change the focus from textual programming
languages to visual programming and parametric design in CAAD education.
The reason for that is probably related to the fact that it takes much
more time to learn to use textual than visual programming languages.
CAD Scripting And Visual Programming Languages For Implementing Computational Design 123
Concepts: A Comparison From A Pedagogical Point Of View
Learning syntax rules and understanding a program’s object model can be
very frustrating at the beginning. However, textual languages allow the
implementation of much more complex generative strategies that include
transformation rules, while the use of visual programming is usually limited
to parametric exploration.
The present paper categorizes textual and visual programming languages
in terms of representation method, and describes them, with examples of
applications. Next, it compares the use of textual and visual programming
languages for introducing computational design concepts for novice and
advanced architecture students.
CAD Scripting And Visual Programming Languages For Implementing Computational Design 125
Concepts: A Comparison From A Pedagogical Point Of View
teaching experiment described in this paper AutoCAD´s VBA, an object-
based scripting language, was used.VBA scripts (also called macros) can be
developed in the Visual Basic for Application Interactive Development
Environment (VBAIDE), which is embedded in Microsoft Office applications
(such as Word and Excell), as well as in AutoCAD (VBAIDE used to be
installed by default with AutoCAD, but since the 2011 version it needs to
be downloaded from Autodesk´s website and installed as a plugin).
Although it is not a compiled language and it does not allow creating new
proper classes of objects or stand alone applications,VBA scripting language
is very powerful for automating procedures within AutoCAD. Its
development environment allows designing user interfaces in an easy and
intuitive way, which represents a great advantage over AutoLisp.The language
has typical conditional (if, then, else) and looping (for each, for next, do while,
select case, go to) structures, like any other languages. Procedures can be
grouped under functions or subroutines.The syntax is similar to other
object-based languages, known as “dot syntax”, in which a dot after the name
of an object is used to access its properties (e.g. line.color = red) and trigger
its methods, followed by parameters (e.g. line.move frompoint, topoint). In
order to use this syntax, it is important to know AutoCAD´s object model, a
hierarchic structure that shows how collections and classes of objects relate
to each other. For example, Model Space is considered a collection in which
certain objects can be found, such as lines, polylines, 3dsolids, etc. It is
recommended (but not required) that VBA scripts start with the declaration
of variables, including the specification of their type (such as numbers, words
or AutoCAD entities) and the definition of their accessibility (public or
private).VBA uses arrays for storing data, such as the x, y and z coordinates
of a point. Because VBA is a very structured language, teaching it requires the
introduction of many programming concepts, even for developing very simple
programs.Alternatively, it is also possible to use the SendCommand function
to simply deliver strings of text to the AutoCAD editor’s command prompt.
The strings can be mixed with variables, and although this type of scripting is
a bit limiting, it is very easy for students with no experience in programming
to understand.
Let´s take as an example a macro that inserts parametric lines with a
simple interface with slider bars. Figure 1 shows the user interface and the
corresponding code in VBAIDE.The user loads the macro from AutoCAD´s
editor (Tools/Macro/Macros) and the interface pops up.The user then slides
the bars to change the start and end points´ x and y coordinates, presses
the button and returns to AutoCAD´s graphic area to see the resulting line.
To try another result, the line must be erased and the program must be
reloaded.The interface could contain an extra button to erase the line, but
the line always needs to be deleted and redrawn.The code is very simple. It
attributes the numerical values from the slider bar to the x and y
coordinates of each point (point 1 and point2) and then instantiates a line
object from point1 to point 2 in AutoCAD´s Model Space.
CAD Scripting And Visual Programming Languages For Implementing Computational Design 127
Concepts: A Comparison From A Pedagogical Point Of View
Green and Petre [9] have studied the psychological aspects of VPL’s by
comparing some VPL environments in terms of their cognitive dimensions.
According to them, using a visual environment for developing programs is
easier for many reasons:
“… there are fewer syntactic planning goals to be met, such as
paired delimiters, discontinuous constructs, separators, or
initialisations of variables; higher-level operators reduce the need
for awkward combinations of primitives; and the order of activity is
freer, so that programmers can proceed as seems best in putting
the pieces of a program together” (p.40).
In this type of programming there is no need to declare variables.The user
can simply grab a parameter element and attribute a value to it.There is
also no need to plan the order of actions, and there are no syntactical rules.
Even when a code window is used, it is constrained to a specific point, so
bugs can be easily located.
In regards to code evaluation, Green and Petre [9] state that
“The less experienced the programmer, the smaller the amount
that is produced before it must be evaluated. Novices need
‘progressive evaluation’, an environment where it is easy to check a
program fragment before adding to it.” (p.8)
Based on empirical studies about the use of VPL’s, authors such as
Saariluoma and Sajaniemi, and Green and Navarro (apud [9]) have
concluded that the spatial reasoning present in the manipulation of visual
diagrams functions as a support for developing abstract ideas when
developing code.
They can help organizing ideas when planning a computer program,
without necessarily following a linear path.
CAD Scripting And Visual Programming Languages For Implementing Computational Design 129
Concepts: A Comparison From A Pedagogical Point Of View
Figure 2: Grasshopper: the
diagrammatic representation window
is in the right side.
Visual programming environments for CAD can be very effective for design
exploration, especially for the automatic generation of parametric variations
of a shape.They can also be seen as a tool for representing design schemes
in a diagrammatic way, which can be very useful in design education,
considering that the diagram has become “the fundamental technique and
procedure of architectural knowledge”, a “final tool … for architectural
production and discourse” [12] (Figure 4).
6. CASE STUDY
An experiment with the use of a scripting and a visual programming
language was carried out with second year architecture students at the
University of Campinas (Unicamp) in a mandatory course, called “CAD in
the creative process”. It consists of a two-hour session every week, for 15
weeks [13]. Classes have typically 30 students, with previous experience
with 2D and 3D AutoCAD, but no experience with Rhinoceros or any
programming language.
The course included the following topics:
CAD Scripting And Visual Programming Languages For Implementing Computational Design 131
Concepts: A Comparison From A Pedagogical Point Of View
Table 2: Some design assignments
developed with VBA scripting.
In Exercise 1 most students used straight lines, except for one student, who
developed a spiral based on Fibonacci series. In Exercise 2 most students
used organic shapes, something that probably would have been more
complex to define using the scripting language.
A comparison between students’ reports on computational design
concepts in this class and previous ones showed that they developed a
better understanding of the concepts of generative design and the use of
computer tools for design exploration. In previous years students often
mentioned that implementing generative design systems with a scripting
language was interesting, but not something that they would do, whereas in
this class most students acknowledged parametric modeling as a viable
design strategy, and as something they would like to try in future
architectural design situations.
CAD Scripting And Visual Programming Languages For Implementing Computational Design 133
Concepts: A Comparison From A Pedagogical Point Of View
Figure 6: Implementation of
the Mughul Gardens shape
grammar [15] in Grasshopper,
by Carlos Vaz.
In all the examples above VB scripting was used mainly for controlling
recursion or for implementing transformation rules that would require too
many components if they were implemented simply with the visual
programming language. On the other hand, slider bars and other interactive
controls were easy to use in the the visual programming interface, and the
visualization of the results could be seen in real time in Rhino´s graphic
window.This would not have been possible in AutoCAD.
CAD Scripting And Visual Programming Languages For Implementing Computational Design 135
Concepts: A Comparison From A Pedagogical Point Of View
Figure 9. Learning curve of scripting
(VBA) and visual programming
(Grasshpper).
ACKNOWLEDGEMENTS
The author acknowledges the students who have taken course AU303 since
2004 for their enthusiasm and interest in computational design concepts,
and Carlos Vaz for his implementations in Grasshopper using VB script.
References
1. Mark, E., Martens, B., and Oxman, R.,The Ideal Computer Curriculum, in: Penttila,
H. (ed.), Architectural Information Management, 19th eCAADe Conference
Proceedings, Helsinki University of Technology, Helsinki, Finland, 2001, 168-175.
2. Mitchell,W. J.,The theoretical foundation of computer-aided architectural design,
Environment and Planning B, 1978, 2(2), 127 - 150.
3. Mitchell,W. J., Ligget, R. S., Kvan,T., The Art of Computer Graphics Programming,Van
Nostrand Reinhold, New York, 1987.
4. Schmitt, G., Microcomputer Aided Design for Architects and Designers, John Wiley &
Sons, New York, 1988.
5. Coates, P.,Thum, R., Generative Modelling - Student Workbook, University of East
London, London, 1995.
6. Celani, G., CAD Criativo, Campus-Elsevier, Rio de Janeiro, 2003.
7. Terzidis, K., Algorithmic Architecture, Architectural Press, Cambridge - MA, 2006.
Gabriela Celani
School of Civil Engineering, Architecture and Urban Design
University of Campinas
951 Albert Einstein Ave.
Campinas SP 13083852
Brazil
[email protected]
CAD Scripting And Visual Programming Languages For Implementing Computational Design 137
Concepts: A Comparison From A Pedagogical Point Of View