0% found this document useful (0 votes)
35 views198 pages

Creating GDL Objects E Guide

Création d'objets Archicad

Uploaded by

Philippe
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
35 views198 pages

Creating GDL Objects E Guide

Création d'objets Archicad

Uploaded by

Philippe
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 198

Graphisoft® ArchiCAD®

Creating GDL Objects


Interactive Training Guide
Graphisoft
Visit the Graphisoft website at http://www.graphisoft.com for local distributor and product availability information.
Graphisoft® ArchiCAD® 11 Creating GDL Objects – Interactive Training Guide
Copyright © 2008 by Graphisoft, all rights reserved. Reproduction, paraphrasing or translation without express prior written permission is
strictly prohibited.
Trademarks
ArchiCAD®, Virtual Building™, Virtual Trace™ and Virtual Building Solutions™ are trademarks of Graphisoft.
All other trademarks are the property of their respective holders.
CONTENTS
Preface ___________________________________________________ 5 4.4 Editing the GDL Object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
What is GDL?. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .5 4.5 Creating Custom Door Panels . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
How to learn GDL? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .5
5. Auto Saving Non-rectangular Windows. ____________________ 63
Getting started with the ArchiCAD Interactive Training Guide. . . . . . . . . . .5
5.1 Overview. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
Step 1: Download and install ArchiCAD . . . . . . . . . . . . . . . . . . . . . . . . . . .6
Step 2: Create the interactive training environment . . . . . . . . . . . . . . . . . . .7 5.2 Modeling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
Step 3: How to use Movie Player in ArchiCAD? . . . . . . . . . . . . . . . . . . . . .9 5.3 Creating the GDL Object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
5.4 Enhancing the 2D Symbol . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
1. Saving 2D Symbols from the Floor Plan_______________________ 11
5.5 Adding Material Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
1.1 Creating the Symbol . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 5.6 Make a Preview Picture with Lightworks . . . . . . . . . . . . . . . . . . . 75
1.2 Saving the Object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
1.3 Checking the Result . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 6. Basics of GDL Scripting __________________________________ 79
1.4 Final Touches . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 6.1 Overview. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
1.5 Using the 2D Symbol View . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 6.2 Creating Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
6.3 Creating the 3D geometry. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
2. Saving 3D models from the floorplan as GDL objects___________21
6.4 Assigning materials . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92
2.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 6.5 Creating value lists for parameters . . . . . . . . . . . . . . . . . . . . . . . . . 94
2.2 Modeling. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .22 6.6 Checking the 3D model. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96
2.3 Creating the GDL Object. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .25 6.7 Creating the 2D of the Object. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
2.4 Editing the GDL Object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .28 6.8 Placing and working with the Object . . . . . . . . . . . . . . . . . . . . . . . 98
3. Rotating Auto-saved Objects. Adding Material Parameters to Library 7. Basics of GDL Scripting – Part 2 __________________________ 103
Parts. ____________________________________________________35
7.1 Overview. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103
3.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .35
7.2 Creating the parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104
3.2 Modeling. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .36
7.3 Creating the master Script . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .111
3.3 Creating the GDL Object. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .38
7.4 Creating the 3D Script. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114
3.4 Editing the GDL Object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
3.5 Adding Material Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .44 8. Basics of GDL Scripting – Part 3 __________________________ 126
8.1 Overview. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126
4. Auto saving rectangular doors. Creating Custom Door Panels. ___48
8.2 Creating the Legs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132
4.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .48
8.3 Creating the 2D Script. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141
4.2 Modeling. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .49
8.4 Testing the completed object . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149
4.3 Creating the GDL Object. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .53

Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide 3


Contents

9. Advanced GDL Scripting_________________________________ 151 10.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175


9.1 Overview. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151 10.2 Creating the parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 176
10.3 Creating the 3D Script. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 179
9.2 Creating the Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152
10.4 Creating the animation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 180
9.3 Creating the Parameter Script. . . . . . . . . . . . . . . . . . . . . . . . . . . . 156
Part 2 – Construction simulation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185
9.4 Creating the 3D Script. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162
10.5 Bringing in data from Google Earth . . . . . . . . . . . . . . . . . . . . 185
9.5 Creating the macro call . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 168 10.6 Creating the Object from the Mass . . . . . . . . . . . . . . . . . . . . . 190
9.6 Creating the 2D Script . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 172 10.7 Creating the parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193
10.8 Creating the 3D Script. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 194
10. Advanced GDL Scripting – continued _____________________ 175 10.9 Creating the animation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 196
Part 1 – Opening Door . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175

4 Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide


Preface

PREFACE
The following ten Interactive Training Guide (ITG) chapters will • Those who want to learn how to create more advanced parametric
cover the most important aspects of GDL object making in objects with scripting can buy the GDL Cookbook from David
ArchiCAD. The first five lessons will illustrate how you can create Nicholson Cole.
Library Parts without any GDL scripting, by using only existing • Finally, it is recommended that professional library developers read
ArchiCAD tools. In the second part we will show you some basic the GDL Technical Standards document to understand
GDL programming examples. This Training Guide was developed to Graphisoft object standards.
introduce the world of GDL to a wide audience so that users can
increase their productivity in ArchiCAD.
GETTING STARTED WITH THE
WHAT IS GDL? ARCHICAD INTERACTIVE TRAINING
There is a powerful technology at the heart of ArchiCAD – GDL. GUIDE
This three letter abbreviation stands for Geometric Description
Language. GDL has been developed specially for ArchiCAD to This interactive training guide was written to ease and speed up your
describe 2D and 3D elements in a user-friendly parametric learning process, saving you time.
programming environment. Please read the three steps of this short introduction to familiarize
GDL objects are stored in external libraries; the objects are called yourself with the interactive training environment in ArchiCAD.
Library Parts in ArchiCAD. Each Library Part contains several Every chapter of the interactive training guide contains the following
text-based scripts dedicated to different purposes, including 2D elements:
symbols, 3D models and descriptions for quantity take-offs.
• a section of the PDF Guide with detailed
Whenever a GDL object is inserted into an ArchiCAD project, only a explanations and screenshots;
reference to the external Library Part is saved with the file. However,
users have the option of saving the project as an archive, which stores
the Library Parts in the file as well. • narrated movie clips providing step-by-step
instructions,
HOW TO LEARN GDL?
In addition to this Training Guide there are several other learning • an ArchiCAD training project file to complete the
tools available for those who want to know more about GDL: exercises.
• The GDL Reference Manual, available from ArchiCAD Help,
contains the complete list of commands and detailed descriptions
of GDL syntax. This is necessarily the prime source of
information for anyone who wants to learn GDL. The PDF guide can be printed and all the narrated movie clips can be
launched from the PDF. However, we recommend that you play the
• Beginners who are not interested in advanced GDL scripting can
movie clips within ArchiCAD, while completing the steps using the
find useful information in the Introduction to Object Making
training project files.
PDF document.

Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide 5


Preface

Step 1: Download and install ArchiCAD upgraded to FULL versions upon purchase of a commercial
license.
To best enjoy the unique benefits and simplicity of learning in an
interactive environment, we recommend that you install the
interactive training guide as well as the latest version of Graphisoft
ArchiCAD on your computer.
1 Install ArchiCAD on your computer to complete the steps of
this interactive training guide.
2 If you do not have ArchiCAD yet, please visit the following
websites to obtain a free ArchiCAD installer:
• If you are a student or a teacher, visit
https://eduregistration.graphisoft.com/ to register and
download a fully functional Education Version of
ArchiCAD® for Students and Teachers.

Please note that ArchiCAD is available in several localized languages for both
Macintosh and for Windows operating systems – make sure to choose the
language and installer version that best suits you.
3 Start the Graphisoft ArchiCAD installer and follow the
installation wizard to complete the process.

• If you are a professional architect, visit


https://trialregistration.graphisoft.com/ to register and
download a fully functional 30-day trial version of ArchiCAD.
Projects saved with this TRIAL version can be automatically

6 Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide


Preface

In case you have not done so already, please install the interactive
training guide on your computer.
4 Start the installer of the interactive training guide and follow
the instructions on the screen. We recommend you install the
guide to the “default” location suggested in the installation
wizard.
Once you have successfully installed both Graphisoft ArchiCAD and
any of the Interactive Training Guide packages, please proceed with
the following steps to initiate the interactive learning environment.

Step 2: Create the interactive training


environment The ArchiCAD splash screen will appear shortly after you start the
program, and the “Start ArchiCAD” dialog will be displayed.
Introduction.mp4
2 Select the “Standard Profile” for the active Work
Watch Movie
Environment in the “Start ArchiCAD” dialog. Select the
1 Start ArchiCAD on your computer by double-clicking its “Open Project” option, then click the “Browse” button to
desktop shortcut. locate the ArchiCAD training project file on your local
computer.

Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide 7


Preface

4 Select the “Read elements directly from archive” option for


Active Library Usage in the “Open Archive Project” dialog.

If you installed the interactive training guide to its default location,


then you will find its folder in the “Graphisoft” folder of your
machine. The Graphisoft folder is located in the “Applications”
folder on Macintosh, or in the “Program Files” folder on Windows
operating systems.
3 Browse the chapters of this training guide and open any of ArchiCAD will open the selected archive project and read all the
the ArchiCAD Project archive (.PLA) files. library elements directly from the archive file. The ArchiCAD training
project files are all saved as archive files. This is important because the
library elements have different names in localized versions of
ArchiCAD (“localized” meaning translated to foreign languages and
customized to meet different local standards).
5 Activate the “File > Save As…” command, and save an
ArchiCAD Solo Project of the currently open design file to
the folder in which the previously opened archive file was
located. The Solo Project format and the correct library are

8 Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide


Preface

selected automatically, so practically all you have to do is to Step 3: How to use Movie Player in
click the “Save” button to proceed.
ArchiCAD?
Let’s briefly look over the main features and functions of the
ArchiCAD Movie Player.
1 Open the Movie Player by activating “Help > ArchiCAD
Movie Player”.

2 The Movie Player will open and the first training clip will be
automatically loaded. Feel free to reposition or re-size the
movie player on your screen.

This is an important step, since certain exercises will require a Solo


Project file to be saved on your local computer. The Movie Player
plug-in also requires this step for it to be able to open the necessary
training clips automatically.
Now that the “training environment” has been set up, and you are
ready to proceed with any of the exercises!
Please note that for certain exercises the training environment
described above will not be available, since some of the steps of the
exercises will be completed using other applications, such as an
Internet browser or a PDF viewer. In such cases please play the
corresponding training movie clip using Apple’s free QuickTime 3 Click the Play button on the player to start the first clip. You
Player application. All the training movie clips are available from the can pause the movie at any time, or use the slider to repeat or
chapter-folders of this guide. skip any parts of the clip.

Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide 9


Preface

4 Once the movie is over and you have completed the current
step of the exercise, click the “Next” button to proceed to the
next step of the exercise and open the corresponding training
clip. You can also click the “Previous” button if you wish to
open the previous clip.
The title bar of the movie player always indicates the number of the
current step and the total number of steps available in the current
chapter.

We hope that you will find this guide useful and will agree with what
experienced architects worldwide say: ArchiCAD is easy to learn and
fun to use.
You are always free to contact Graphisoft and its worldwide partners
if you have further questions: www.graphisoft.com.

10 Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide


1. SAVING 2D SYMBOLS FROM THE FLOOR PLAN

1. SAVING 2D SYMBOLS FROM THE FLOORPLAN


In this first chapter we will save a custom 2D object – a north symbol
– from the floor plan and then make some final refinements in the
Library Part Editor. The final – optional - step demonstrates an
alternative way to create custom 2D objects by copying 2D elements
from the floor plan into the 2D symbol view window of a Library
Part.
Although these are all really simple operations, they will highlight
some basic concepts of making objects with ArchiCAD.
All elements of the ArchiCAD floor plan can be saved automatically
as 2D symbol objects.
You don’t have to be afraid to open the GDL Object Master Window.
This logical setup dialog allows you to modify your existing objects
according to your needs.
You can add more value to your auto saved objects with some
easy-to-learn techniques.
Please review the “Getting started with the ArchiCAD Interactive
The 2D symbol view of GDL elements allows you to create a 2D Training Guide” chapter if you need further information on how to
symbol for your object with standard 2D ArchiCAD tools. set up ArchiCAD, adjust the necessary ArchiCAD Working
Environment, or open the training guide project files.
1.1 CREATING THE SYMBOL Hint: If you want to check the complete GDL object that we are
going to make, open the Object Tool and locate the
AC Guide GDL Ch “ITG_North_Symbol_Final” Library Part in the object browser.
01_01.mp4 The object is located in the “Finished Objects” folder.
Watch Movie
2 Open the “AC Guide GDL Ch 1” folder in the Navigator and
Let’s start this lesson by completing our custom north symbol on the activate (by double-clicking) the “1.1 Complete the Symbol”
floor plan. pre-set view in the “Chapter 1” folder.
1 Open the “AC Guide GDL Ch 01.pla” ArchiCAD project file As you can see we have prepared a nearly complete north symbol for
to start the first lesson of this interactive, hands-on you on the floor plan. We used the standard ArchiCAD tools (Line,
ArchiCAD training guide. Select the “Read elements directly Circle, Text) and commands (e.g., Multiply) to create this custom
from archive” option. symbol. These techniques were discussed in greater detail in previous
ITG lessons; therefore, these steps are not described here. In the next
step we’ll add some solid fills to the drawing to make it complete.

Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide 11


1. SAVING 2D SYMBOLS FROM THE FLOOR PLAN

5 Click OK to leave the “Fill Default Settings” dialog box.


Zoom in on the north sign. Press the Space button to activate
the “Magic Wand” . The cursor’s shape changes to a
magic wand indicating that ArchiCAD will automatically
trace the boundaries of the area where you click with the
cursor
6 Use the left mouse button to click in the middle of those
empty areas that you would like to cover with solid fills. You
can check the completed symbol on the right side of the
screen for reference.

Hint: Whenever you want to create GDL objects on the floor plan
to be saved as GDL objects – regardless of whether they are 2D
symbols or real 3D elements - we highly recommend that you
draw them close to the project origin. Elements placed too far
from the origin may result in minor inaccuracies in the GDL code.
3 Activate the “Fill Tool” in the “Tool Box” and click on the
“Fill Tool Settings” button in the “Info Box” to display the
“Fill Default Settings” dialog box.
4 Click on the “Fill Pattern” button and select the “Solid Fill” Hint: To avoid segmentation of curved polygon edges, make sure
type from the pop-up dialog. Set “Pen 1” for all three that the “Tracing Method” is set to “Best Match” in the “Magic
adjustable pen types (Outline, Cover Fill, Cover Fill Wand Settings” dialog (Options > Magic Wand Settings…)
Background Pen). before you click.

1.2 SAVING THE OBJECT


AC Guide GDL Ch
01_02.mp4
Watch Movie
Let’s save the previously created drawing elements as a GDL object.
1 Open up the “ArchiCAD Guide” folder in the Navigator and
activate (by double-clicking) the “1.2 Create the GDL
Object” pre-set view in the “Chapter 1” folder.

12 Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide


1. SAVING 2D SYMBOLS FROM THE FLOOR PLAN

Hint: For easier library management we suggest you always save


your custom Library Parts into a dedicated folder other than the
standard ArchiCAD Library folder. For each new project we
recommend you create a new library folder where the
project-specific elements can be stored. Furthermore, it’s very
important to give a descriptive name (e.g., with a project-specific
suffix or prefix) to your custom objects in order to avoid any
Library Part naming conflicts among the loaded libraries.
4 Click OK to create the GDL object at the specified location.
Hint: Whenever a new GDL object is made in ArchiCAD it is
automatically loaded into the actual project. You can double check
this if you open the Library Manager (File > Libraries and
Objects > Library Manager) and review the list of Library Parts
2 Click on the Arrow Tool. Select all the drawing elements with under the “Other Objects” category. Naturally, if you want to use
a selection polygon. this object in your other projects you have to load it (or the folder
that contains it) with the Library Manager.

1.3 CHECKING THE RESULT


AC Guide GDL Ch
01_03.mp4
Watch Movie
Let’s look at the capabilities of the newly created Library Part.
1 Open up the “ArchiCAD Guide” folder in the Navigator and
activate (by double-clicking) the “1.3 Check the Result”
pre-set view in the “Chapter 1” folder.
Hint: Alternatively, you can hold down the shift button and click
2 Open the “Object Default Settings” dialog by
the elements for selection one by one. You can also launch the
double-clicking on the Object Tool in the Toolbox. Note that
“Select All” command (Edit > Select All) for the same result.
“ITG North Symbol” is the currently active object in the
3 Activate the “Save Selection as...” command (File > Libraries browser on the left side. Click OK to go back to the floor plan
and Objects > Save Selection as…) and click anywhere with the left mouse button to place an
and in the opening dialog specify the name and location of example of the new object. You may also place additional
the new Library Part to be created. Save the object as copies of this element with additional mouse clicks.
“ITG_North_Symbol” into
the “ArchiGuide\ITG Library” folder.

Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide 13


1. SAVING 2D SYMBOLS FROM THE FLOOR PLAN

Hint: GDL objects can be selected with their hotspots or over the
areas of their 2D fills. ArchiCAD places hotspots on the bounding
box corners and in the center of auto-saved objects. Additional
hotspots can be found at the corners of fill polygons.
4 Move your cursor over one of the bounding box hotspots
until the cursor’s shape changes to a checkmark. Click to
open the “Pet Palette”.
5 Click on the rightmost button (Stretch mode), move the
hotspot and click again to finish the operation.

The object is automatically stretched to fit into the resized bounding


box.
Hint: In order to avoid distortions of the symbol you have to
stretch it along the diagonal of the bounding box. Alternatively,
you can select the object, then open “Object Selection Settings”
and enter the required values in the Length and Width fields under
“Parameters”.
ArchiCAD also allows you to adjust the pen and the line-type of
auto-saved objects.
6 Select the North Symbol again with the Arrow Tool and then
open the “Object Selection Settings” dialog by double
clicking on the Object tool or by clicking once on the Object
3 Activate the Arrow Tool from the Toolbox and select the Settings icon in the Info box.
object by making a selection rectangle around it. The active
points (hotspots) of the element become visible.

14 Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide


1. SAVING 2D SYMBOLS FROM THE FLOOR PLAN

7 Under “Floor Plan and Section” uncheck the “Enable


Object’s Pens” checkbox and change the “Symbol Line
Pens” value to six.

2 Click Cancel to return to the floor plan.


3 Leaving the element selected, activate the “Open Object”
command (File > Libraries and Objects > Open Object…).
This opens the selected element’s GDL Master Window.
8 Click OK to return to the floor plan and check the result.

1.4 FINAL TOUCHES


AC Guide GDL Ch
01_04.mp4
Watch Movie
Our current object doesn’t have a preview picture associated with it. Hint: Each GDL Object has its own Master Window. All controls
That makes it difficult to identify it in the object browser should there needed to edit a GDL Object are present in the Master Window.
be many elements loaded. In this section we are going to learn how Any number of GDL Object Master Windows can be open at the
we can add a preview image and a short description to your object. same time.
1 Select the object and open the “Object Selection” dialog as The elements of the GDL Master Window will be introduced in more
described above. Click on the “Preview options” buttons one detail in the next lessons.
by one.
Note that both the Preview picture and the Comment windows are
empty.

Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide 15


1. SAVING 2D SYMBOLS FROM THE FLOOR PLAN

4 Click on the Preview Picture button. 9 Click on the “Preview Picture” button and paste the content
The Preview picture window opens, even though it is empty at this of the clipboard with the Paste command (Edit > Paste).
stage. Now we’ll copy an existing image into it.
Hint: The picture that we are going to use was made with a screen
capture tool and an image editing application. The size of the
image is exactly 128x128 pixels so that it fits perfectly in the
“Preview Picture” area.
Click on the floor plan area outside the GDL Master Window to
return to the floor plan.
5 Activate the “File > Open…” command and select the
“ITG_01_preview.png” file in the
“ArchiCAD Training Guide” folder. Make sure that the “All 10 Close the “Preview Picture” window by clicking on the top
Files” types option is selected. right corner and open the “Comments” window by clicking
on the Comments button.
11 Enter the following text in the comment window: My
Custom North Symbol Object

6 Select the picture with the “Edit > Select all…” (Ctrl+A)
command.
7 Copy the content of the selection with the Copy command
(Edit > Copy).

12 Close the Comments window.


13 Save your changes to the object with the Save command (File
> Save) and close the GDL Master Window.
14 Back on the floor plan open the Object Selection Settings
dialog then check the preview picture and comments added
8 Return to the GDL Master Window (Window > ITG North to the ITG North Symbol Object.
Symbol).

16 Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide


1. SAVING 2D SYMBOLS FROM THE FLOOR PLAN

15 Return to the floor plan with OK. Save the project file with In this last chapter we’ll explain how you can create a symbol object
Save (File > Save) and close it (File > Close). that you can easily modify with just the standard ArchiCAD 2D
editing tools.
1.5 USING THE 2D SYMBOL VIEW 1 Open up the “ArchiCAD Guide” folder in the Navigator and
activate (by double-clicking) the “1.4 Use the 2D Symbol
AC Guide GDL Ch View” pre-set view in the “Chapter 1” folder.
01_05.mp4
Watch Movie
The object is now finished, and you can use it in your projects when
you need exactly the same symbol. Furthermore, you have the option
of changing its pen color and size as described in Chapter 1.3.
However, making any modifications in the content of the symbol
requires some basic GDL scripting knowledge, since the 2D symbol
is stored as a series of GDL commands in the object’s 2D Script
window. You can check this yourself if you open the object’s GDL
Master Window and click on the 2D Script button.

Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide 17


1. SAVING 2D SYMBOLS FROM THE FLOOR PLAN

4 Click on the “2D Symbol” button.


The 2D symbol window opens.

If the actual scale of this window is other than 1:50 then please set it
to 1:50 in the bottom-left corner of the dialog.
2 Select the symbol with the area selection and copy it to the
clipboard. 5 Paste the content of the clipboard with “Edit > Paste”.
6 If the “Pasting…” dialog opens, select the “Paste to Original
Location” and “Zoom to Pasted Elements” options.

3 Create a new GDL object with “File > Libraries and objects
> New Object...”.
The object’s GDL Master Window opens.

18 Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide


1. SAVING 2D SYMBOLS FROM THE FLOOR PLAN

7 Click outside the selection marquee or hit Enter to place the 9 Click on the “Details” button in the currently open GDL
copied elements. Master window and in the opening dialog check the “Fit size
to 2D symbol” checkbox. Close the dialog with OK.

The A and B parameters were automatically set according to the


original size of the symbol.

Please note that the 2D symbol window provides an environment Hint: You can also add a preview picture and comments to your
similar to the ArchiCAD floor plan view. All the standards 2D tools object as described in Chapter 1.4.
(e.g., Line, Fill, Text) and editing commands (Trim, Rotate, Copy, etc.)
can be used here to create the desired 2D symbol. Consequently, you 10 Save the object as “ITG_North_Symbol_02” into the
don’t have to know GDL if you want to edit these elements. To “ArchiGuide\ITG Library” folder with “File > Save”. Close
demonstrate how easy it is to modify this object let’s add a few more the GDL Master window with OK.
hotspots to it. 11 Back on the floor plan place the newly created object with
8 Activate the Hotspot tool and place a hotspot in the middle the Object Tool and check the result.
of symbol and on the quarter points of the outer circle.
Please note that when you place a 2D object that was defined in the
2D symbol window on the floor plan, ArchiCAD will automatically
resize it according to the actual setting of the A/B parameters (width,
height). Currently the A/B parameters are set to 1m (see the
parameter list). Consequently, this will be the default size of our north
symbol object. If you want to preserve the original size of your
symbol you have to modify the A and B parameters accordingly. You
can do it manually or you can use the Fit size to 2D symbol option
from the Details window. We’ll do the latter.

Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide 19


1. SAVING 2D SYMBOLS FROM THE FLOOR PLAN

Hint: If you want to further edit this object select it on the floor
plan and open its GDL Master window with “File > Libraries
and objects > Open Object…”.
In the opening dialog click on the 2D symbol button and make the
necessary adjustments with the standard 2D tools and editing
commands, then save the changes.
12 Close the project with “File > Close”.

20 Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide


2. Saving 3D models from the floorplan as GDL objects

2. SAVING 3D MODELS FROM THE FLOORPLAN AS GDL


OBJECTS
The previous chapter explained how you can save 2D symbol objects Before we start working let’s have a quick look at the object that we
from the floor plan. In this lesson we’ll go one step further and make are going to model.
a 3D GDL object using only the standard ArchiCAD tools. This 2 Open up the “AC Guide GDL Chapter 02” folder in the
interactive training session demonstrates the following basic Navigator and activate (by double-clicking) the “2.1
object-making techniques: Overview” pre-set view in the “Chapter 2” folder.
• Three-dimensional ArchiCAD models can be saved automatically as
GDL objects. This process doesn’t require any GDL knowledge. The Double Coffee Table known as “907B” was designed by Alvar
• Any kind of ArchiCAD Tool can be used to develop 3D models Aalto in 1933. The table's two-tier design is unique given Aalto's
that can be saved as a GDL object output and is unusual in its construction. The lower tier is suspended
from the tabletop so that it appears to float. For more info please visit
the manufacturer’s website: www.artek.fi
2.1 OVERVIEW
AC Guide GDL Ch
02_01.mp4
Watch Movie
1 Open the “AC Guide GDL Ch 02.pla” ArchiCAD project file
to start the second lesson of this interactive, hands-on
ArchiCAD GDL training guide. Select the “Read elements
directly from archive” option.

Hint: If you want to check the complete GDL object that we are
going to make, open the Object Tool and find the
“Coffee_Table_907B_Final” Library Part in the object browser.
The object is located in the “Finished Objects” folder.

Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide 21


2. Saving 3D models from the floorplan as GDL objects

2.2 MODELING
AC Guide GDL Ch
02_02.mp4
Watch Movie
1 Open up the “AC Guide GDL Chapter 02” folder in the
Navigator and activate (by double-clicking) the “2.2
Modeling Steps” pre-set view in the “Chapter 2” folder.

3 Open the Slab Tool and click on the “Favorites”


button.
4 Select “Upper Tabletop” from the list and click “Apply”.

We are going to take three steps to model the chair on the floor plan;
first we’ll create the two tabletops using the Slab Tool, then the four
suspensions with the Column Tool and finally the four legs with the
Wall Tool. We’ll use the top elevation drawing of the table as a
construction aid.
2 Activate (by double-clicking) the “2.3 Model the Tabletops”
pre-set view in the Navigator. The required Slab parameters are set for modeling the first main
We start the modeling process by creating the double tabletops. The frame element.
active view set shows only the contours of the elements to allow the
use of the Magic Wand function.

22 Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide


2. Saving 3D models from the floorplan as GDL objects

5 Click OK on the “Slab Default Setting” dialog box 10 Click “OK” on the Slab Default Setting dialog box to
to return to the floor plan. return to the floor plan.
6 Zoom in the bigger circle (the upper tabletop) and hold 11 Zoom in the smaller circle (the lower tabletop) and hold
down the Space button on the keyboard to activate the Magic down the Space button on the keyboard to activate the Magic
Wand function. The cursor’s shape changes to a magic wand Wand function. The cursor’s shape changes to a magic wand
indicating that ArchiCAD will automatically trace the indicating that ArchiCAD will automatically trace the
contours of the clicked polygon. contours of the clicked polygon.
7 Move the cursor over the bigger circle until the cursor’s 12 Move the cursor over the smaller circle until the cursor’s icon
shape shows that it has found a polygon, then click. indicates that it has found a polygon and click.

8 Open the Slab Tool again and click on the Now the two tabletops are ready (you can check them in the 3D
“Favorites” button. window), so we can start creating the suspensions that connect them.
9 Select “Lower Tabletop” from the list and click “Apply”. 13 Activate (by double-clicking) the “2.4 Model the
Suspensions” pre-set view in the Navigator.

The floor plan shows four hotspots that indicate the center points of
the four rectangular suspensions.

Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide 23


2. Saving 3D models from the floorplan as GDL objects

17 Click once over every hotspot to place the four suspensions.


18 Activate (by double-clicking) the “2.5 Model the Legs”
pre-set view in the Navigator.
The floor plan shows the four lines where the legs need to be placed.

14 Open the Column Tool and click on the


“Favorites” button.
15 Select “Tabletop Suspension” from the list and click
“Apply”.

19 Open the Wall Tool and click on the “Favorites” button.

20 Select “Table Leg” from the list and click “Apply”.

The required Column setting values are set so that you can create the
suspensions.
16 Click “OK” on the Column Default Setting dialog
box to return to the floor plan.

24 Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide


2. Saving 3D models from the floorplan as GDL objects

The required Wall setting values are set for modeling the four legs.
Please note that this special Wall type uses a Custom Profile that we
previously defined in the “Profile Manager” dialog.

To revise the Wall’s profile click on Design > Complex Profiles > Now we are finished with the modeling.
Profile Manager… and choose the “Table Leg” profile.
2.3 CREATING THE GDL OBJECT
AC Guide GDL Ch
02_03.mp4
Watch Movie
1 Open up the “AC Guide GDL Chapter 02” folder in the
Navigator and activate (by double-clicking) the “2.6 Check
2D” pre-set view in the “Chapter 2” folder.
The floor plan shows the complete model. If you’ve followed the
previous steps precisely you should see this figure:

21 Click “OK” on the Wall Default Setting dialog box to return


to the floor plan.
22 Draw straight wall segments along the four lines. Please note
that the Walls’ starting points are indicated by the label
arrows. The required Wall Geometry settings are shown below.

Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide 25


2. Saving 3D models from the floorplan as GDL objects

2 Activate (by double-clicking) the “3.7 Check 3D” pre-set


view in the Navigator.
The 3D window opens and you can check the consistency of your 3D
model.

Hint: You can check the actual 3D window setting if you activate
Before we continue we have to understand the concept of auto-saving the View > 3D View Mode > 3D Projection Settings
GDL. The rule is very simple: the viewpoint of the 3D window will command. As you can see in the opening dialog the Top view
define the top view of the automatically saved Library Part. Thus we mode is active and the camera azimuth is set to 270°.
have to look at the 3D model from a perpendicular top view.
3 Activate (by double-clicking) the “2.8 Open the Top View”
pre-set view in the Navigator.
This previously defined view automatically sets the required 3D top
view.

26 Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide


2. Saving 3D models from the floorplan as GDL objects

4 Activate the “File > Libraries and Objects > Save 3D Model
as…” command.
5 In the opening dialog select a folder where you want to save
the new object and enter “Coffee_Table_907B.gsm” in the
“Save As:” field.
Hint: Make sure to save the object into a folder where you will be
able to find it later. We suggest you store it near the currently open
ArchiCAD file.
6 The “Save as Library Part” dialog opens. Select the Object
type and turn on the “Remove redundant lines from symbol”
and the “Editable GDL script” options. Click “Save” to
create the object and to close this dialog.

8 Double click on the Object Tool and make sure that


“Coffee_Table_907B.gsm” is the active object. Click OK to
return to the floor plan

Hint: The Editable GDL Script option allows us to make


modifications in the object’s scripts later.
7 Open up the “AC Guide GDL Chapter 02” folder in the
Navigator and activate (by double-clicking) the “2.9 Place
the Object” pre-set view in the “Chapter 2” folder.

The floor plan shows the original model and indicates the point
where you can place the object that has just been created.

Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide 27


2. Saving 3D models from the floorplan as GDL objects

9 Place the coffee table object on the floor plan with a click of
the mouse where indicated by the label.
2.4 EDITING THE GDL OBJECT
AC Guide GDL Ch
02_04.mp4
Watch Movie
1 Open up the “AC Guide GDL Chapter 02” folder in the
Navigator and activate (by double-clicking) the “2.11 Edit
the Object” pre-set view in the “Chapter 2” folder.

10 Activate (by double-clicking) the “2.10 Check 3D” pre-set


view in the “Chapter 3” folder.

2 Activate the Arrow tool and make an area


selection around the object.

The GDL model is now complete. In the next section we’ll add a
Preview Picture to the Library Part and enhance the object’s 2D
symbol.

28 Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide


2. Saving 3D models from the floorplan as GDL objects

Note that the object’s 2D symbol doesn’t contain a background fill, deal with the Preview Picture and the 2D Symbol. Other elements of
thus it can’t be selected with the Quick selection mode (Magnet) over the Master Window will be discussed in more detail in the following
its area. You either have to make a selection rectangle around it or you ITG chapters. Let’s start editing the object by enhancing the 2D
have to click on one of the bounding box corner points to select it. symbol.
Furthermore, the floor plan symbol contains two line segments 6 Click on the “2D Symbol” button to open the 2D symbol
instead of real circles since the 2D symbol was derived from the editing window.
object’s 3D top view.
3 Double click on the Object Tool or click once on
the Settings dialog icon in the Info box.
As you can see the object doesn’t have a Preview Picture associated
with it, thus it is difficult to identify in the object browser. Let’s fix
these problems with some easy-to-learn techniques.
4 Click “Cancel” to return to the floor plan.
5 Keeping the object selected, activate the “File > Libraries
and Objects > Open Object” command.

The 2D Symbol window is very similar to the floor plan window


since you can also use the standard ArchiCAD tools and editing
techniques here, except for the 3D elements (e.g., Walls, Columns).
Thus, you can modify the floor plan symbol of a Library Part without
knowing the GDL language. The current symbol, which was made
from the object’s top view, is not suitable for us since it contains line
segments instead of circles but no background fills or hotspots. Let’s
delete all elements from the 2D symbol window.
7 Activate the “Edit > Select All” command and then hit the
Delete button on your keyboard.

All elements are cleared from the window. Now you can start drawing
the required new symbol with the 2D ArchiCAD tools or you can
copy an existing drawing from the floor plan. We’ll do the latter.

The GDL Master Window opens. Each GDL Object has its own
Master Window in ArchiCAD. All controls needed to edit a GDL
Object are present in the Master Window. In this lesson we’ll only

Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide 29


2. Saving 3D models from the floorplan as GDL objects

8 Activate (by double-clicking) the “2.11 Edit the Object” 12 Click on the “2D Symbol” window to activate it and launch
pre-set view in the Navigator to return to the floor plan. the “Edit > Paste” command.

9 Select the new 2D symbol with the Arrow Tool on the top left
corner of the floor plan. The content of the clipboard (the new symbol) is pasted into the
Note that this enhanced 2D symbol drawing contains real circles, active view. If the current zoom of the 2D symbol window is not big
hotspots and a white background fill. enough to include the pasted elements you’ll see a warning dialog. In
10 Activate the “Edit > Copy” command. that case select the following options:
• “Paste to Original Location”
11 Click on “Window > Coffee_Table_907B” to return to the • “Zoom to Pasted Elements”
object’s Master window. 13 Click outside the selection marquee around the pasted
elements to place them into the current view.
Before we continue with adding the Preview Picture let’s check that
the 2D symbol was placed to the correct location as compared with
the 3D model. This control step is always recommended when you
modify the 2D symbol of an existing 3D object. Please take a look at
the 2D symbol window and note that the center point of the tabletop
is located in the origin of the coordinate system (the origin is marked
with an “X”).
14 Close the 2D Symbol window.

30 Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide


2. Saving 3D models from the floorplan as GDL objects

15 Open “View > 3D View Mode > 3D Projection Settings”, about the 3D GDL coordinate system is that the Global Coordinate
choose the top view and set the camera azimuth to 270. System is the equivalent of the 2D symbol’s coordinate system in the
3D environment. The origin of the Global Coordinate System is
located in the bottom left corner of the object, which means that the
2D symbol has shifted from the 3D model. Let’s fix this problem.
17 Open the “2D Symbol” window again.
18 Activate the “Edit > Select All” command.

19 Drag the symbol with the mouse so that the bottom left
corner of the selected elements’ bounding box moves to the
coordinate system’s origin point.

16 Click on the “3D View” button from the object’s GDL Master
Window.
The object’s top view is displayed.

Please note that there are two coordinate system icons in this view. The 2D symbol is now at the correct location.
One of them is marked with “L” (meaning Local Coordinate System), Hint: ArchiCAD put hotspots on the bounding box of
the other one is labeled with “G” (Global Coordinate System). The automatically saved GDL objects. If you want to turn them off you
differences between the Local and the Global coordinate systems will have to click on the “Details” button in the object’s GDL Master
be explained in a later chapter. At this stage all you have to know Window and uncheck the “Hotspots on bounding box” option in

Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide 31


2. Saving 3D models from the floorplan as GDL objects

the opening dialog. Once you have done this only the hotspots images for this purpose. If you want to make rendered images to
defined in the 2D symbol window will be displayed in the floor be used as Preview Pictures make sure that the 3D window is set
plan. The default hotspot in this case is always the one that was to a rectangular shape and the size of the photorendering window
placed first when you made the symbol. In this example the default is exactly 128x128 pixels.
hostpot is in the center of the table. 21 Activate (by double-clicking) the “2.11 Edit the Object”
pre-set view in the Navigator to return to the floor plan.
22 Activate the “File > Open…” command and select the
“907B-s.png” file in the “Chapter 02” folder. Make sure that
the “All Files” types option is selected.

20 Close the 2D Symbol window and click on the “Preview


Picture” button.
The Preview Picture window, which is currently empty, opens. There
are two ways to add a Preview Picture to a Library Part: you can copy
an existing image from an external source, or you can create a new
image in ArchiCAD (e.g., in the rendering window) and paste it to the
Preview Picture window. We are going to copy a previously made
picture.
Hint: The size of the preview window is 128x128 pixels. In order 23 Activate the “Edit > Copy” command.
to avoid the distortion of the Preview Picture use rectangular

32 Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide


2. Saving 3D models from the floorplan as GDL objects

24 Click on “Window > 27 Save your changes with “File > Save”.
Coffee_Table_907B” to return to the 28 Close the object Master Window.
object’s Master window.
29 Open up the “AC Guide GDL Chapter 02” folder in the
Navigator and activate (by double-clicking) the “2.12 Check
the Result” pre-set view in the “Chapter 2” folder.

30 Back on the floor plan, select the object with the arrow tool.
25 Click on the “Preview picture” window to activate it and
launch the “Edit > Paste” command.

The pasted image is added to the object’s Preview


Picture window.

26 Close the Preview Picture window.

Note that the area selection is now applicable for the element as the
2D symbol contains background fill. Furthermore, the symbol is
made of real circles and there are no hotspots on the bounding box.
31 Click on the Object Tool to open the Library
Part’s settings dialog.

Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide 33


2. Saving 3D models from the floorplan as GDL objects

The object is now displayed with its Preview Picture in the object “Coffee_Table_907B” object will be available for later use
browser. The parameter list contains the new material parameters. from the folder where you saved it.
32 Click OK to return to the floor plan. If you prefer you can 33 Close the project with “File>Close”.
save this ArchiCAD project with “File > Save”. The

34 Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide


3. Rotating Auto-saved Objects. Adding Material Parameters to Library Parts.

3. ROTATING AUTO-SAVED OBJECTS. ADDING


MATERIAL PARAMETERS TO LIBRARY PARTS.
In this chapter we will show how you can change the 3D orientation
of your automatically saved GDL objects without any GDL scripting.
You will also learn how you can make the object’s materials
parametric without any manual GDL coding. In this example an
armchair laid on its side will be modeled with ArchiCAD tools. Then
the model will be saved from its 3D side view window as a GDL
object in order to create a chair that is standing on the floor. This
lesson demonstrates the following basic object-making techniques:
• The viewpoint of the 3D window (from where the model is saved
as a GDL element) defines the 3D orientation of the resulting
Library Part.
• You can add material parameters to your objects with the use of
the “Find & Replace” command.
Before we start working let’s have a quick look at the object that we
are going to model.
3.1 OVERVIEW 2 Open up the “AC Guide GDL Chapter 03” folder in the
AC Guide GDL Ch Navigator and activate (by double-clicking) the “3.1
03_01.mp4 Overview” pre-set view in the “Chapter 3” folder.
Watch Movie
1 Open the “AC Guide GDL Ch 03.pla” ArchiCAD project file The “Paimio Chair” - which has become a classic piece of furniture -
to start the third lesson of this interactive, hands-on was designed by Alvar Aalto for the Paimio Sanatorium in 1931-1932.
ArchiCAD GDL training guide. Select the “Read elements The structure is made entirely of bent plywood. The frame is a birch
directly from archive” option. color and the seating is available in lacquered white or black finish.
For more information please visit the manufacturer’s website:
www.artek.fi
Hint: If you want to check the complete GDL object that we are
going to make, open the Object Tool and locate the
“Armchair_Paimio_Final” Library Part in the object browser. The
object is located in the “Finished Objects” folder.

Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide 35


3. Rotating Auto-saved Objects. Adding Material Parameters to Library Parts.

2 Activate (by double-clicking) the “3.3 Model the Frames”


pre-set view in the Navigator.
3.2 MODELING We start the modeling process by creating the main frames. The active
view set shows only the contours of the main frame to allow for the
AC Guide GDL Ch use of the Magic Wand function.
03_02.mp4
3 Open the Slab Tool and click on the “Favorites”
Watch Movie
button.
1 Open up the “AC Guide GDL Chapter 03” folder in the 4 Select “Main Frame” from the list and click “Apply”.
Navigator and activate (by double-clicking) the “3.2
Modeling Steps” pre-set view in the “Chapter 3” folder. The required Slab parameters are set for modeling the first main
frame element.
You can save precious time if you make a plan before you start 5 Click “OK” on the “Slab Default Setting” dialog
modeling. We have chosen this chair for this lesson because it can be box to return to the floor plan.
modeled relatively easily with just the standard ArchiCAD tools, 6 Zoom in the main frame’s external contour and hold down
provided that the object is laid on its side. We will model the chair in the Space button on the keyboard to activate the Magic Wand
three steps: first we’ll create the main frames, then the bracings and function. The cursor’s shape changes to a magic wand
finally the seating. All these elements will be modeled with the Slab indicating that ArchiCAD will automatically trace the
tool. We’ll use the side elevation drawing of the chair as a contours of the clicked polygon.
construction aid. 7 Move the cursor over the frame’s external contour until the
cursor’s shape shows that it has found a polygon, then click.

8 Select the slab with the Arrow and then activate


the Slab Tool with one click.
Hint: If you want to select an element without leaving the active
ArchiCAD tool push the Shift key and click on the element.

36 Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide


3. Rotating Auto-saved Objects. Adding Material Parameters to Library Parts.

9 Leave the slab selected, zoom on the frame’s internal contour The floor plan shows the contours of the three bracings. First we’ll
and click on it with the Magic Wand (Space+click). construct the two bracings that support the seating.
14 Open the Slab Tool and click on the “Favorites”
button.
15 Select “Bracing 01” from the list and click “Apply”.
The required Slab setting values are set for modeling the first two
bracings.
16 Click “OK” on the Slab Default Setting dialog box
to return to the floor plan.
17 Keep the Space button pressed to activate the Magic Wand
and click once over the first bracing’s contour. Repeat
this step over the second bracing.

The bottom frame is ready. To create the upper frame we’ll make a
copy of the bottom one.
10 Leaving the slab selected activate the “Edit > Move > Drag a
Copy” command.
11 Create a copy of the slab at the same place as the original one
by clicking the cursor twice at the same point.
12 Leaving only one slab selected, activate the “Edit > Move >
Elevate” command and enter “540” in the Elevate dialog that 18 Open the Slab Tool and click on the “Favorites” button.
appears.
19 Select “Bracing 02” from the list and click “Apply”.
The required Slab setting values are set for modeling the third
bracing.
20 Click “OK” on the Slab Default Setting dialog box to return
to the floor plan.
Now we have the two main frames ready (you can check them in the 21 Keep the Space button pressed to activate the Magic Wand
3D window), so we can start creating the bracings that support the and click once over the third bracing’s contour.
seating and connect the two frames. The main frames and the bracings are finished.
13 Activate (by double-clicking) the “3.4 Model the Bracings” 22 Activate (by double-clicking) the “3.3 Model the Seating”
pre-set view in the Navigator. pre-set view in the Navigator.
The floor plan shows the contour of the seating.

Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide 37


3. Rotating Auto-saved Objects. Adding Material Parameters to Library Parts.

23 Open the Slab Tool and click on the “Favorites” button. 3.3 CREATING THE GDL OBJECT
24 Select “Seating” from the list and click “Apply”. AC Guide GDL Ch
The required Slab setting values are set for modeling the seating. 03_03.mp4
Watch Movie
25 Click “OK” on the Slab Default Setting dialog box to return
to the floor plan. 1 Open up the “AC Guide GDL Chapter 03” folder in the
Navigator and activate (by double-clicking) the “3.6 Check
26 Keep the Space button pressed to activate the Magic Wand
2D” pre-set view in the “Chapter 3” folder.
and click once over the first seating’s contour.
The floor plan shows the complete model. If you’ve followed the
previous steps you should see this figure:

Now we have finished modeling.

Hint: The “Paimio” chair is available with hollowed and solid


seating options. In this lesson we modeled the former. If you
prefer the hollowed version you can model the seating with curved
walls and place empty openings in it. 2 Activate (by double-clicking) the “3.7 Check 3D” pre-set
view in the Navigator.

38 Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide


3. Rotating Auto-saved Objects. Adding Material Parameters to Library Parts.

4 Activate the “File > Libraries and Objects > Save 3D Model
as…” command
5 In the opening dialog select a folder where you want to save
the new object and enter “Armchair_Paimio.gsm” in the
“Save As:” field.
The 3D window opens and you can check the consistency of your 3D Hint: Make sure to save the object into a folder where you will be
model. Before we continue we have to understand the concept of able to find it later. We suggest you store it near the currently open
auto-saving GDL. The rule is very simple: the viewpoint of the 3D ArchiCAD file.
window will be defined as the top view of the automatically saved 6 The “Save as Library Part” dialog opens. Select the Object
Library Part. This concept allows users to easily rotate their custom type and turn on the “Remove redundant lines from symbol”
GDL objects in space without the need for GDL scripting. and the “Editable GDL script” options. Click “Save” to
3 Activate (by double-clicking) the “3.8 Open the Side View” create the object and to close this dialog.
pre-set view in the Navigator.
This view set was made to show the correct 3D window setting for
making a GDL chair object that is standing on the ground.
Hint: You can check the actual 3D window setting by activating
the “View > 3D View Mode > 3D Projection Settings”
command. As you can see in the opening dialog, the Side view is
active and the camera azimuth is set to 90°.

Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide 39


3. Rotating Auto-saved Objects. Adding Material Parameters to Library Parts.

Hint: The Editable GDL Script option allows us to make 9 Place the armchair object on the floor plan with a click of the
modifications in the object’s scripts (e.g., to add new material mouse where indicated by the label.
parameters).
7 Open up the “AC Guide GDL Chapter 03” folder in the
Navigator and activate (by double-clicking) the “3.9 Place
the Object” pre-set view in the “Chapter 3” folder.

The floor plan shows the original model and indicates the point
where you can place the object that has just been created.
8 Double click on the Object Tool and make sure that
“Armchair_Paimio.gsm” is the active object. Click OK to
return to the floor plan.
10 Activate (by double-clicking) the “3.10 Check 3D” pre-set
view in the “Chapter 3” folder.

Note that the object was rotated by 90° around the x-axis. The GDL
model is now complete although it has some limitations that we’ll fix
in the next section.

40 Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide


3. Rotating Auto-saved Objects. Adding Material Parameters to Library Parts.

3.4 EDITING THE GDL OBJECT 4 Click Cancel to return to the floor plan.
5 Keeping the object selected activate the “File > Libraries and
AC Guide GDL Ch Objects > Open Object” command.
03_04.mp4
Watch Movie
1 Open up the “AC Guide GDL Chapter 03” folder in the
Navigator and activate (by double-clicking) the “3.11 Edit
the Object” pre-set view in the “Chapter 3” folder.

2 Activate the Arrow tool and make an area


selection around the object.

The GDL Master Window opens. Each GDL Object has its own
Master Window in ArchiCAD. All controls needed to edit a GDL
Object are present in the Master Window. In this lesson we’ll only
Note that the object’s 2D symbol doesn’t contain a background fill, deal with the parameter list, the Preview Picture, the 2D Symbol and
thus it can’t be selected with the Quick selection mode (Magnet) over the 3D Script windows. Other elements of the Master Window will be
its area. You either have to make a selection rectangle around it or you discussed in more detail in the following ITG chapters. Let’s start
have to click on one of the bounding box corner points to select it. editing the object by enhancing the 2D symbol.
Furthermore, the floor plan symbol contains too many lines that were
derived from the object’s 3D top view.
3 Double click on the Object Tool or click once on
the Settings dialog icon in the Info box.
Note that the object doesn’t include a preview picture and is thus
difficult to find in the object browser. The parameter list is also empty
and as a result you can’t change the material of the seating from white
to black, even though the Paimio armchair is available in both colors.
Let’s fix these problems with some easy-to-learn techniques.

Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide 41


3. Rotating Auto-saved Objects. Adding Material Parameters to Library Parts.

6 Click on the “2D Symbol” button to open the 2D symbol 9 Select the new 2D symbol with the Arrow Tool on the top left
editing window. corner of the floor plan.

The 2D Symbol window is very similar to the floor plan window Note that this enhanced 2D symbol drawing contains fewer lines and
since you can use the standard ArchiCAD tools and editing a white background fill.
techniques here, with the exception of the 3D elements (e.g., Walls, 10 Activate the “Edit > Copy” command.
Columns). Consequently, you can modify the floor plan symbol of a
Library Part without knowing the GDL language. The current
symbol, which was made from the object’s top view, is not suitable for 11 Click on “Window > Armchair_Paimio” to return to the
us since it contains too many lines but no background fills or object’s Master window.
hotspots. Let’s delete all elements from the 2D symbol window.
7 Activate the “Edit > Select All” command and then hit the
delete button on your keyboard.

All elements are cleared from the window. Now you can start drawing
the required new symbol with the 2D ArchiCAD tools or you can
copy an existing drawing from the floor plan. We’ll do the latter.
8 Activate (by double-clicking) the “3.11 Edit the Object”
pre-set view in the Navigator to return to the floor plan. 12 Click on the 2D Symbol window to activate it and launch the
“Edit > Paste” command.
The content of the clipboard (the new symbol) is pasted into the
active view. If the current zoom of the 2D symbol window is not big
enough to include the pasted elements you’ll see a warning dialog. In
that case select the following options:
• “Paste to Original Location”
• “Zoom to Pasted Elements”

42 Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide


3. Rotating Auto-saved Objects. Adding Material Parameters to Library Parts.

13 Click outside the selection marquee around the pasted 15 Close the 2D Symbol window and click on the “Preview
elements to place them into the current view. Picture” button.

The Preview Picture window, which is currently empty, opens. There


are two ways to add a Preview Picture to a Library Part: you can copy
an existing image from an external source or you can create a new
image in ArchiCAD (e.g., in the rendering window) and paste it to the
Preview Picture window. We are going to copy a picture from an
external source.
14 Activate the Hotspot Tool and place hotspots on
Hint: The size of the preview window is 128x128 pixels. In order
the corner points of the arms and the seating.
to avoid distortion of the Preview Picture use rectangular images
for this purpose. If you want to make rendered images to be used
as Preview Pictures make sure that the 3D window is set to
rectangular shape and the size of the photorendering window is
exactly 128x128 pixels.
16 Activate (by double-clicking) the “3.11 Edit the Object”
pre-set view in the Navigator to return to the floor plan.

17 Activate the “File > Open…” command and select the


“AaltoArmchair41Two” file in the “Chapter 03” folder. Make
sure that the “All Files” types option is selected.

These additional hotspots will help you to easily align the armchair
with other elements on the floor plan.
Hint: You can also place one more hotspot in the middle of the
front of the seating. This point can be used to align the chair with a
table.

Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide 43


3. Rotating Auto-saved Objects. Adding Material Parameters to Library Parts.

The pasted image is added to the object preview picture window.


21 Close the Preview Picture window.
22 Save your changes with “File > Save”.

3.5 ADDING MATERIAL PARAMETERS


AC Guide GDL Ch
03_05.mp4
Watch Movie
Before we can make the frame and the seating materials parametric
we have to add two new parameters to the object’s parameter list.
1 Click on the “New” button to create a new
parameter.

2 Select the Variable field of the new parameter with the mouse
and rewrite the default variable name to “frame_material”.
18 Activate the “Edit > Copy” command.
This is the variable name that we are going to use in the GDL script.
Please note that the variable name will not be shown in the “Object
19 Click on “Window > Armchair_Paimio” to return to the setting” dialog.
object’s Master window.
3 Select the Type field and in the opening palette select the
20 Click on the “Preview Picture” window to activate it and Material parameter type.
launch the “Edit > Paste” command.

This option will allow you to select from the materials defined in the
currently open ArchiCAD file.

44 Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide


3. Rotating Auto-saved Objects. Adding Material Parameters to Library Parts.

4 Select the Name field and enter “Frame Material”.


This parameter description will be displayed in the Object Settings
dialog.
5 Click on the pop-up button near the Value field and select
“WD-Pine Horizontal” from the list. Alternatively, you can
enter 15 in the “Value” field.

This will be used as the default value of the new parameter.


6 Click on the “New” button to create an additional parameter.
7 Set the following parameter values:
• Variable: seating_material
• Type: Material
• Name: Seating Material
• Value: 18 (Paint-01)
These are the materials of the slabs that we used to model the chair
on the floor plan. All we have to do now is to substitute them with
Now we can open the 3D script, which describes the 3D model in the variable names of the newly created parameters:
GDL format. We have to modify the GDL code to use the newly • "Wd-Pine Horizontal" --> frame_material
created material parameters instead of the fixed material values stored • "Paint-01" --> seating_material
in the script. Please note that text type parameter values are stored between
8 Click on the “3D Script” button. quotation marks ("") in the GDL script. You don’t need them for
Don’t be frightened by the commands and numbers that you see in parameter variables.
the script. You don’t have to understand the meaning of this code at Manual substitution of all material names with parameters would be
this stage. Simply browse the text with the slider on the right side of time-consuming, so we we’ll use the “Find & Replace” command that
the 3D script window and note that the following material can do this job automatically.
descriptions appear in the script: 9 Activate the “Edit > Find & Replace…” command.
• “Wd-Pine Horizontal”
• “Paint-01”

Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide 45


3. Rotating Auto-saved Objects. Adding Material Parameters to Library Parts.

10 Enter "Wd-Pine Horizontal" in the upper field of the dialog 16 Open the 3D View again and check the result of the
and “frame_material” in the bottom one. parameter changes.

Hint: You can copy these texts straight from the 3D script and the
parameter’s “Variable name” field.
11 Click on “Replace All” button.
12 Activate again the “Edit > Find & Replace…” command.
13 Enter "Paint-01" in the upper field of the dialog and
“seating_material” in the bottom one. Click “Replace All”.

If the parameters have no affect on the 3D model or if you get an


error message when opening the 3D view you must have made a
Now the 3D script is using our custom parameters for material mistake during the last steps. In that case you have to check the 3D
definitions. Let’s test the result of our changes. script and the two parameters. The parameter variable names in the
3D script and on the parameter list have to be identical. You also have
14 Click on the “3D View” button to see the object in the 3D
to avoid ‘0’ parameter values.
window. You can orbit in this window if you activate the
“View > Orbit” command. 17 Close the 3D view and save the last changes with “File >
Save”.
15 Close the 3D window and change the Values of the two
material parameters. For instance you can set the “Paint-05” 18 Close the object Master Window.
material for the seating.

46 Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide


3. Rotating Auto-saved Objects. Adding Material Parameters to Library Parts.

19 Back on the floor plan, select the object with the arrow tool. Note that the object is displayed with its Preview Picture in the object
browser. The parameter list contains the new material parameters. If
you change them the selected object’s materials will be modified.
21 Click “OK” to return to the floor plan. If you prefer, you can
save this ArchiCAD project with “File > Save”. The
“Armchair_Paimio” object will be available for later use from
the folder where you saved it.
Hint: You can create nice images of your object with the built-in
Lightworks rendering engine. See the figure below. These images
can also be used as Preview Pictures for Library Parts.
Note that the area selection is now working for the element as the 2D
symbol contains background fill. Furthermore, there are fewer lines
in the 2D symbol and you can find hotspots on the corner points of
the seating and the frames.
20 Click on the Object Tool to open the Library Part’s
Settings dialog.

22 Close the project with “File > Close”.

Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide 47


4. Auto saving rectangular doors. Creating Custom Door Panels.

4. AUTO SAVING RECTANGULAR DOORS. CREATING


CUSTOM DOOR PANELS.
This chapter is dedicated to making custom rectangular doors in Before we start working let’s have a quick look at the door that we
ArchiCAD. We’ll introduce two ways you can create such objects intend to model.
without GDL scripting. The first method can be used if you have to 2 Open up the “AC Guide GDL Chapter 04” folder in the
model the entire door object from scratch. The second one allows Navigator and activate (by double-clicking) the “4.1
you to apply custom door panels to standard ArchiCAD library door Overview” pre-set view in the “Chapter 4” folder.
objects. This lesson covers the following topics:
• Rules for creating doors in ArchiCAD “Prairie School” was a late 19th and early 20th century architectural
• Modeling rectangular doors on the floor plan style, most common to the Midwestern United States. “Prairie” style
• Using custom door panels with standard ArchiCAD library doors door and window panels are still widely used in North America in
different variations. This version of Prairie panels is a relatively simple
one that divides the glazing into 9 parts with four grilles.
4.1 OVERVIEW
AC Guide GDL Ch
04_01.mp4
Watch Movie
1 Open the ‘AC Guide GDL Ch 04.pla’ ArchiCAD project file to
start the fourth lesson of this interactive, hands-on
ArchiCAD GDL training guide. Select the “Read elements
directly from archive” option.

Hint: If you prefer you can create more complex door leafs using
the techniques described below.

48 Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide


4. Auto saving rectangular doors. Creating Custom Door Panels.

4.2 MODELING elements in the x-y plane. See the illustrations at the bottom of this
project view.
AC Guide GDL Ch 2 Activate (by double-clicking) the “4.3 Model the Door
04_02.mp4 Frame” pre-set view in the Navigator.
Watch Movie We start modeling with the door frame. The active view set shows only
1 Open up the “AC Guide GDL Chapter 02” folder in the the contours of the frame to allow for easy use of the Magic Wand.
Navigator and activate (by double-clicking) the “4.2
Modeling Steps” pre-set view in the “Chapter 4” folder.

3 Open the Slab Tool and click on the “Favorites”


button
4 Select “Door Frame” from the list and click “Apply”.

We are going to model every door component on the floor plan using
only the Slab tool.
Once a door/window is inserted into a wall, the default position of
these Library Parts’ coordinate system is rotated so that the x-y plane
is vertical and the z-axis points horizontally into the wall. The origin
is placed on the bottom center of the wall opening, on the exterior
side of the wall. This way, doors/windows can be easily modeled with

Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide 49


4. Auto saving rectangular doors. Creating Custom Door Panels.

The required Slab parameters are set so that we can model the door
frame element.
5 Click “OK” on the “Slab Default Setting” dialog
box to return to the floor plan.
6 Move the cursor over the door frame’s polygon and hold
down the Space button on the keyboard to activate the Magic
Wand function. The cursor’s shape changes to a magic wand,
indicating that ArchiCAD will automatically trace the
contours of the clicked element.
7 Click with the mouse.

9 Open the Slab Tool and click on the “Favorites”


button.
10 Select “Door Panel” from the list and click “Apply”.

Let’s continue the modeling with the door leaf.


8 Activate (by double-clicking) the “4.4 Model the Door
Panel” pre-set view in the Navigator.
The floor plan shows the 2D outlines of the door leaf.

The required Slab parameter values are set so that you can create the
door leaf.
11 Click “OK” on the “Slab Default Setting” dialog
box to return to the floor plan.

50 Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide


4. Auto saving rectangular doors. Creating Custom Door Panels.

12 Activate the Magic Wand (press the Space button) and click The hole for the glazing is cut from the slab.
on the external contour of the door panel. 16 Open the Slab Tool again and click on the
“Favorites” button.
17 Select “Glazing” from the list and click “Apply”.

18 Click “OK” on the “Slab Default Setting” dialog box


13 Hold down the Shift key and select the slab with a click of the to return to the floor plan.
mouse.
14 Make sure that the Slab Tool is still active.
15 Activate the Magic Wand and click on the glazing’s contour.
Deselect the slab.

Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide 51


4. Auto saving rectangular doors. Creating Custom Door Panels.

19 Activate (by double-clicking) the “4.5 Model the Window The required Slab setting values are applied, so now we can start
Grilles” pre-set view in the Navigator. modeling the window grilles.
22 Click “OK” on the “Slab Default Setting” dialog box to
return to the floor plan.
23 Click with the Magic Wand on the exterior contour, then
select the slab and click again with the Magic Wand on the
interior contour to create the hole in the slab.

The floor plan shows the contours of the Prairie style window grilles.
20 Open the Slab Tool and click on the “Favorites”
button.
21 Select “Window Grille” from the list and click “Apply”.
We are now finished with the door modeling, so let’s save the GDL
door object.

52 Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide


4. Auto saving rectangular doors. Creating Custom Door Panels.

4.3 CREATING THE GDL OBJECT


AC Guide GDL Ch
04_03.mp4
Watch Movie
1 Open up the “AC Guide GDL Chapter 04” folder in the
Navigator and activate (by double-clicking) the “4.6 Select
the model” pre-set view in the “Chapter 4” folder.

3 Activate (by double-clicking) the “4.7 Save the Door” pre-set


view in the Navigator.
The 3D window opens and you can revise the 3D model before you
save it as a GDL object.

The floor plan shows the complete model. If you’ve followed the This view set shows the model from a generic axonometric view.
previous steps precisely you should see the figure as above. Unlike in the case of a generic auto-saved GDL object, the 3D
2 Activate the Arrow Tool and select all the door model viewpoint doesn’t have any affect on the resulting GDL door object.
elements with a rectangular selection. Once a door/window is inserted into a wall, the default position of
these Library Parts’ coordinate system is rotated so that the x-y plane
is vertical and the z-axis points horizontally into the wall.

Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide 53


4. Auto saving rectangular doors. Creating Custom Door Panels.

4 Activate the “File > Libraries and Objects > Save 3D Model 7 Open up the “AC Guide GDL Chapter 04” folder in the
as…” command. Navigator and activate (by double-clicking) the “4.8 Place
5 In the opening dialog select a folder in which you want to the Door” pre-set view in the “Chapter 4” folder.
save the new object and enter “Door_Prairie_Style.gsm” in
the “Save As:” field. The floor plan shows a solid wall and indicates the point where you
can place the recently made custom door.

Hint: Make sure to save the object into a folder where you will be
able to find it later. We suggest you store it near the currently open
ArchiCAD file.
6 The “Save as Library Part” dialog opens. Select the Door
type and turn on the “Remove redundant lines from symbol”
and the “Editable GDL script” options. Click “Save” to
create the object and to close this dialog.
8 Double click on the Door Tool and make sure that
“Door_Prairie_Style” is the active object. Enter 150 for
“Reveal/Depth”.
9 Enter 150 for “Reveal/Depth”. Click “OK” to return to the
floor plan.

Hint: The Editable GDL Script option allows us to make


modifications in the object’s scripts at any time.

54 Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide


4. Auto saving rectangular doors. Creating Custom Door Panels.

The rectangular hole was automatically created in the wall. The 3D


model is now finished, but the 2D symbol is far from complete. It
contains too many lines and the opening line is not shown. Let’s fix
these problems.

4.4 EDITING THE GDL OBJECT


AC Guide GDL Ch
04_04.mp4
Watch Movie

10 Place the Door object on the floor plan with two mouse
clicks where indicated by the label.
The first click defines the location of the door in the wall and the
second one determines the opening direction of the leaf.

11 Activate (by double-clicking) the “4.9 Check 3D” pre-set


view in the “Chapter 4” folder. 1 Activate the Arrow tool and select the door.
2 Keeping the object selected, activate the “File > Libraries
and Objects > Open Object” command.

The GDL Master Window opens.


3 Click on the 2D Symbol button to open the 2D symbol
editing window.

Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide 55


4. Auto saving rectangular doors. Creating Custom Door Panels.

All unnecessary lines are cleared from the door.


5 Complete the 2D symbol using the “Line” and the “Circle”
Tools as shown below.

The current symbol, which was derived from the 3D model, is not
suitable for us since it contains too many line segments but no
opening line.
4 Activate the Arrow Tool and select all lines between the door
frames as shown on this picture. 6 Close the 2D Symbol window.
7 Save your changes with “File > Save”.
8 Close the GDL Master Window.
9 Back on the floor plan, check the result of your last changes.

56 Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide


4. Auto saving rectangular doors. Creating Custom Door Panels.

Our custom door is now complete, although - compared to the ArchiCAD “Library/Custom Object Macros” folder and they are
standard door objects of the ArchiCAD library - its capabilities are loaded by default from the ArchiCAD startup file.
limited. Let’s just list a few of these missing features: • Elements of the custom object macro folder can’t be loaded in
• The size and material of door components (e.g., frame) are not archive format (i.e., no pla or lcf library file format allowed).
parametric. Our currently open ArchiCAD file is an archive project (pla file) that
• No optional door accessories (e.g., trim, sill, header, shutter, refers to the archived library included within itself. Before we can
handle) are available. start using custom components we have to load the custom object
• The floor plan symbol is not scale sensitive. macros in uncompressed format.
• The door leaf can’t be opened with editable hotspots in 2D and 1 Activate the “File > Libraries and Objects > Library
3D views. Manager...” command
In the next part of this Interactive Training Guide Chapter we’ll 2 Click on the “Local LAN” tab page and on the left side of the
explain how you can create and use custom door panels with standard dialog locate the “Object Macros” folder in the “Chapter 04”
ArchiCAD door library objects. folder of this Interactive Training Guide. Alternatively, you
can find these macros in the standard ArchiCAD library
folder.
4.5 CREATING CUSTOM DOOR PANELS
AC Guide GDL Ch
04_05.mp4
Watch Movie
The ArchiCAD feature that we are going to use to make the door
panel is called “Custom Component Saving”. Before we start this
lesson let’s summarize the basic facts that you ought to know about
this technology:
• Custom Components were introduced in the ArchiCAD 10
version, consequently this feature is not available in previous
ArchiCAD releases.
• Custom Components can be used with only those Library Parts
that were developed to support this feature.
• All rectangular doors from the standard ArchiCAD 10 library
version support custom door panels.
• The “Custom Component” add-on has to be loaded with
ArchiCAD (loaded by default in standard AC) before you start to
use this function.
• The custom object macros have to be loaded from the Library
Manager. These required Library Parts can be found in the

Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide 57


4. Auto saving rectangular doors. Creating Custom Door Panels.

3 Select the folder and click on the “Add” button. Click


“Done” to load the required library.

In order to shorten this lesson the floor plan already contains the
model of the Prairie style door panel. Note that at this time the door
frame is excluded from the model. We used only the Slab Tool to
prepare the door leaf as described previously in this Training Guide
4 Open up the “AC Guide GDL Chapter 04” folder in the
Chapter.
Navigator and activate (by double-clicking) the “4.10 Save a
Custom Door Panel” pre-set view in the “Chapter 4” folder.

58 Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide


4. Auto saving rectangular doors. Creating Custom Door Panels.

Please also note that the bottom of the door panel 7 Select the “Custom Door Panel” Type from the opening
model has to be on the zero level for correct dialog.
placement.
Hint: Custom door panels will be stretched or shrunk
automatically to fit into the nominal opening of the door. If you
want to avoid distorting the door panel, the size of the model has
to exactly match the size of the opening.
5 Activate the Arrow Tool and select the door leaf model with
the area selection on the floor plan.
Hint: Custom Components also allow you to create and use
custom window panels and kitchen cabinet doors (“Custom
Object Component”) with the corresponding ArchiCAD Library
Parts.
8 Save the custom object as “Prairie Style Panel.gsm”.

Hint: Make sure to save the custom component Library Part into
6 Activate the “File > Libraries and Objects > Save Custom a folder where you will be able to find it later. We suggest you store
Component” command. it near the currently open ArchiCAD file.
After you’ve saved the file, a new dialog appears and informs you
about how you can use your custom panel.

9 Click “OK” to return to the floor plan.


Before we can apply the new custom panel to a door we have to
reload it with the Library Manager.

Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide 59


4. Auto saving rectangular doors. Creating Custom Door Panels.

10 Activate the “File > Libraries and Objects > Library 15 Open the “Internal Door Settings” tab page and select the
Manager...” command. “Door Panel” from the pop-up menu.
11 Click on the “Reload” button.
12 Open up the “AC Guide GDL Chapter 04” folder in the
Navigator and activate (by double-clicking) the “4.11 Use a
Custom Door Panel” pre-set view in the “Chapter 4” folder.

16 Browse through the available panel styles and select


“Custom Panel” at the end of the list.
The floor plan shows a standard single door from the ArchiCAD
library. Currently a simple flush door panel is selected for it.
13 Activate the Arrow Tool and select the door.

14 Open the Door Tool to see the object’s parameters.

60 Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide


4. Auto saving rectangular doors. Creating Custom Door Panels.

17 Locate the “Custom Panel Name” parameter on the active 20 Activate the Arrow Tool and select the door.
tab page and select “Prairie Style Panel”.

18 Click “OK” to return to the floor plan.


19 Open up the “AC Guide GDL Chapter 04” folder in the
Navigator and activate (by double-clicking) the “4.121 Check
3D” pre-set view in the “Chapter 4” folder.

21 Click on the magenta hotspot located at the door handle.


22 Select the first item in the Pet Palette (“Move Node”) and
open the door by moving the mouse.
Now let’s change the door opening angle on the floor plan as well.
23 Close the 3D window to return to the floor plan.
24 Activate the Arrow Tool and select the door.
25 Click on the magenta hotspot located at the corner of the
door leaf.
26 Select the last item in the Pet Palette (“Stretch”) and modify
The custom panel fits perfectly into the door opening. Furthermore, the door opening angle by moving the mouse.
all the parametric features of ArchiCAD doors are at your disposal,
such as the optional trim, sill and handle elements. Finally, you can
open the door leaf with editable hotspots as described in the next
steps.

Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide 61


4. Auto saving rectangular doors. Creating Custom Door Panels.

We have reached the end of the fourth lesson. In this training guide
chapter we have learned how to create custom rectangular doors. The
next lesson will demonstrate how you can make custom shape
openings (doors or windows) without GDL scripting.
27 Close the project with “File > Close”.

62 Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide


5. Auto Saving Non-rectangular Windows.

5. AUTO SAVING NON-RECTANGULAR WINDOWS.


This chapter is dedicated to making custom non-rectangular windows 2 Open up the “AC Guide GDL Chapter 05” folder in the
in ArchiCAD. We’ll introduce how you can model such objects Navigator and activate (by double-clicking) the “5.1
without GDL scripting and how you can enhance them with some Overview” pre-set view in the “Chapter 5” folder.
simple techniques. This lesson covers the following new topics:
• Rules for creating windows in ArchiCAD
• Modeling non-rectangular windows on the floor plan
• Creating Preview Pictures with the Lightworks rendering engine

5.1 OVERVIEW
AC Guide GDL Ch
05_01.mp4
Watch Movie
1 Open the “AC Guide GDL Ch 05.pla” ArchiCAD project file
to start the fifth lesson of this interactive, hands-on
ArchiCAD GDL training guide. Select the “Read elements
directly from archive” option.

The circular window shown on the floor plan is a typical example of


Decorated Style gothic rose windows. The window is unglazed and
divided by profiled stone traceries.
Hint: If you want to check the complete window object, open the
Window Tool and locate the “Gothic_Rose_Window_Final”
Library Part in the Library Part browser. The window is located in
the “Finished Objects” folder.

Before we start working, let’s have a quick look at the gothic rose
window that is the subject of this lesson.

Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide 63


5. Auto Saving Non-rectangular Windows.

5.2 MODELING We start the modeling with the stone mullions or traceries. The active
view set shows only the contours of the mullions to help you use the
AC Guide GDL Ch Magic Wand.
05_02.mp4
Watch Movie
1 Open up the “AC Guide GDL Chapter 05” folder in the
Navigator and activate (by double-clicking) the “5.2
Modeling Steps” pre-set view in the “Chapter 5” folder.

3 Open the Slab Tool and click on the “Favorites”


button.
4 Select “Window Mullion” from the list and click “Apply”.

We are going to model the rose window on the floor plan in three
steps. In the first two steps we’ll create the stone traceries using the
Slab Tool. These steps are very similar to those in Chapter Four, in
which we made a rectangular door. However, during the last step
you’ll learn a new trick with which you can define custom shape
openings for your auto-saved doors and windows.
Hint: The rules for modeling doors and windows on the floor
plan were discussed in the previous lesson. Please refer to the
corresponding parts of Chapter 4 for more details.
2 Activate (by double-clicking) the “5.3 Model the Mullions” The required Slab parameters are set so that we can start modeling
pre-set view in the Navigator. the mullions.

64 Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide


5. Auto Saving Non-rectangular Windows.

5 Click “OK” on the Slab Default Setting dialog box 10 Activate (by double-clicking) the “5.4 Add the Mullion
to return to the floor plan. Profile” pre-set view in the Navigator.
6 Move the cursor over the exterior circle and hold down the The floor plan shows the 2D outlines of the mullion profiles.
Space button on the keyboard to activate the Magic Wand
function. The cursor’s shape changes to a magic wand,
indicating that ArchiCAD will automatically trace the
contours of the clicked element.
7 Click with the mouse.

11 Open the Slab Tool and click on the “Favorites”


8 Select the slab and activate the Slab Tool again. button.
9 Hold down the Shift key and click on the contours of the 12 Select the “Mullion Profile” option from the list and click
internal polygons with the Magic Wand. “Apply”.

The required holes are added to the slab. Now let’s model the profile The required Slab parameter values are set, so now you can add the
of the mullions with the Slab Tool. profile to the traceries.

Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide 65


5. Auto Saving Non-rectangular Windows.

13 Click “OK” on the Slab Default Setting dialog box


to return to the floor plan.
14 Activate the Magic Wand (by pressing the Space button) and
click on the external circle.

The holes are cut from the slab. So far, the modeling steps were the
same as in Chapter 4, in which we made a rectangular door. However,
if you saved this model now as a GDL window object, you would get
the following result:

Hint: You can regulate the segmentation of curved elements made


with the Magic Wand in the “Magic Wand” settings. You have to
set the required values prior to creating the model elements with
the magic wand.

15 Hold down the Shift key and select the slab with a click of the
mouse.
As a rule, ArchiCAD always cuts a rectangular opening for auto-saved
16 Make sure that the Slab Tool is still active. doors and windows, unless you define a custom opening contour with
17 Activate the Magic Wand (with the Space key) and click on a special model element (see the description in the next step). If you
the contours of the internal polygons. have a closer look at the picture you can also see that the size of the
opening is equal to the bounding box size of the model. In the next

66 Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide


5. Auto Saving Non-rectangular Windows.

step – which is very important - we’ll show you how you can define 20 Select “Wall Opening” from the list and click “Apply”.
non-rectangular openings for your auto-saved doors and windows.
Hint: You may wonder why ArchiCAD can’t trace the contours of
your window models and create the wall opening automatically.
There are two reasons for this:
• Sometimes the wall opening size has to be different from the size
of the window contours (e.g., when an oversize window is
required).
• You may also want to create custom-shape empty wall openings
without any window or door elements.
The technique that we’ll explain in the next step can be used to
remedy both cases.
18 Activate (by double-clicking) the “5.5 Define the Wall
Opening” pre-set view in the Navigator. The slab that we are going to place on the floor plan is used only to
define the contours of the opening. Therefore, its elevation, material
or thickness is not relevant. Furthermore, any other 3D ArchiCAD
polygon tool (e.g., roof, mesh) can be used for this purpose. In this
example we’ll make a thin, black slab underneath the window model.
In order to tell the program to use the slab for only a wall opening
definition, you have to enter a “magic” word in the ID field of the
Slab settings dialog. The word that you have to type is:
WALLHOLE.
Hint: WALLHOLE is the name of a GDL command with which
you can cut custom openings in a wall. We’ll use this command in
Chapter 9 to create a non-rectangular door with GDL scripting.
WALLNICHE is another useful keyword that you can enter in the
ID field of a 3D polygon type element. This special code allows
you to define a custom shape niche in a wall.
21 Open the “Listing and Labeling” tab page and enter
“WALLHOLE” in the ID parameter field.

The floor plan shows the contour of the rectangular opening.


19 Open the Slab Tool again and click on the
“Favorites” button.
22 Click “OK” on the Slab Default Setting dialog box to
return to the floor plan.

Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide 67


5. Auto Saving Non-rectangular Windows.

23 Activate the Magic Wand (hold down the Space key) and
click on the circle.

The floor plan shows the complete model. If you’ve followed the
Now we are finished with the modeling part so, let’s save the GDL previous steps precisely, you should see the same figure as above.
window object. 2 Activate the Arrow Tool and select all the rose window model
elements with a rectangular selection.
5.3 CREATING THE GDL OBJECT
AC Guide GDL Ch
05_03.mp4
Watch Movie
1 Open up the “AC Guide GDL Chapter 05” folder in the
Navigator and activate (by double-clicking) the “5.6 Select
the Model” pre-set view in the “Chapter 5” folder.

68 Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide


5. Auto Saving Non-rectangular Windows.

3 Activate (by double-clicking) the “5.7 Save the Rose 5 In the opening dialog select a folder in which you want to
Window” pre-set view in the Navigator. save the new object and enter “Gothic_Rose_Window.gsm”
in the “Save As:” field.
The 3D window opens and you can revise the 3D model before you
save it as a GDL object.
Hint: Make sure to save the object into a folder where you will be
able to find it later. We suggest you store it near the currently open
ArchiCAD file.
6 The “Save as Library Part” dialog opens. Select the Window
type and turn on the “Remove redundant lines from symbol”
and the “Editable GDL script” options. Click “Save” to
create the object and to close this dialog.

This view set shows the model from a generic axonometric view.
Unlike the case of general auto saved GDL objects, the 3D viewpoint
doesn’t have any affect on the resulting GDL window. Once a
window is inserted into a wall, the default position of the Library Hint: The “Editable GDL Script” option allows us to make
Parts’ coordinate system is rotated so that the x-y plane is vertical and modifications (e.g., add material parameters) in the object’s scripts
the z-axis points horizontally into the wall. Note that the black slab at any time.
marked with the WALLHOLE ID will not be included in the 7 Open up the “AC Guide GDL Chapter 05” folder in the
resulting GDL object. However, it will be implemented as a circular Navigator and activate (by double-clicking) the “5.8 Place
hole in the wall. the Window” pre-set view in the “Chapter 5” folder.
4 Activate the “File > Libraries and Objects > Save 3D Model
as…” command. The floor plan shows a solid wall and indicates the point where you
should place the rose window object.

Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide 69


5. Auto Saving Non-rectangular Windows.

9 Place the window in the wall with two clicks of the mouse
where indicated by the label.
The first click defines the location of the window in the wall, while
the second click determines the exterior side of it. The second click
should be made at the bottom side of the wall.

8 Double click on the Window Tool and make sure that


“Gothic_Rosw_Window.gsm” is the active object. Click OK
to return to the floor plan.

10 Activate (by double-clicking) the “5.9 Check 3D” pre-set


view in the “Chapter 5” folder.

70 Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide


5. Auto Saving Non-rectangular Windows.

Note that the circular hole is automatically created in the wall and the
black slab is excluded from the model. The 3D model is now finished,
although the 2D symbol is far from complete. It contains too many
lines that look bad on printouts. Let’s fix this problem first.
3 Keeping the window selected, activate the “File > Libraries
and Objects > Open Object” command.
5.4 ENHANCING THE 2D SYMBOL
AC Guide GDL Ch The GDL Master Window opens.
05_04.mp4
Watch Movie
1 Open up the “AC Guide GDL Chapter 05” folder in the
Navigator and activate (by double-clicking) the “5.10 Edit
the Window Object” pre-set view in the “Chapter 5” folder.

4 Click on the “2D Symbol” button to open the 2D symbol


editing window.

2 Activate the Arrow tool and select the window.

Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide 71


5. Auto Saving Non-rectangular Windows.

The current symbol, which was derived from the 3D model, is not 10 Return to the GDL Master Window with “Window >
suitable for us as it contains too many line segments. Gothic_Rose_Window”.
5 Activate the Arrow Tool and select all lines with the area
selection.

11 Activate the 2D Symbol window and the paste the content of


the clipboard with “Edit > Paste”.
6 Delete the selected elements by hitting the “Delete” key.

The content of the clipboard (the new symbol) is pasted into the
active view. If the current zoom of the 2D symbol window is not big
enough to include the pasted elements you’ll see a warning dialog. In
The 2D symbol window is cleared. that case select the following options:
7 Click on the floor plan area to return to the floor plan. • “Paste to Original Location”
8 Select the previously drawn enhanced 2D window symbol at • “Zoom to Pasted Elements”
the bottom of the floor plan with the Arrow Tool. 12 Click outside the selection marquee (which is around the
pasted elements) to place them into the current view.
13 Save your changes with “File > Save”.
Now let’s continue enhancing our rose window object by making the
9 Put the selected elements on the clipboard with “Edit > mullion material parametric.
Copy”.

72 Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide


5. Auto Saving Non-rectangular Windows.

5.5 ADDING MATERIAL PARAMETERS We’ll use the “gs_frame_material” variable for the mullion material. If
you wish, you can change the parameter name from “Frame Material”
AC Guide GDL Ch to “Mullion or Tracery Material”. Let’s open the 3D script, which
05_05.mp4 describes the 3D model in GDL format. We have to modify the GDL
Watch Movie code in order to use the chosen material parameter instead of the
fixed material values stored in the script.
Please take a look at the parameter list in the GDL Master Window and
note that it contains many parameters that are not in use. These are 2 Click on the 3D Script button.
standard window parameters that are used in all ArchiCAD library The 3D script window allows you to explore the GDL description of
window objects. At this stage we want to use only the Frame Material the slabs that we used to model the window on the floor plan. All we
parameter for the traceries, so let’s hide the list’s unnecessary parameters. have to do now is to substitute the material names with the variable
1 Hide each parameter on the list with the Hide Parameter name of the material parameter:
icon, except for “A”, “B”, “gs_window_material” and • "Stn-Marble White" --> gs_frame_material
“gs_frame_mat”.

Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide 73


5. Auto Saving Non-rectangular Windows.

Hint: Please note that text type parameter values are stored 7 Close the 3D window and and set “Stn-Marble Pink” or
between quotation marks ("") in the GDL script. You don’t need number “6” for the Frame Material parameter.
them for parameter variables.
Manual substitution of all material names with parameters would be
time-consuming, so we we’ll use the “Find & Replace” command to 8 Open the 3D View again and check the result of the
do this job automatically. parameter changes.
3 Activate the “Edit > Find & Replace…” command.

4 Enter "Stn-Marble White" in the upper field of the dialog


and “gs_frame_material” in the bottom field.
Hint: You can copy these texts straight from the 3D script and the
parameter’s Variable name field.
5 Click on the “Replace All” button.
Now the 3D script is referring to the frame parameter for material
definitions. Let’s test the results of our changes.
6 Click on the 3D View button to see the object in the 3D
window. You can orbit in this window if you activate the
“View > Orbit” command.

Hint: If the material parameter has no affect on the 3D model or


if you get an error message when opening the 3D view, you must
have made a mistake during the last steps. In that case you have to
double check the 3D script and the parameter. The parameter
variable name in the 3D script and on the parameter list must be
identical. You also must avoid ‘0’ parameter values.
9 Save your changes with “File > Save”.

The rose window is displayed with wood material, which is the


current value of the Frame Material parameter.

74 Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide


5. Auto Saving Non-rectangular Windows.

5.6 MAKE A PREVIEW PICTURE WITH


LIGHTWORKS
AC Guide GDL Ch
05_06.mp4
Watch Movie
1 Click on the “Preview Picture” button.

The Preview Picture window opens. It is currently empty. This may


prevent other users from finding this window in the Library Part
browser. In the previous lessons we have shown how you can copy an
existing image into the Preview Picture window. Now let’s make a
nice preview image with the Lightworks rendering engine.
Note that the floor plan already contains two special light objects
There are a few things that you have to consider before you start (SkyObject, SunObject) that are essential when making high quality
making Preview Pictures: images with the LightWorks rendering engine.
• The size of the Library Parts’ Preview window is always 128x128 3 Select the rose window in the wall and open its “Window
pixels. Settings” dialog.
• If you want to use rendered images as Preview Pictures, make sure 4 Set the frame material parameter to “Stn-Marble White”.
that the 3D window is rectangular
5 Click “OK” to return to the floor plan and deselect the
• In order to avoid any loss in Preview Picture quailty, set the window.
photorendering window size to 128x128 pixels.
6 Open the 3D Window (“View > Elements in 3D View >
2 Activate (by double-clicking) the “5.11 Make a Preview Show All in 3D”).
Picture” pre-set view in the Navigator to return to the floor
plan. Do not close the GDL Master
Window at this time.

Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide 75


5. Auto Saving Non-rectangular Windows.

7 Activate the “View > 3D View Mode > 3D Window Settings”


command.
8 Turn off the “Keep Proportions” option and set the window Let’s adjust the photo rendering parameters to get a nice rendered
size to 600x600 pixels. image.
11 Activate the “Document > Creative Imaging >
Photorendering Settings” command.
12 Modify the rendering parameters as shown on the picture.

9 Click “OK” to make the 3D window rectangular.


10 Using the “Orbit” or the “Explore” functions, set your
preferred camera position for the Preview Picture.

76 Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide


5. Auto Saving Non-rectangular Windows.

• Shadow Resolution --> By lamp settings


• Background --> Sky and Ground color is black
Hint: You may play with these parameters and find the settings
you think are best.
13 Close the “PhotoRendering Settings” dialog with “OK”.
14 Start the photo rendering process with “Document >
Creative Imaging > Photorendering Projection”.

If you are satisfied with the resulting image, then copy it to the
Library Part’s Preview Picture window.
15 Select the picture with “Edit > Select all”.

16 Copy the content of the marquee onto the clipboard with


“Edit > Copy”.
17 Return to the GDL Master window with “Window >
Gothic_Rose_Window”.
• Engine --> LightWorks Rendering Engine 18 Click on the “Preview Picture” button.
• Method --> Best 19 Paste the content of the clipboard into the Preview Picture
• Effects --> All turned on window with “Edit > Paste”.
• Shadow casting --> By lamp settings
• Light sources --> Only Lamps is active

Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide 77


5. Auto Saving Non-rectangular Windows.

23 Open the “Window Settings” dialog.


Note that the object is now displayed with its Preview Picture in the
Library Part browser. The parameter list contains only the frame
material parameter. If you change the parameter the selected
window’s mullion material will be updated.

24 Click “OK” to return to the floor plan. If you prefer, you can
20 Close the Preview Picture window and save the changes with save this ArchiCAD project with “File > Save”. The
“File > Save”. “Gothic_Rose_Window” object will be available for later use
21 Close the GDL Master Window to return to the floor plan. in the folder where you saved it.
22 Back on the floor plan, select the rose window that is placed 25 Close the project with “File > Close”.
in the wall.

78 Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide


6. Basics of GDL Scripting

6. BASICS OF GDL SCRIPTING


In this chapter you will start using GDL commands. The object that
we’ll use as an example is a simple circular tabletop with a round leg.
6.1 OVERVIEW
You will work in the Library Part Editor Window and learn about the AC Guide GDL Ch
various elements of this environment: 06_01.mp4
• The Object Hierarchy (Subtypes) Watch Movie
• ZZYZX Parameter 1 To start the sixth lesson of this interactive, hands-on
ArchiCAD GDL training guide, open “AC Guide GDL Ch
• The Global Coordinate System and the Local Coordinate System
06.pla”. Select the “Read elements directly from archive”
• 3D Script and 3D View, plus 2D Script and 2D Full View windows option.
• Parameter Script Window
• 3D hotspots of Objects
This lesson demonstrates the following basic object-making
techniques:
• Using basic 3D shape generating commands
• Using parameters in GDL commands to make objects parametric
• Manipulating the Local Coordinate System (moving, mirroring),
undoing coordinate transformations
• Using commands to set materials
• Checking the created model in 3D for correctness

Let’s have a look at the object that we are going to model.


2 Open up the “AC Guide GDL Chapter 06” folder in the View
Map of the Navigator palette and activate (by
double-clicking) the “6.1 Overview” saved view in the
“Chapter 6” folder.
The pedestal table shown on the picture was designed by the famous
Swedish furniture designer Ben af Schulten. It is made of natural
lacquered birch. The pedestal on which it stands may be chrome,
white or black lacquered. The leg is made of birch. Its top material
may be birch veneer, linoleum or laminate. For more information
please visit the manufacturer’s website: www.artek.fi

Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide 79


6. Basics of GDL Scripting

As you can see, the object has six default parameters. These
parameters come from the GDL Subtype upon which the object is
based.
Every GDL Object has a Subtype upon which it is based. Subtypes
are different kinds of GDL Objects with different kinds of basic
behavior and different sets of parameters. They can be considered to
be like templates. When creating a GDL Object, the Subtype which it
is based upon is important.
4 Click the “Select Subtype…” button in the Library Part
Editor Window to bring up the “Subtype Hierarchy” dialog.

Hint: If you want to check the complete GDL object that we are
going to make, open the Object Tool and locate the
“Pedestal_Table_P90_Final” Library Part in the object browser.
The object is located in the “Finished Objects” folder.
3 Choose the “File > Libraries and Objects > New Object…”
menu command.

80 Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide


6. Basics of GDL Scripting

Subtypes are arranged in a hierarchy. Subtypes at any given level of


the hierarchy are based on the Subtype immediately above them in
the hierarchy and its inherit behavior and parameter set. Further, they
can have their own special behavior and parameters.
5 In the hierarchy select “General GDL Object > Model
Element > Opening > Roof Opening > Skylight”, and click
the “Select” button.

At this point there are many more parameters available. Among other
things these control how the object behaves and how it is represented
in 2D. Also, a Roof Opening-type of Object, when placed onto a
Roof, will always cut a hole for itself into the Roof. This behavior is
specific to the Roof Opening Subtype. A regular Model object would
not behave this way. This is why it is important to select the proper
Subtype for your Object.
At the top of the Editor Window, above the “New” button, the name
of the Subtype is displayed for quick reference.
6 Click the “Select Subtype…” button again. In the hierarchy
select the “General GDL Object > Model Element” Subtype,
and click the “Select” button to return to the Editor Window.
Because we are now creating a general 3D element, this is the best
Subtype for the task.
The default parameter list of the Object has changed.

Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide 81


6. Basics of GDL Scripting

6.2 CREATING PARAMETERS • ZZYZX: the Height of the Table


Hint: It is good practice to create descriptive variable names so
AC Guide GDL Ch that later you can easily identify what they control or specify.
06_02.mp4 Please note that ArchiCAD reserves certain variable names. These
Watch Movie names are called keywords and they included names of GDL
We will now create the necessary parameters that we are going to use functions, operators, etc. You can find a list of these on Page 265
in our Object. of the AC GDL Reference Guide.
1 Go back to the Floor Plan of ArchiCAD, and activate (by 2 Let us start creating these parameters. Select the “Window >
double-clicking) the “6.2 Creating Parameters” saved view in Untitled-1” menu item. “Untitled-1” is currently the name of
the “Chapter 6” folder of the Navigator. the GDL Library Part we started creating.

3 Using the same procedure you learned in previous chapters


of this tutorial, create the following variables and set them to
the values contained in the table below.
Variable Type Name Value
Radius_Top Length Radius of 375
tabletop
Thickness_Top Length Thickness of 40
The Floor Plan Window shows which dimensions and attributes of tabletop
the Object we want to make parametric. These include: Radius_Leg Length Radius of table 30
• Radius_Top: The radius of the circular tabletop leg
• Thickness_Top: The thickness of the circular tabletop Material_Top Material Material of 15 (Wd-Pine
tabletop Horizontal)
• Radius_Leg: The radius of the circular leg of the table
Material_Leg Material Material of leg 15 (Wd-Pine
• Material_Top: The material assigned to the table top Horizontal)
• Material_Leg: The material assigned to the leg of the table Material_Bottom Material Material of 13
• Material_Bottom: The material assigned to the pedestal on bottom element (Mtl-Chrome)
which the table stands (also the material of the conical shape
below the table top)

82 Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide


6. Basics of GDL Scripting

Hint: As you created these variables you may have noticed that We did not create the variable ZZYZX in the previous step, because
they are displayed in the color black in the list. The rule is that this is a default variable already available. The ZZYZX variable always
default parameters are displayed in blue, and user-created defines the full height of the Object. Using the ZZYZX default
parameters are displayed in black. variable enables you to later vertically stretch your created Object by
4 Modify the default Name and Value fields of the ZZYZX displaying 3D hotspots with which you can grab and stretch the
default parameter. For “Name” enter “Height of table”, and Object.
for “Value” enter “710”. Also, the ZZYZX default variable can be set directly in the Settings
Dialog of the Object or in the Info Box.
You could create and use another parameter to control the height of
the Object, but it would not make the Object vertically stretchable
and you would have to go to the Settings Dialog to modify it.

Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide 83


6. Basics of GDL Scripting

6.3 CREATING THE 3D GEOMETRY You can see a “G,L” string next to the origin of the coordinate
system. G stands for Global Coordinate System, while L stands for
AC Guide GDL Ch Local Coordinate System.
06_03.mp4 As default, these two coordinate systems are located at the same
Watch Movie point.
1 Click the “3D View” button to display the 3D View of the There are coordinate transformation commands in GDL that let you
Editor. move the Local Coordinate System away from the Global Coordinate
System, or rotate it around an axis, etc. This is important because
when GDL elements are created, they are always defined relative to
the Local Coordinate System. So the usual way of creating elements is
to move your Local Coordinate System to the desired location with
coordinate transformations, and to then create your element. Then
you can once again move your Local Coordinate System to another
desired location, create another element, and so on.
There are also commands to undo coordinate transformations,
enabling you to get back to previous locations of the Local
Coordinate System or all the way back to the Global Coordinate
System origin.
2 In the Editor Window, click the button to the right of the “3D
Script” button to open the 3D Script in a separate window.

The 3D View currently does not display 3D elements. There will also
be a message saying that there are no 3D elements. You can simply
click “OK” on that message to proceed.
In the 3D Window you will see a rectangular coordinate system with
x-y-z directions. This is a fundamental concept of GDL scripting.
The displayed unit vectors of the x, y and z-coordinates change
according to the size of elements within the 3D model. The unit
vectors are all 0.1 meters, 1 meters, 10 meters or 1/10th or 10 times
those, etc., depending on the size of the modeled elements. They
always point in the positive direction.
You can see the letters “x”, “y” and “z” at the end of each axis vector.
This lets you easily recognize the exact orientation of the axes.
The two buttons produce different behaviors. If you click the “3D
Script” button, the 3D Script will be displayed in the Editor Window

84 Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide


6. Basics of GDL Scripting

in place of the parameter list. If you click the button to its right, it will
open in a separate window.

3 Click the “Help > ArchiCAD GDL Reference Guide” menu


item.
5 In the PDF file select the line containing the syntax of the
command and copy (CTRL+C) it to the Clipboard.

The “AC GDL Reference Guide PDF” file is opened in Acrobat


Reader. When we start using a new command, we will find its exact
syntax in the GDL Reference Guide and copy-paste it from there. 6 Go back to the ArchiCAD window and click in the 3D Script
This way we will only need to modify the values in the command, Window of the Object. Paste (CTRL+V) the GDL code into
thereby eliminating possible error messages resulting from incorrect the 3D Script Window.
syntax. CONE h, r1, r2, alpha1, alpha2
4 Go to Page 33 in the AC GDL Reference Guide and find the
description of the CONE command there.

Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide 85


6. Basics of GDL Scripting

Hint: The decimal separator within the Library Part Editor and its
Script windows is always the period character (“.”). It is not
affected by your language settings. It is always a period.
8 Enter the following command in the next line of the 3D
The syntax of a GDL command is as follows: Script:
• First comes the name of the keyword (CONE in this case) ADDZ .06
• A “SPACE” character must follow it
• Then comes the list of parameters of the GDL command. The
parameters are separated by commas. The number of parameters
listed must be the number required by the given command. (In this
case, the CONE command requires five parameters.) There is no
comma after the last parameter.
This command shifts the position of the Local Coordinate System .06
h means the height of the Cone, r1 and r2 specify the radius of the meters in the positive direction along the z-coordinate of the Local
Cone at its base and at its highest level, respectively. alpha1 and Coordinate System.
alpha2 are inclinations of the end surfaces of the Cone relative to
its vertical axis. 9 Activate the 3D View.
In the case of a normal Cone with a pointed tip, alpha1 and
alpha2 are both 90 degrees, and r2 equals zero.
The center of the Cone’s base will be located at the origin of the
Local Coordinate System and its body will be generated in the
positive direction.
7 Modify the GDL code as follows:
CONE .06, .25, Radius_Leg, 90, 90

The Cone will be .06 meters high, its bottom radius will be .25 meters,
and its top radius will be the value defined by the Radius_Leg
variable. You will see that the Global Coordinate System origin and the Local
Hint: As a default, length/area/volume values are given in meters Coordinate System origin are now not at the same location. The Cone
in all GDL scripts. It is also possible to specify them in imperial is already generated, and we moved the Local Coordinate System
units (e.g., 1/2" or 1'-3 1/2"). Further, when specifying origin to the top of the Cone so that we can script the next element in
values with a leading zero, it is not necessary to type in the leading the GDL Object from that position.
zero. So 0.06 and .06 are equally correct.

86 Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide


6. Basics of GDL Scripting

10 In the GDL Reference Guide, find the description of the 13 Enter the following command in the next line of the 3D
CYLIND command (Page 31). Copy its syntax code Script:
(CYLIND h, r) to the Clipboard. ADDZ .05
CYLIND h, r

We again move the position of the Local Coordinate System .05


meters along the z-axis in the positive direction.
This command will create a cylindrical shape. The height of the shape Should you wish to view the progress of the model anytime after
will be the value defined by the h parameter, and its radius is defined finishing a command, you can enter the 3D View to check it.
by the r parameter. The center of its base will be located at the origin 14 Enter the following command in the next line of the 3D
of the Local Coordinate System and its body will be generated in the Script:
positive direction.
Height_Leg = ZZYZX-Thickness_Top-.04-.05-.06
11 Go to the 3D Script and paste the syntax code into the next
line.

12 Modify the code to the following: The next element we need to create is the leg portion of the Table. If
CYLIND .05, Radius_Leg you remember the 6.2 Creating Parameters View on the Floor
Plan, you can see that the height of the leg is the result of subtracting
the following from the height of the table (ZZYZX): the thickness of
the table top (Thickness_Top), the height of the upper reversed
cone (.04), the height of the lower metal cylinder below the leg
portion (.05) and the height of the base cone (.06). When dealing with
long expressions, it is practical to assign values to new variables. This
is what we did in the line of code above.
This way the Radius_Leg parameter will be used to specify the
radius of this element.

Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide 87


6. Basics of GDL Scripting

15 Enter the following command in the next line of the 3D


Script:
CYLIND Height_Leg, Radius_Leg

In creating the leg portion, we use this new variable in the CYLIND
command.
16 Enter the following command in the next line of the 3D
Script:
17 Enter the following command in the next line of the 3D
ADDZ Height_Leg+.04 Script:
MULZ -1

With this instruction, we again shifted the Local Coordinate System.


At this point in time it is located at the bottom plane of the table top
as planned. If you activate the 3D View, you can see where the Local The MULX, MULY, and MULZ commands invert the direction of
Coordinate System origin is located. The reason we did that is the respective axes of the Local Coordinate System. Activate the 3D
because we need to create an upside-down Cone. The next two View and see that the z-axis now points downward. The x and y-axes
commands will explain why this is necessary. point in the original directions.

88 Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide


6. Basics of GDL Scripting

Error messages are important because they inform you that you must
correct your script: otherwise, your Object will not behave correctly.
Many times the correct model is not generated until your fix the
error.
The exact error message is:
“Parameter error at line 9 in the 3D Script of the file Untitled-1.gsm”
If you click the “Stop” button, ArchiCAD will jump to the line in
question. The error message says there is a parameter error, so you
need to check what is wrong with the parameter and make a
This basically has the same effect as if we mirrored the Local correction.
Coordinate System on its x-y plane. Since elements are always created In this case, the problem (after consulting the GDL Reference Guide)
relative to the position of the Local Coordinate system, a cone will is that the last two parameters (the angle parameters) must be greater
now be generated downward, which was our purpose with this step. than zero.
18 Enter the following command in the next line of the 3D 19 Modify the last line of the 3D Script to the following:
Script: CONE .04, .15, Radius_Leg, 90, 90
CONE .04, .15, Radius_Leg, 0, 0

This will generate the upside-down Cone. Activate the 3D View to


ArchiCAD will display an error message saying that you have a see the result. As you can see the upside-down Cone adjoins the top
Parameter error. of the leg portion. This is why in Step 16 we moved the Local
Coordinate System by the value of the leg (Height_Leg) plus the
height of the upper cone (.04).

Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide 89


6. Basics of GDL Scripting

20 Enter the following command in the next line of the 3D 21 Enter the following command in the next line of the 3D
Script: Script:
DEL 1 CYLIND Thickness_Top, Radius_Top

The DEL command undoes coordinate transformations. By


coordinate transformation we mean any command that alters the This will create the tabletop. Its height will be the value specified by
position, direction or unit length of any or all of the Local Coordinate the Thickness_Top parameter, and its radius will be the value
System axes. The parameter (1) following the command name (DEL) specified by the Radius_Top parameter. Here you can see the
instructs the program to undo 1 coordinate transformation. The last utility of giving descriptive parameter names: you look at the
such transformation was the MULZ –1 command. This is what is command and know exactly what it does.
undone in this step. By activating the 3D View, you can see that the
Local Coordinate System returned to its state prior to the MULZ -1
coordinate transformation.

90 Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide


6. Basics of GDL Scripting

When the DEL command is followed by the TOP parameter, it


instructs ArchiCAD to delete (undo) all coordinate transformations.
This will result in the Local Coordinate System origin returning to its
position coinciding with the Global Coordinate System origin.
23 Activate the 3D View to see the whole model.

With this last command, we finished creating the 3D model of the


Table.
22 Enter the following command in the next line of the 3D
Script:
DEL TOP
As you can see, the entire model is complete. Move around the model
using the ArchiCAD’s Orbit feature (hold down the SHIFT key and
the middle mouse key simultaneously, and move around with the
mouse). You will also see that the Global and Local Coordinate
Systems are coincident.

Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide 91


6. Basics of GDL Scripting

6.4 ASSIGNING MATERIALS 2 Find the first line defining the bottom cone (CONE .06, .25,
Radius_Leg, 90, 90) and paste the material code in front of it
AC Guide GDL Ch so it will look like this:
06_04.mp4 [SET] MATERIAL index
Watch Movie CONE .06, .25, Radius_Leg, 90, 90
When you viewed the 3D model of the Table, you saw that the every
element of the model was of the same material. This is because we
have not yet assigned materials to the various elements within the
model.
1 Find the “MATERIAL” command in the GDL Reference
Guide (Page 156) and copy its syntax code to the Clipboard.
SET] MATERIAL name_string
SET] MATERIAL index

3 Modify the command to the following:


MATERIAL Material_Bottom
The [SET] portion of the command is in parentheses because it is CONE .06, .25, Radius_Leg, 90, 90
an optional element. The command can be MATERIAL or [SET]
MATERIAL: either one is correct. Materials defined in ArchiCAD all
have a name and an index number. An example of a name is
Wd-Pine Horizontal. An example of an index number is 15.
Of course this can also be the name of a variable.
The MATERIAL command works by setting the current material to
be used in all subsequent 3D elements generated until another
MATERIAL command changes it.
Hint: There are certain commands that include material
specification in the command as part of the parameter list.
Elements created with these commands will use their own
materials, while all other elements not having their own material
defined in their command will use the material defined in the We deleted the [SET] part as it is not necessary, and we modified
MATERIAL command. the parameter. The result: all elements generated after this will use the
material defined by the parameter Material_Bottom.

92 Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide


6. Basics of GDL Scripting

4 Activate the 3D View to see the result.

The result: the short piece above the lower cone will use the same
material as the cone. The leg will use the material defined by
We should not generate the entire table using the material specified by
Material_Leg, the upper cone will use Material_Bottom,
Material_Bottom. As such, whenever we want an element to be
and the tabletop will use Material_Top.
generated using a different material, we need to insert a new
MATERIAL command just before its code. 6 Activate the 3D View to see the result.
5 Insert the other MATERIAL definitions. Place three more
material commands in their respective places so the code
reads as follows:
MATERIAL Material_Leg
CYLIND Height_Leg, Radius_Leg

MATERIAL Material_Bottom
CONE .04, .15, Radius_Leg, 90, 90

MATERIAL Material_Top
CYLIND Thickness_Top, Radius_Top

Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide 93


6. Basics of GDL Scripting

Orbit around the model to see it from below. Note how each of the
elements are shaded differently for different materials.
6.5 CREATING VALUE LISTS FOR
7 In the parameter list, select the Material_Bottom parameter PARAMETERS
and assign a different material to it by clicking on the AC Guide GDL Ch
right-pointing arrow in the Value column and selecting a new 06_05.mp4
material from the upcoming list of available materials. Watch Movie
In GDL it is possible to define a list of values for any parameter from
which the user may choose. This is useful if you wish to create
standard sizes for catalogs. For, example, in the case of a door, you
could create value lists for its width and height parameters.
1 Open the Parameter Script by clicking on its button in the
Editor Window.

8 Activate the 3D View to see the result.

This is the Script Window in which you define these value lists.
2 In the GDL Reference Guide, find the VALUES command
(Page 185) and copy it to the Clipboard.
VALUES "fillparam_name" [[,] FILLTYPES_MASK
fill_types,] [,]value_definition1 [,
value_definition2, ...]

Orbit around to see which elements changed their materials.


9 Set the Material_Bottom parameter back to Mtl-Chrome.
This concludes setting the materials.

94 Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide


6. Basics of GDL Scripting

3 Go to the Parameter Script of the Object and paste the code 5 Close the Parameter Script and select the Radius_Top
into it. parameter in the parameter list.

The portions of the command in parentheses are optional, so we will


not go into those right now. If you clean these from the command,
the following remains:
VALUES "fillparam_name" value_definition1 [,
value_definition2, ...]
You will see that the “Value” field is now greyed. This grey color
means that the value cannot be freely modified, as it comes from a
value list.
6 Click on the right-pointing arrow in the “Value” field of the
Radius_Top parameter and select 375 from the value list.

The fillparam_name parameter is the name of the parameter to


which these possible values will be assigned.
There must be at least one value definition parameter, but there can
be as many as you wish.
4 Modify the command as follows:
Values "Radius_Top" .300, .375

As you can see, a value list appears, and there are two possible values:
“300” and “375”.
Hint: The format that defines which values are displayed in the
Library Part Editor Window is controlled by the Model Unit field
This means that a value list consisting of two possible values of “.3” of the Options > Project Preferences > Working Units &
and “.375” will be applied to the parameter Radius_Top. Levels... dialog. It is currently set to millimeters: this is why you
Again, metric values in scripts are always in meters. see “375” (millimeters) displayed and not “.375” (meters).

Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide 95


6. Basics of GDL Scripting

6.6 CHECKING THE 3D MODEL Orbit around the model to see that the individual parts join correctly.
3 Set several other parameters to see if the model is still
AC Guide GDL Ch correct.
06_06.mp4
Watch Movie
Now that all aspects of the 3D Model are done, you should check the
correctness of the 3D model by setting various values for the
parameters controlling its geometry to see if it is scripted properly.
1 Activate the 3D View of the Object.

4 Set the modified parameters back to their defaults.


The following table shows what the defaults should be:
Variable Value
A 1000
B 1000
2 Go back to the Editor Window, and modify the value of the ZZYZX 710
“ZZYZX” parameter to 1.000 (1000 mm), then activate the 3D Radius_Top 375
View to see the result. Thickness_Top 40
Radius_Leg 30
Material_Top 15 (Wd-Pine Horizontal)
Material_Leg 15 (Wd-Pine Horizontal)
Material_Bottom 13 (Mtl-Chrome)

96 Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide


6. Basics of GDL Scripting

6.7 CREATING THE 2D OF THE OBJECT


AC Guide GDL Ch
06_07.mp4
Watch Movie
We will now create a simple 2D Representation of the Object.
1 Find the “CIRCLE2” command in the GDL Reference Basically, the 2D View of the object is a Top View. When viewing the
Guide (Page 121) and copy its syntax code to the Clipboard. table model in the 3D View, its center is located at the 0,0
CIRCLE2 x, y, r coordinates. The 2D and 3D of the Object must correspond to each
other, so obviously we need to ensure that the center of the circle
representing the table in 2D has its center at 0,0. Another required
correspondence is that the radius of the tabletop be defined by the
Radius_Top parameter. So we use this same parameter in the 2D
The CIRCLE2 command creates a full circle in 2D. x and y specify representation of the tabletop.
the coordinates for the center of the circle, while r defines its radius. 5 Activate the 2D Full View by clicking on its button in the
2 Open the 2D Script by clicking its button in the Editor Editor Window to see the result.
Window.

3 Paste the command syntax code into the 2D Script.

With this step the 2D of the table is ready.


4 Modify the command to the following: Hint: You may add a preview picture to your object as described
CIRCLE2 0, 0, Radius_Top in the previous chapters of this Interactive GDL Training Guide.

Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide 97


6. Basics of GDL Scripting

6.8 PLACING AND WORKING WITH THE 3 Close the Editor Window and go back to the Floor Plan.
Activate (with a double-click) the “6.3 Working with the
OBJECT Object” saved View.
AC Guide GDL Ch 4 Select the Object Tool in the Tool Bar. In the Info Box, click
06_08.mp4 on the Object Tool icon to open its Settings Dialog.
Watch Movie
We will now save the Object, then place and manipulate the finished
Object.
1 While still in the Library Part
Editor Window, select the “File >
Save As…” menu command.
2 In the upcoming Dialog, find an
appropriate folder for your
Object. In the File Name field,
enter “Pedestal_Table_P90”.
Click the “Save” button to save it.

The Dialog opens up with the Object you just saved and selected. In
the Parameters list you can see all the parameters you created.
Above the Parameter list, you can see the width, depth and height
parameters (from top to bottom). We used the height parameter in

98 Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide


6. Basics of GDL Scripting

the Object so you can expect it to react should we adjust this


parameter.
As you can see, the default parameters we set in the Editor Window
are now displayed for the parameters.
In the upper right corner is the Preview Window of the Object. It
currently displays the 2D View of the Object.
As you can see, the program has automatically created five hotspots at
the center and the corners of the bounding box for easy placement.
5 In the Preview Window, click the middle hotspot.

Notice that the Object was placed by the selected hotspot. This is
handy if you want to align your Object to some other element by one
of its hotspots.
7 Select the Object by clicking on one of its hotspots or
drawing an Area Selection rectangle around it. Click the right
mouse button. In the appearing context menu, select the
“Show Selection/Marquee in 3D” command.

There will be a rectangular box around the selected hotspot. When


you place the Object later, it will be placed in such a way that its
selected hotspot will be located at the position you clicked.
6 Click “OK” to close the Dialog. Click somewhere in the
middle of the screen to place the Object.

Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide 99


6. Basics of GDL Scripting

and this is why we used it. We wanted the model of the Object to
align with this parameter.
9 Click the upper middle 3D hotspot. In the appearing Pet
Palette, select the Stretch Height command.

8 Select the Object in the 3D Window.

10 Move your cursor around to see how the 3D bounding box of


the Object stretches along with your movements. It provides
a visual feedback of how large the Object will be after the
stretch.

Notice that in 3D there are five hotspots at its base plane, and
another five hotspots above the previous five, at a fixed distance
above them. That distance is defined by the “ZZYZX” parameter,

100 Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide


6. Basics of GDL Scripting

shortcut key will place it in the most obvious field. Since we are
vertically stretching an Object, the height is the obvious choice for
the input.

11 On the keyboard, enter the following: “600”. Now press the


“ENTER” key.

The new value will be applied to the Object as seen in its 3D model
and 3D hotspots. As you can see, the model and the 3D hotspots
continue to be aligned with each other.
If you did not use the “ZZYZX” parameter, stretching the height
would modify the position of the upper 3D hotspots, but not the
geometry of the Object.

With this you entered the new height into the Tracker. Although you
usually need to press shortcuts keys (such as “R”, “X” or “A”) to
activate a field in the Tracker, starting to enter a value without a

Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide 101


6. Basics of GDL Scripting

This concludes this chapter.


12 Save the project and close it.

102 Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide


7. Basics of GDL Scripting – Part 2

7. BASICS OF GDL SCRIPTING – PART 2


In this chapter you will continue exploring various GDL commands and Let’s have a look at the object that we are going to model.
concepts. You will model part of another, slightly more complex table. 2 Open up the “AC Guide GDL Chapter 07” folder in the View
You will again work in the Library Part Editor Window. This lesson Map of the Navigator palette and activate (by
demonstrates the following basic object making techniques: double-clicking) the “7.1 Overview H98” saved view in the
• Using IF-THEN commands to implement the creation of model “Chapter 7” folder.
pieces based on user-defined conditions
• Using subroutines to create parts of the model that occur multiple
times
• Using commands (PRISM_ command) and so-called “Status
Codes” to control the visibility of individual surfaces and edges of
Objects in 3D
• Using additional special “Status Codes” for creating curved objects

7.1 OVERVIEW
AC Guide GDL Ch
07_01.mp4
Watch Movie
1 To start the seventh lesson of this interactive, hands-on
ArchiCAD GDL training guide, open the “AC Guide GDL
Ch 07.pla” file. Select the “Read elements directly from
This piece of furniture was designed by Alvar Aalto in 1956.
archive” option.
The table is made of natural lacquered birch. The tabletop is 5 cm
thick and is curved on both ends. It also has one leaf that can be
placed into the middle, making the table longer. The table is available
in two sizes. The legs of the table are so-called H-legs, which refers to
their profile shape. The leg is made of birch. Its top material may be
birch veneer or white laminate. For more information please visit the
manufacturer’s website: www.artek.fi
There is another type of this table, which is slightly shorter in length
and width. If you activate (by double-clicking) the “7.2 Overview
H99” saved view in the “Chapter 7” folder, you can see its
dimensions.

Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide 103


7. Basics of GDL Scripting – Part 2

Hint: If you want to check the complete GDL object that we are
going to make, open the Object Tool and locate the
“Extension_Table_H98_Final” Library Part in the object browser.
The object is located in the “Finished Objects” folder. Since we are now creating a Table, we need to modify the Subtype to
fit our desired Object type.
7.2 CREATING THE PARAMETERS 2 Choose the “File > Save as…” command to save the file.
Give it the name “Extension_Table_H98.gsm” in the Save
AC Guide GDL Ch Dialog, and click “OK” to save it to a location of your choice.
07_02.mp4
Watch Movie
1 Choose the “File > Libraries and Objects > New Object…”
menu command.
As you can see, the default Subtype of any new object is “Model
Element”.

104 Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide


7. Basics of GDL Scripting – Part 2

3 Click the “Select Subtype…” button in the Library Part 4 In the hierarchy select “General GDL Object > Model
Editor Window to bring up the Subtype Hierarchy Dialog. Element > Furnishing > Table”, and click the “Select”
button.

The default parameter list of the Object has changed to “Table”.

Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide 105


7. Basics of GDL Scripting – Part 2

The parameters starting with a “gs_” string are built-in parameters


that come from the Table element subtype.
Using these default parameters has the advantage of having a
standard parameter set when creating object libraries. Another
advantage is that when transferring parameters from one element to
As you can see, many new default parameters have appeared on the another (CTRL-ALT-click [Windows] / CMD-OPT-click [Mac]), the
list of parameters. These parameters can be divided into three maximum number of parameters will have their values transferred
categories: 2D Representation parameters, Material parameters and because these parameters exist in both Library Parts involved in the
Parameters for listing. parameter transfer.
We are going to use several of these parameters and we will also The parameters not starting with “gs_” are the kind we will create for
create some new ones. this object.
5 Go back to the Floor Plan and activate (by double-clicking) 6 Go back to the Editor Window and create several new
the “7.3 Object Parameters” saved view in the “Chapter 7” parameters based on the following table:
folder of the Navigator.
Variable Type Name Value
The View shows the kind of parameters we want to create for this
Table. Table_Type Text Type of table H98
Show_Insert Boolean Show Insert piece Off
_3D_representation Title 3D Representation
Thickness_Top Length Thickness of table top 50
Pen_Top Pen View pen of table top 4
in 3D
Pen_Leg Pen View pen of legs in 4
3D

106 Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide


7. Basics of GDL Scripting – Part 2

When the number of parameters increases, it becomes necessary


subdivide the parameters into categories that make them organized
and easier to use. The Editor Window has several options that help
you do that.
7 Select the “Table_Type” variable and click on the
two-pointed arrow in the left end of its row. Drag the
parameter by this arrow to the position below the parameter
“AC_show2DHotspotsIn3D”.

With the use of the two-pointed arrows you can move any parameter
in the list of parameters to any desired location.

Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide 107


7. Basics of GDL Scripting – Part 2

8 Drag the “Show_Insert” parameter to the position below the 9 One by one, drag the other four created parameters to the
parameter “Table_Type”. position below the parameter “gs_back_pen” such that their
order remains the same.

We moved these parameters around so that the two most important


ones will be at the top of the parameter list, and the 3D
representation-related parameters come after the 2D representation
parameters.
Hint: The first four parameters (A, B, ZZYZX,
AC_show2DHotspotsIn3D) will not appear in the list of
parameters in the Settings Dialog. They appear on the right of the
parameter list in the Settings Dialog.
10 Click on the Type button of the “_3D_representation”
parameter and look over the types of parameters that are
available.

108 Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide


7. Basics of GDL Scripting – Part 2

The following table shows the parameter Types and their uses: • Subordinate toggle: this switch will list the parameter below the
Type Usage next non-subordinate parameter above it in the list. This toggle is
used in conjunction with the Title parameter type.
Length used for physical dimensions of elements, such as the
length of an edge or the height of an element • Bold toggle: you can make any parameter in the list bold with this
switch.
Angle used for angle values, e.g., the value by which an
element is rotated • Unique toggle: if you switch this toggle on, this parameter will not
accept parameter values from the default settings during a
Real used for any kind of number used in your scripts parameter transfer (CTRL-ALT-click [Win] / CMD-OPT-click
Number [Mac]).
Integer used for whole number type of variables, such as the 11 Select the “Thickness_Top” parameter in the list and click
number of pieces in a structure, or the number of on its Subordinate button.
times an operation should be repeated
Boolean used for Yes/No-type of conditions, like toggling an
element on/off
Text used for any type of text strings used in your scripts
Material used for assigning materials to elements in GDL
Line type used for assigning line types to GDL elements
Fill pattern used for assigning fill types to GDL elements
Pen color used for assigning pen color/index numbers to GDL
elements
Separator used to separate parameters from each other in the
parameter list
Title used to create a bolded title line under which you can
group parameters

So the Title Parameter Type is used for grouping. It is always bolded.


In our case, we used the _3D_representation parameter as a title for
a group of additional parameters which belong under it.
There are four more toggles to the left side of each Variable in the
parameter list.
From left to right, these are:
• Hidden toggle: if you switch this on for a parameter, the
parameter will not be visible in the parameter list and the user of
the object will not be able to directly set its value.

Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide 109


7. Basics of GDL Scripting – Part 2

12 Repeat this operation with the “Pen_Top” and “Pen_Leg” 15 In the Parameters panel of the Dialog, click on the
parameters. right-pointing arrow to the left of the “3D Representation”
text in the parameter list.

13 Save the Object and go back to the Floor Plan View.


14 Select the Object Tool from the Toolbox and open its
Settings Dialog. The settings of the
“Extension_Table_H98.gsm” file will be visible.

Here you can see the effect of the Subordinate toggle. Since you
switched the Subordinate toggle to ON for all three parameters, they
are now shown as set of sub-parameters of the parameter
immediately preceding them.
This is how you can neatly organize your parameters into logical
groups.

110 Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide


7. Basics of GDL Scripting – Part 2

16 Close the Setting Dialog and go back to the Editor Window.


Open the Parameter Script and type in (or copy-paste from
7.3 CREATING THE MASTER SCRIPT
this document) the following code: AC Guide GDL Ch
VALUES "Table_Type" "H98", "H99" 07_03.mp4
Watch Movie
1 Click on the “Master Script Window” button to open the
Master Script in a separate Window.

With this command we have set the two possible values for the
“Table_Type” parameter. The user will be able to choose from
these two (as we learned in the previous chapter).
17 Go back to the Editor Window, select the “Table_Type”
parameter and click the right-pointing arrow at the right of
its Value field to make sure the two possible values are now
available.
The purpose of the Master Script is the following: it is a script that is
executed before every other type of script. Thus, whatever you write
in the Master Script will be executed before the 2D Script, the 3D
Script, the Parameter Script, etc.
In everyday use this works the following way: when you click the “3D
View” button, ArchiCAD knows that it first needs to execute
commands found in the Master Script. This is then followed by
commands it finds in the 3D Script. When you click the “2D Full
view” button, the Master Script is the first to be executed, followed
by the 2D Script.
Hence, you should place commands and information you want all
your scripts to be able to have in the Master Script. You should not
place any command or variable definition used specifically for one
Script in the Master Script; the Master Script should contain only
things used by several other Scripts. The Master Script can save you

Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide 111


7. Basics of GDL Scripting – Part 2

time and space because you will only need to script commands you Here we are using the IF-THEN pair of commands. The general
use in many scripts once (in the Master Script). working method is as follows:
We will now use the Master Script to define variables we are going to If <Condition> THEN
use in both the 2D Script and the 3D Script. These variables define <Commands to execute if condition is true>
some of the most important dimensions of the table based on the ENDIF
value selected for the Table_Type parameter. To use the command, you define a condition and then define a
2 Type or paste the following code into the Master Script: command or a set of commands that should be executed if the
condition is true.
IF Table_Type = "H98" THEN
Top_Length = .95 In our case the condition is the following:
Top_Width = 1.2 Table_Type = "H98"
Top_Length2 = Top_Length - Top_Width/2 So, the command(s) between the THEN keyword and the ENDIF line
Insert_Length = .6 will be executed if the value of the Table_Type parameter is
Leg_Origin_X = .63 “H98”.
ENDIF Of course, we have set the possible values of the Table_Type
parameter to be “H98” or “H99”, so it will always be either one or
the other.
In our case the last line of the IF-THEN structure is an ENDIF
command, as shown above. As you can see in the GDL Reference
Guide, there are other syntaxes of the command, but we will only use
this one.
The structure shown above will set five different variables to various
3 Click the “Help > ArchiCAD GDL Reference Guide” menu values when the value of the Table_Type parameter is “H98”.
item to open the GDL Manual. Find the IF command on These are all values we use when the “H98” type Table is generated.
Page 216.

112 Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide


7. Basics of GDL Scripting – Part 2

4 Go back to the Floor Plan and activate (by double-clicking)


the “7.4 Master Script variables” saved view in the “Chapter
7” folder of the Navigator.

Using the two IF-THEN structures, we have set all the necessary
variables for both types of the Table that are specific to the Table
Type.
6 Staying in the Master Script, copy-paste the following code to
the end of the Master Script code:
Top_Length2 = Top_Length - Top_Width/2
Insert_Width = Top_Width
Leg_Height = ZZYZX - Thickness_Top
Leg_Origin_Y = .295

Here you can find the dimensions for which the parameters shown
above are used. These dimensions and variables will be needed when
generating the tabletop and the table legs. As you can see, of the eight
variables, four were defined in the IF-THEN structure. The other
four will be defined later (with an explanation to follow).
5 Go back to the Editor Window, open its Master Script
Window again, and copy-paste the following code after the
end of the existing code:
If Table_Type = "H99" THEN
Top_Length = .825
Top_Width = 1.05
Insert_Length = .45
Leg_Origin_X = .555
ENDIF

Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide 113


7. Basics of GDL Scripting – Part 2

These four lines of code are not in an IF-THEN structure. The


reason for this is that these two values are the same for both the H98
and the H99 types, so we did not include them in the two IF-THEN
structures. Instead, we placed them at the end of the script so they are
always executed no matter what the value of the Table_Type
parameter.
Hint: As you can see in the Master Script, the Top_Length2 The PEN command sets the Pen to be used for the contours of the
variable is calculated using both the Top_Length and the elements drawn from there on, until another PEN command changes
Top_Width variables. For this reason, both these variables it. You can find a description of the PEN command on Page 154 of
should be defined before they are used to define another variable. the GDL Reference Guide. We will use the value defined by the
This ensures they have the correct, expected value when they are Pen_Top parameter for the contours of the Tabletop.
used. As you know, the values of these variables do not come from We will use the gs_top_mat default parameter to specify the
parameters, so their default value is zero. If the Top_Length2 material of the Tabletop.
= Top_Length - Top_Width/2 line preceded the two
lines before it, the value of Top_Length2 would always be zero, We’ll move the Local Origin up to the bottom of the Tabletop with
because the values of those other two variables would be zero at the ADDZ command. As you can see, we used the Leg_Height
that time. variable as the parameter for the ADDZ command, and it will carry
the correct value, since it was already set in the Master Script (which is
executed before the 3D Script).
7.4 CREATING THE 3D SCRIPT 3 Find the description of the PRISM_ command on Page 34 of
the GDL Reference Manual.
AC Guide GDL Ch
07_04.mp4
Watch Movie
1 Click the “3D Script Window” button to open the 3D Script
in a separate Window.

2 Copy-paste the following lines of code into the 3D Script


Window: 4 Copy the code syntax of the command and paste it below the
PEN Pen_Top existing lines of code of the 3D Script:
MATERIAL gs_top_mat PRISM_ n, h, x1, y1, s1, ... xn, yn, sn
ADDZ Leg_Height The PRISM_ command is a very versatile and widely used command
in GDL. It creates a Slab-type element. The interesting thing about

114 Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide


7. Basics of GDL Scripting – Part 2

the PRISM_ command is that: a), it can have holes in it, and b), any Let’s make use of a pentagon-based extruded element. The last
of its side surfaces and any of its edges may be set to be invisible. defined point is the same as the starting point: this is how we close
n defines the number of points we define in the command by giving the PRISM_.
(for each point) the x-value, the y-value, and a so-called status code At any point three edges and one side surface are created when the
which defines the visibility of edges and the side surface starting from surface going from the given point to the next point is generated.
that point. The value of the bottom horizontal edge is “1”, the value of the
h defines the height of the PRISM_ element and may even be set to vertical edge at the point is “2”, the value of the top horizontal edge is
a negative value. The body of the PRISM_ will extrude along the “4” and the value of the surface is “8”. If you want any edge or the
z-axis of the Local Coordinate System in the direction based on the side surface to be visible, you should add its value to the status value
sign of the h value. belonging to that edge. If you don’t want visibility, its value should be
For each side surface there is one surface and three edges between the zero. The sum of these values will make up the status code for that
given point and the next point of the PRISM_. point of the PRISM_.
5 Go back to the Floor Plan and (by double-clicking) activate For example, if you want the top and bottom edges, plus the side
the “7.5 PRISM_ Status Codes” saved view in the “Chapter surface starting from point 3 to be visible, but want the vertical edge
7” folder of the Navigator. at point 3 to be invisible, the status code would be 13
(1+0+4+8=13).
1: bottom horizontal edge visible
0: vertical edge invisible
4: top horizontal edge visible
8: side surface visible
Thus, if this point is at the coordinate 0,0 in the PRISM_ definition,
its line would be:
0, 0, 13,
Each point will have a line like this in the PRISM_ command to
define the whole PRISM_.
6 Modify the PRISM_ command in the 3D Script to the
following:
PRISM_ 6, Thickness_Top,
0, -Top_Width/2, 15,
Top_Length2,-Top_Width/2, 15+64,
Top_Length2, 0, 915,
Here you will see a drawing explaining how these status codes work. 0,180, 4013,
The PRISM_ command creates a vertically extruded shape based on 0, Top_Width/2, 15,
a polygon defined in the x-y plane of the Local Coordinate System. 0, -Top_Width/2, -1

Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide 115


7. Basics of GDL Scripting – Part 2

8 Go back to the Floor Plan and activate (by double-clicking)


the “7.6 Table Top piece” saved view in the “Chapter 7”
folder of the Navigator.

7 Activate the “3D View” Window to see the result.

You can see the six points that need to be defined. You can read off
their coordinates from the drawing.
Let’s look at the line belonging to the first point:
0, -Top_Width/2, 15,
Its x-coordinate is “0”, its y-coordinate is the value defined by minus
half of the Top_Width variable. You can read these coordinates off
the drawing. Since we want all three edges and the side surface
belonging to this point to be visible, the value of the status code will
This PRISM_ command will create the Tabletop for us. be 15 (1+2+4+8).
As you can see, we defined six points for the PRISM_, and the height Hint: Generally, all edges and the side surface are visible, so the
of the PRISM_ is the value defined by the Thickness_Top value of the status code is “15”. In case the status code is different,
parameter. it is good practice to break it up so you can see the values from
Each line contains an x and a y-coordinate value (in this order) and which it is constructed.
the status code for the point located at those coordinates and its 0, -Top_Width/2, 1+2+4+8,
associated edges and side surface.
From the above you can immediately read off the visibility status of
each edge and the side surface. ArchiCAD will automatically add up
the values to calculate the status code.

116 Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide


7. Basics of GDL Scripting – Part 2

You can also see another illustration of this on Page 140 of the GDL The shape on the left does not have the value 64 in the status codes
Reference Guide. of its points, therefore all vertical edges are visible; some of them are
not even needed.
The shape on the right employs the value 64 and so the only edge
drawn is that necessary to show the contour of the shape.
This illustrates that the main use of the 64 value in status codes is to
provide smoother appearance in hidden line Views in 3D.
The next line - which defines the third point of the PRISM_ - has
another new feature:
Top_Length2, 0, 915,
As you can see, the status code is 915, not 15.
10 Go to Page 145 in the GDL Reference Manual for the
description of the Set centerpoint Status Code.
Looking at the second point we should notice something new in the
status code:
Top_Length2,-Top_Width/2, 15+64,
The status code is now 15+64 instead of 15. 64 is a special value
that can be added to the value of the status code. It has an effect only
when the vertical edge of the given point is set to be visible. In such a
case it instructs the program to calculate whether the given vertical
edge needs to be drawn because it is part of the contour of the
PRISM_ element. If it is not part of the contour, it will not be drawn.
Should the 64 value not be present, the given vertical edge will always In GDL there are special status codes (like the 64 value) that can be
be drawn, regardless of whether it is a contour of the element or not. added to the status code. These values serve the purpose of enabling
9 Go to Page 36 in the GDL Reference Guide, and find the two you to create curved edges of your objects more easily or to create
shapes shown there. segments based on the geometry, tangent, etc., of already defined
segments of the shape.
If you want to create a curve, you can do it in two steps: first, you
need to define the center of the arc of that curve, then draw the actual
curve, taking into consideration the last point defined and the center
of the arc.
The 900 status code is used to define the center of the arc to be
drawn in a later step of the PRISM_ command.
The first two values define the x and y-coordinates of the center, and
the third value gives the status code. In this case the status code is
really 900+15, which results in 915. So you define the edges and

Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide 117


7. Basics of GDL Scripting – Part 2

side as usual, then add the value 900, just as you added the value 64 Hint: It is also possible to leave out this last line of code. In that
in the previous line of code. case the number of the point will be one less, and ArchiCAD will
The next step is to define the actual arc or curve. The next line of automatically close the shape.
code does it: Hint: It is also possible to define holes as shapes. In that case the
0,180, 4013, main shape must always be closed with the -1 status code
11 Go to Page 147 of the GDL Reference Manual for a method, and then the next line of the PRISM_ command will
description of the Arc using center point and angle Status define the first point of the hole. In such a case, the hole must also
Code. be closed with the -1 status code method.
Thus far, this is how this command is constructed:
PRISM_ 6, Thickness_Top,
0, -Top_Width/2, 15,
Top_Length2,-Top_Width/2, 15+64,
Top_Length2, 0, 915,
0,180, 4013,
0, Top_Width/2, 15,
0, -Top_Width/2, -1

The 4000 status code draws a curved segment which is a true arc, 12 Open the 3D View of the Editor Window again to see the
using the center point just defined and an angle value. result.
In this line of code, of the three values given, the first value is always
zero (0), the second value defines the angle of the arc, and the third
value is 4000 plus the normal status value of the edges and side
surface.
(Notice that the value is now 4013. “13” now means 1+0+4+8,
meaning that we do not want to see the vertical edge at the start of
the curve. This is the point where the planar side meets the curved
side and no vertical edge is needed since they join smoothly.)
The next two points offer nothing new.
The last point’s status code is worth reviewing.
0, -Top_Width/2, -1
The status code is -1. Note that the x and y-coordinates of the point
are the same as those of the first point. This is the clue to the status
code: it is a sign that we are closing the shape. The rule is: the
coordinates of the latter point must be the same as those of the first
point and the status code must be -1.

118 Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide


7. Basics of GDL Scripting – Part 2

13 In the 3D View, use the Orbit feature to turn the shape 15 Activate the 3D View Window to see the change.
around. See that the correct contour is always visible.

As you can see, the vertical edges appear in the curved portion of the
14 Modify the third line of the PRISM_ command as follows Tabletop. This is why we need the 64 status code.
(take out the “64” part): 16 Modify the third line of the PRISM_ command back to its
Top_Length2,-Top_Width/2, 15, original state (put the “64” part back in):
Top_Length2,-Top_Width/2, 15+64,

At this stage the Tabletop is made up of two parts (refer to View 7.3
Object Parameters). These are mirrored images of each other. We
can script both separately, or we can use so-called “sub-routines” to
save programming effort.
A sub-routine is a portion of GDL that contains code that needs to
be executed more than once. In such a case it is advisable to put this

Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide 119


7. Basics of GDL Scripting – Part 2

code into a sub-routine and call this sub-routine several times to Its syntax is the following (refer to Page 213 of the GDL Reference
perform the same task repeatedly. Guide):
A subroutine has three parts: GOSUB label
1. A label Example:
2. The actual code of the sub-routine GOSUB 100
Hint: no colon follows the number of the label in the GOSUB
3. A RETURN command command.
We will make a sub-routine out of this PRISM_ command. The effect is that at this point, the execution of the code in the script
17 Modify your code as follows: will continue at the sub-routine located after the 100: label, and
100: when it reaches the RETURN command, it will come back and
PRISM_ 6, Thickness_Top, continue executing the next line of code after the GOSUB command.
0, -Top_Width/2, 15, 18 In the 3D Script Window, place the following lines of code
Top_Length2,-Top_Width/2, 15+64, after the ADDZ line:
Top_Length2, 0, 915,
GOSUB 100
0,180, 4013,
END
0, Top_Width/2, 15,
0, -Top_Width/2, -1
RETURN

The GOSUB command will call our sub-routine at label “100”.


We place a label before the PRISM_ command. A label can be a The END command ends the script. It is needed is because otherwise
number or a text string with a colon after it (e.g., “100:”) the code would again reach the 100: label and execute the commands
The RETURN command tells ArchiCAD that the sub-routine is of the sub-routine again. However, when it reaches the RETURN
finished and it now can return to that line of code that called the command, it would give an error message because the code cannot
sub-routine and continue executing the code from the next line. return anywhere, since it was not called by a GOSUB command.
Sub-routines must be called to be executed. These kinds of scripts are structured such that sub-routines are
usually placed at the end of the script and they are always preceded by
The command used for calling a sub-routine is called GOSUB. an END command.

120 Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide


7. Basics of GDL Scripting – Part 2

19 Activate the 3D View. Notice that this did not modify the We are already familiar with the MULX –1 command, and now the
generated shapes. The lines that generate the shape are advantage of using the sub-routine becomes apparent: we mirror the
executed only once. direction of the x-axis of our Local Coordinate System, and again call
the sub-routine to generate the mirror Tabletop piece. After returning
from the sub-routine, we undo the MULX command with a DEL
command to restore the state of the Local Coordinate System prior to
calling the macro the second time.
21 Activate the 3D View to see the result.

20 Paste three lines of code between the GOSUB and END


lines as follows:
GOSUB 100
MULX -1
GOSUB 100
DEL 1
END The other mirrored Tabletop piece was generated.
For the next task we want to generate the Insert piece in the middle.
22 Copy and paste the following code before the END
statement in the 3D Script:
IF Show_Insert THEN
PRISM_ 5, Thickness_Top,
Insert_Length/2, -Insert_Width/2, 15,
Insert_Length/2, Insert_Width/2, 15,
-Insert_Length/2, Insert_Width/2, 15,
-Insert_Length/2, -Insert_Width/2, 15,
Insert_Length/2, -Insert_Width/2, -1
ENDIF

Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide 121


7. Basics of GDL Scripting – Part 2

23 Select the Show_Insert parameter in the parameter list and


set it to “ON” by clicking in the checkbox in its Value field.

24 Activate the 3D View Window to see the result.

Here we encounter another IF-THEN structure. ArchiCAD will


check the value of the Show_Insert parameter. As you can see in
the parameter list, the Show_Insert parameter is a Boolean type
parameter. It can have two states: ON and OFF. Or, in other words:
YES or NO. Numerically, this translates to “1” for ON or YES, and
“0” for OFF or NO. In formal logic 1 also means TRUE, whereas 0
means FALSE.
The above IF-THEN structure is executed when the condition
Show_Insert is evaluated as TRUE. This happens when the
Show_Insert value is set to ON (or YES or 1). If it is turned OFF
(NO or 0), it will be evaluated as FALSE and the commands after the
IF-THEN line will not be executed. You can now see that the Insert piece has been generated. However,
it now occupies the same place as the other two Tabletop pieces.
In reality we would slide the Top pieces sideways to make room for
the Insert piece. We will do this in GDL.

122 Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide


7. Basics of GDL Scripting – Part 2

25 Find the 100: label in the 3D Script and insert the following 26 Insert the following line of code after the PRISM_ command
code between the 100: label and the beginning of the and before the RETURN command:
PRISM_ command: DEL 1
ADDX Show_Insert * Insert_Length/2

What we need to do first is to move the Tabletop piece along the Since we moved the Local Coordinate System within the sub-routine,
x-axis. We need to do it for both pieces, so we do it in the sub-routine. we need to undo the move.
We need to move it by half the width of the Inset piece for both sides. Hint: It is always a good idea to undo as many coordinate
This is a tricky statement. What it does is take the transformations in the sub-routine as were performed. Otherwise,
Insert_Length/2 value and multiplies it by the value of the Local Coordinate System may move to unexpected places. The
Show_Insert (which is either 0 or 1). The result will be either 0 or idea is to return it to the position it was in before the sub-routine
Insert_Length/2. So, in case the Show_Insert parameter is was called.
OFF, the distance it needs to be moved is zero. If it is ON, the
distance is Insert_Length/2. So this one line of code provides
our solution.

Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide 123


7. Basics of GDL Scripting – Part 2

27 Check the result in the 3D View. 29 Insert the following code after the IF-THEN command and
before the END command in the 3D Script:
DEL 1

The Insert piece is now correctly in the middle and the two top pieces
do not overlap it.
28 Turn the Show_Insert checkbox ON and OFF and check the
results in the 3D View Window. Also, change the Table_Type
parameter and check all combinations of these two
parameters in the 3D View Window.

This step will return the Local Coordinate System to the same
position as the Global Coordinate System, just like before we start
creating the legs of the table.

124 Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide


7. Basics of GDL Scripting – Part 2

30 Save the changes made to the Object.


This concludes this chapter. In the next chapter we will continue
building our Table object, and learn even more about the
programming environment and various commands.

Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide 125


8. Basics of GDL Scripting – Part 3

8. BASICS OF GDL SCRIPTING – PART 3


In this chapter you will continue creating the table you started in
Chapter 7. There will be some new concepts and commands for you
to become familiar with.
You will once again work in the Library Part Editor Window. This
lesson demonstrates the following basic object-making techniques:
• Structuring Scripts for better readability
• Using comments in scripts
• Functions of buttons available in Script Windows
• Using the ADD command in the 3D Script
• Using the POLY2_B command in the 2D Script
• Using status codes in 2D Script commands
• Using the HOTSPOT2 command in the 2D Script 2 Open the “Extension_Table_H98.gsm” file using the “File >
• Using commands (e.g., PRISM_ command) and so-called Status Libraries and Objects > Open Object…” command. You can
Codes to control the visibility of individual surfaces and edges of either continue working in the file you started in Chapter 7 of
Objects in 3D the Guide, or you can open the file from the location of the
“AC Guide GDL Ch 08.pla” file.

8.1 OVERVIEW 3 In the Library Part Editor Window, open the 3D Script
Window.
AC Guide GDL Ch
08_01.mp4
Watch Movie
1 To start the eighth lesson of this interactive, hands-on
ArchiCAD GDL training guide, open the “AC Guide GDL
Ch 08.pla” file. Select the “Read elements directly from
archive” option.

126 Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide


8. Basics of GDL Scripting – Part 3

The next thing we are going to talk about is commenting code for When creating comments it is advisable to place them above the lines
future reference. of code they refer to. Then, when one is trying to understand the
Comments in scripts serve a specific purpose: they give the user a code, he/she will read the comment and immediately know what the
textual description of the code concerning what the various segments following lines of code are expected to do.
of code are actually doing. Make sure to place as many comments as needed so the code will be
The idea behind commenting is that you can provide yourself with easy to understand later, whoever the user may be.
information within the code that enables you to quickly remember or 5 Insert the following lines of code into the 3D Script so the
understand what the code is doing even years after it was originally beginning of the script will look as follows:
written. !Setting Table top Pen and Material properties
4 In the first line of the 3d Script, above the PEN command, PEN Pen_Top
write the following code: MATERIAL gs_top_mat
!Setting Table top Pen and Material properties
!Move vertically to bottom of Table top
ADDZ Leg_Height
!Call subroutine to generate right half of Table
top
GOSUB 100
!Mirror X axis and then
!call subroutine to generate left half of Table
top
MULX -1
GOSUB 100
DEL 1

As you can see, the line starts with the exclamation mark (“!”)
character. This is the sign for comments in GDL Scripts.
Whenever a line starts with the exclamation mark character,
ArchiCAD will consider it a comment line. Comment lines are
skipped by the program when executing the script.
The comment we entered refers to the next two lines of code.
Later, when you or someone else is reading the code, he/she will be
able to quickly understand which portion of the 3D geometry those
lines are related to.

Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide 127


8. Basics of GDL Scripting – Part 3

Obviously, you do not have to comment every single line of code. But 7 At the top of the 3D Script Window you will see five buttons.
the more you comment, the more easily understandable your code Click the leftmost one to comment all selected lines.
will be.
If other people will use your code, you will probably want to
comment more heavily. Other users will not know as much about the
code as you. In this case, commenting can help them understand how
your code is structured.
We also placed empty lines between code segments to increase
readability.
For the last comment segment (starting with !Mirror X), the
comment takes two lines. Note that comment can be any length.
Each new line of comment must start with the exclamation point
character (“!”).
Commenting serves another purpose: when checking how your code
works, you can add comments to turn off (comment out) lines of
code, in which case they will not be executed. This way you can test
how your object behaves with or without certain lines of code. Let us The comment button will place an exclamation mark character at the
try this. beginning of each selected line of code, in effect making them
6 Go to the end of the 3D Script and using your mouse, select comment lines.
the seven lines of code that comprise the PRISM_ command 8 Activate the 3D View Window.
after the 100: subroutine label.

As you can now see, only the insert piece of the Tabletop is generated
in 3D, because we commented out the lines of code responsible for
the generation of the curved Tabletop pieces.

128 Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide


8. Basics of GDL Scripting – Part 3

Hint: When commenting, make sure to comment out every line 11 Click on the “Stop” button to stop the execution of the 3D
belonging to the same command. Otherwise, ArchiCAD will try to Script. Go back to the 3D Script Window and put an
execute the uncommented portions and will give you an error exclamation character back at the beginning of the PRISM_
message because they are non-interpretable without the other lines command.
of code belonging to the same command.
9 Uncomment the first line of the seven lines of code you
commented by removing the exclamation point character
from the beginning.

12 Activate the 3D View Window.

10 Activate the 3D View Window.

As you can see, the program gives an error message. So make sure all
lines belonging to the same command are commented.
Hint: sometimes commands come in pairs and they are not
located next to each other. For example, if you comment an
Now that all lines of the command are either all commented or all
IF-THEN line then you should also comment the ENDIF line
uncommented, no error messages are sent by the program.
belonging to that IF-THEN command.

Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide 129


8. Basics of GDL Scripting – Part 3

13 Select all seven commented lines and click the uncomment


button at the top of the 3D Script Window (second button
from the left).

Here, the lines containing the parameters of the PRISM_ command


are indented one TAB position from the position of the PRISM_
keyword. It is easy to see that they belong to that keyword.
Also, the entire PRISM_ command and all its lines of code
containing parameters are indented one TAB position from the
positions of the IF and ENDIF commands. This way you can easily
As you can see, the Comment and Uncomment buttons at the top of see which lines belong within the IF clause without having to search
the 3D Script Window can be used to comment/uncomment large too much for them. This is especially useful when the codes are long
portions of code. and won’t fit the 3D Script Window.
The next two buttons at the top are the “Indent” and “Remove 14 Select the five indented lines of the PRISM_ command.
Indent” buttons. The purpose of these is to indent selected lines by
one TAB position, or undo such indentations from selected lines.
Indentation is another useful feature you can use to make code more
readable. For example, lets look at the following portion of the 3D
Script:
IF Show_Insert THEN
PRISM_ 5, Thickness_Top,
Insert_Length/2, -Insert_Width/2, 15,
Insert_Length/2, Insert_Width/2, 15,
-Insert_Length/2, Insert_Width/2, 15,
-Insert_Length/2, -Insert_Width/2, 15,
Insert_Length/2, -Insert_Width/2, -1
ENDIF

130 Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide


8. Basics of GDL Scripting – Part 3

15 Click on the “Remove Indent” button at the top of the 3D If the Script is correct, the following message is displayed.
Script Window and observe that the selected lines move back
one TAB position to the left.

Should there be any problems, the error message that appears will
help you easily fix the mistakes.
17 Insert the following comments into the 3D Script so it
becomes fully commented:
!Generate Insert piece of Table top
!depending on the value of Show_Insert
IF Show_Insert THEN
PRISM_ 5, Thickness_Top,
Insert_Length/2, -Insert_Width/2, 15,
Insert_Length/2, Insert_Width/2, 15,
16 With the lines still selected, click the Indent button to restore -Insert_Length/2, Insert_Width/2, 15,
the previous state. -Insert_Length/2, -Insert_Width/2, 15,
Insert_Length/2, -Insert_Width/2, -1
ENDIF

!Undo the transformation at the beginning


!before placing the Legs
DEL 1
END

!Generate the curved Table top half


100:
!Move it in the X direction if the Insert piece
!is set to be shown, so the Insert piece fits in
the middle
ADDX Show_Insert * Insert_Length/2

The last button at the top of the Script Window is the “Check Script”
button. When pressed, it will check the Script in its current state and
report if it has found any problems.

Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide 131


8. Basics of GDL Scripting – Part 3

!Generate the curved part


PRISM_ 6, Thickness_Top,
8.2 CREATING THE LEGS
0, -Top_Width/2, 15, AC Guide GDL Ch
Top_Length2, -Top_Width/2, 15+64, 08_02.mp4
Top_Length2, 0, 915, Watch Movie
0, 180, 4013,
0, Top_Width/2, 15, It is now time to create the scripts that will generate the legs for us.
0, -Top_Width/2, -1 1 Open up the “AC Guide GDL Chapter 08” folder in the View
DEL 1 Map of the Navigator palette and activate (by
!Return from the subroutine to the calling line double-clicking) the “8.1 Leg geometry” saved view in the
RETURN “Chapter 8” folder.

This is how the so-called H-leg of the Table will look. Dimensions are
shown in millimeters.
There will be four of these legs generated and we will create them the
same way we generated the curved Tabletop pieces. We’ll create a
sub-routine at the end of the 3D Script that will generate the
geometry. We’ll manipulate the coordinate system with MUL X and
MUL Y commands and call the sub-routine to generate the part.

132 Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide


8. Basics of GDL Scripting – Part 3

You can see the Local Origin of the Leg Profile in the ArchiCAD 3 Activate (by double-clicking) the “8.3 Leg Geometry-2”
View. This is the point to which the Local Coordinate System must be saved view in the “Chapter 8” folder in the View Map of the
moved before generating the Leg piece. Navigator.
2 Activate (by double-clicking) the “8.2 Leg Origin Location”
saved view in the “Chapter 8” folder in the View Map of the
Navigator.

Here you can see the points we are going to generate for the Leg
piece.
The dimensions shown here are in millimeters.
We have two variables in the Master Script of the Object which will
help move the Local Origin to the correct location. These are
Leg_Origin_X and Leg_Origin_Y.

Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide 133


8. Basics of GDL Scripting – Part 3

4 Go to the Editor Window of the Table object and open the 3D


Script Window.

We have created a sub-routine at label 200:. There is a comment


before the label describing what the sub-routine does.
5 At the end of the 3D Script, write (or paste from here) the We have a PRISM_ command after the label. It has eleven points in
following lines of code: all. The height of the PRISM_ equals the value specified by the
Leg_Height parameter.
!Generate one Leg
200: All the status codes you see in this command (15+64, 915,
PRISM_ 11, Leg_Height, 4013, -1) have been discussed in the previous chapter: you can
0, 0, 15, refer to that chapter in case you need further explanation of these
0, .025, 15+64, status codes.
-.015, .025, 915, The sub-routine is finished by the RETURN command, as usual.
0, 180, 4013, Now that we have created the subroutine, let us create the code that
-.03, -.015, 15+64, will call it.
-.015, -.015, 915,
0, 90, 4013, 6 Find the END command in the 3D Script and enter or paste
.025, -.03, 15+64, the following lines of code after it:
.025, -.015, 915, !Set leg attributes
0, 180, 4013, PEN Pen_Leg
0, 0, -1 MATERIAL gs_leg_mat
RETURN

134 Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide


8. Basics of GDL Scripting – Part 3

This is how we call the subroutine located at label 200 to create a leg
for the first time.
8 Activate the 3D View Window.

Here we set the attributes (view pen and material) for the legs we are
about to generate.
7 After the previous lines of code, enter the following (this As you can see the Leg is generated, but not at the correct location.
should also go after the END command in the code): So we need to move the Local Coordinate System to the correct
location.
!Create upper right leg
GOSUB 200 9 Find the 200: label toward the end of the 3D Script and place the
following line of code below it, before the PRISM_ command:
ADD Leg_Origin_X, Leg_Origin_Y, 0

Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide 135


8. Basics of GDL Scripting – Part 3

10 Activate the 3D View Window to see the result of the change.

This is a command that is similar to ones we used before (ADDX, The upper right leg is now in place.
ADDY, ADDZ). However, the leg is in its right place only if there is no Inset piece in
The benefit of the ADD command is that it does in one step that the middle. Recall the ADDX command we placed at the 100: label
which is otherwise done in many steps. The ADD command shifts the that shifted the position of the Tabletop piece when there is an Insert
location of the Local Coordinate System in x, y and z directions in piece.
one step. The three parameters it uses are the values by which the 11 Modify the line you just entered as follows:
Local Coordinate System should be shifted along the x, y and z-axes, ADD Show_Insert * Insert_Length/2 +
respectively. Leg_Origin_X, Leg_Origin_Y, 0
So, the following code:
ADDX x
ADDY y
ADDZ z
Can be substituted by this:
ADD x, y, z
In this case, the command shifts the Local Coordinate System to the
location of the Leg piece (as seen in the “8.2 Leg Origin Location”
saved View).

136 Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide


8. Basics of GDL Scripting – Part 3

13 Turn the Show_Insert parameter ON and OFF, and activate


the 3D View each time to see how it affects the position of
the Leg. After you are finished, turn the Show_Insert
parameter back ON.

The Local Coordinate System for the Leg is shifted in the x-direction
by Leg_Origin_X, and it is additionally shifted by
Show_Insert * Insert_Length/2 when there is an Insert 14 Place the following command before the RETURN
piece added. command of the sub-routine:
12 Activate the 3D View Window to see the result of the change. DEL 1

Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide 137


8. Basics of GDL Scripting – Part 3

Since we shifted the coordinate system in the sub-routine with the What we basically do to create the upper left leg is mirror the x-axis
ADD command, we need to undo it before returning from the of the Local Coordinate System, then call the sub-routine to generate
sub-routine. the Leg. We then undo the coordinate transformation.
15 Insert the following lines of code before the END command 16 Activate the 3D View Window to see the result.
in the 3D Script:
!Create upper left leg
MULX -1
GOSUB 200
DEL 1

138 Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide


8. Basics of GDL Scripting – Part 3

17 Insert the following lines of code before the END command 18 Activate the 3D View Window to see the result.
in the 3D Script:
!Create lower right leg
MULY -1
GOSUB 200
DEL 1

The lower right leg is now generated.


19 Right-click into the 3D View Window and select the “3D
Projection Settings” item from the menu that appears.

Here we mirrored not along the x, but along the y-axis before calling
the sub-routine.

Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide 139


8. Basics of GDL Scripting – Part 3

20 Select the “Top View projection” type from among the 21 Select the “View > 3D View Mode > Wireframe” menu item.
“Select Projection Type” buttons, and click the “OK” button
to accept the change.

The Table is now shown in Wireframe Mode in the3D View Window,


We now see the Table from the top. so we can see the Legs. Now you can see why it was useful to have the
Local Origin of the whole table at the center of the Table. Now we
only need to mirror the axes before calling the sub-routine for the
legs to be placed at the correct location.
Viewing your 3D Model in Wireframe Mode can be helpful when
checking to see whether the parts are generated in the desired
position.
You can also read off coordinates from the Coordinate Box (you can
enable its Palette if it is not visible) to check their positions.
22 Go back to the 3D Script Window and insert the following
lines of code before the END command:
!Create lower left leg
MULX -1
MULY -1
GOSUB 200
DEL TOP

We will now check to see whether the lower right leg is placed in the
correct position.

140 Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide


8. Basics of GDL Scripting – Part 3

24 Set the 3D View back to Dimetric Axonometry and Hidden


Line View.

For the lower left leg, we need to mirror along both the x and the
y-axes for the Local Coordinate Axes to be in the right position. The 3D view of our Table is now complete.
23 Activate the 3D View Window to see the result.
8.3 CREATING THE 2D SCRIPT
AC Guide GDL Ch
08_03.mp4
Watch Movie
Now we’ll start creating the 2D Script for the Table.
1 Open the 2D Script in a separate Window by clicking on its
button in the Editor Window.

Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide 141


8. Basics of GDL Scripting – Part 3

2 Insert the following lines into the 2D Script: The POLY2_B command creates a filled polygon. Both the
PEN gs_cont_pen individual edges of the polygon and its fill can be set to be displayed
FILL gs_fill_type or hidden.
The POLY2_B command is similar to the PRISM_ command,
especially given the triplets defining the coordinates and their status.
The n parameter specifies the number of points of the polygon.
The frame_fill parameter is used to define how the fill is drawn.
The fill_pen parameter defines the pen used to draw the Fill’s
We are already familiar with the PEN command. The FILL pattern.
command sets the Fill type to be used in commands used in
subsequent commands (where it applies). The fill_background_pen parameter defines the pen used to
draw the Fill’s background color.
As you can see, we used the gs_cont_pen and gs_fill_type
default parameters as defined in the Table subtype to standardize the The x1, y1, s1, etc., triplets define the x and y-coordinates of the
object as much as possible. individual points of the fill polygon and their status.
3 Open the GDL Reference Guide by clicking on the “Help > The frame_fill parameter is the composite of several values that
ArchiCAD GDL Reference Guide” menu item. are added together to produce the final value of the parameter:
4 Find the description of the POLY2_B command on Page 120 1: When you want the contour to be drawn, this value should be
of the Reference Guide. Select the command syntax and copy added for the final value.
it to the Clipboard. 2: Add this value if you want to draw the fill of the POLY2_B
element.
4: Adding this value ensures that the polygon is closed in case its last
specified in point is not the same as its first point.
32: As default, the Fill Type of all fills is “Drafting Fill”. Add this
value if you want the fill created by this command to be a “Cut Fill”.
5 Paste the command syntax at the end of the 2D Script. 64: Add this value if you want the fill created by this command to be a
POLY2_B n, frame_fill, fill_pen, “Cover Fill”. It only has an effect when the 32 value is not used.
fill_background_pen, There are some additional values for the frame_fill parameter
x1, y1, s1, ..., xn, yn, sn but we do not need them at this point.

142 Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide


8. Basics of GDL Scripting – Part 3

6 Go to the Floor Plan, and activate (by double-clicking) the


“8.4 2D Script variables” saved view in the “Chapter 8” folder
in the View Map of the Navigator.

The Fill created by this POLY2_B command has eight points.


The 7+64 (1+2+4+64) value for the frame_fill parameter
means that we want i) the contour to be shown, ii) the fill pattern to
be shown as well, iii) the polygon to be closed, and iv) our Fill to be a
We are going to use the same parameters and variables for the 2D of Cover Fill (64).
the Table that we used for its 3D. The Fill’s pattern will be drawn with the pen defined by the
We will need to create two cases in 2D as well: one for when there is gs_fill_pen default parameter, and the Fill’s background will be
no Insert piece in the middle, and one for when there is. completed with the gs_back_pen default parameter. Note that we
We will accomplish this with an IF-THEN structure. again used default parameters as defined in the Table subtype.
First, let us create the case when there is an insert piece. In the lines defining the points, the first two parameters are the x and
y-coordinates of the given point, while the last is the status value.
7 Go back to the Library Part Editor Window, activate the 2D
Script and modify the POLY2_B command syntax as follows: The values are similar to those of the PRISM_ command. Of the
possible values, we will choose the “1” value. Use “1” if you want the
POLY2_B 8, 7+64, gs_fill_pen, gs_back_pen, edge going from the given point to the next point to be visible, or
0, -Top_Width/2, 1, leave it as “0” if you want it hidden.
Insert_Length/2 +
Top_Length2,-Top_Width/2, 1, Hint: note that while you can use the frame_fill parameter to
Insert_Length/2 + Top_Length2, 0, 901, show or hide the contour of the fill altogether, you can use the
0,180, 4001, status values to show or hide individual edges. Obviously, the
-Insert_Length/2 - Top_Length2, status values will work only if frame_fill is set so that the
Top_Width/2, 1, contour is visible.
-Insert_Length/2 - Top_Length2, 0, 901, These status codes can also use special additional status codes like
0,180, 4001, 900 for defining the center of an arc or 4000 for drawing an arc
0, -Top_Width/2, -1 based on a center point, radius and angle.

Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide 143


8. Basics of GDL Scripting – Part 3

At the second point you can see that the x-coordinate is We evaluate the value of the Show_Insert parameter just like in
Insert_Length/2 + Top_Length2, that is, half of the the 3D Script. However, there is a new element in the structure. It is
Insert piece is added when there is an Insert piece present. the ELSE keyword.
We will now create the IF-THEN structure. The structure is the following:
8 Place the following lines before and after the POLY2_B IF <condition> THEN
command as follows: <command if true>
IF Show_Insert THEN ELSE
POLY2_B 8, 7+64, gs_fill_pen, gs_back_pen, <command if false>
0, -Top_Width/2, 1, ENDIF
Insert_Length/2 + The ELSE keyword lets you define what you want the program to do
Top_Length2,-Top_Width/2, 1, in case the condition is not met.
Insert_Length/2 + Top_Length2, 0, 901, The normal IF-THEN structure is used if you want to perform a
0,180, 4001, certain command when a condition is met. The ELSE variation is
-Insert_Length/2 - Top_Length2, used when you want to perform either one of two sets of commands
Top_Width/2, 15, depending on the value of the condition.
-Insert_Length/2 - Top_Length2, 0, 901, In our case we want to generate a different geometry for when there
0,180, 4001, is an Insert piece (Show_Insert = 1), and another for when
0, -Top_Width/2, -1 there is no Insert piece.
ELSE

ENDIF

144 Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide


8. Basics of GDL Scripting – Part 3

9 Insert the following code segment between the ELSE and 10 Select each of the POLY2_B commands and all the code
ENDIF lines: lines belonging to them and indent them one TAB position.
POLY2_B 8, 7+64, gs_fill_pen, gs_back_pen,
0, -Top_Width/2, 1,
Top_Length2,-Top_Width/2, 1,
Top_Length2, 0, 901,
0,180, 4001,
-Top_Length2, Top_Width/2, 1,
-Top_Length2, 0, 901,
0,180, 4001,
0, -Top_Width/2, -1

With this, the code is more readable and it is clear that these
commands belong within the IF-THEN command structure.

The only difference between this and the other POLY2_B command
is that the x-coordinates are not shifted by the
Insert_Length/2 value in the appropriate places.

Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide 145


8. Basics of GDL Scripting – Part 3

11 Activate the 2D Full View Window and check the 2D of the 13 Find the code syntax for the HOTSPOT2 command on Page
Table. 117 of the GDL Reference Guide.
HOTSPOT2 x, y [, unID [, paramReference,
flags][, displayParam]]

As you can see, all parameters except for the first two are in
parentheses, meaning they are optional. We will not deal with those.
HOTSPOT2 x, y
In its simplest form the HOTSPOT2 command is used to generate a
Hotspot into the 2D of the Object.
If there are no Hotspots generated for an Object in its Script, there
12 Switch the Show_Insert parameter ON and OFF to see how are five default hotspots generated by ArchiCAD at the four corners
the 2D changes based on its value. When you are finished, of the enclosing rectangle of the Object’s geometry and at the center
switch the parameter back ON. of that enclosing rectangle.
If there are Hotspots defined then the program does not have to
create them.
We will place Hotspots at several special points of the Table’s 2D, so
we can select with these positions or later snap the Object with these
positions.

We will now place Hotspots on the 2D of the Table.

146 Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide


8. Basics of GDL Scripting – Part 3

14 Go back to the 2D Script of the Object and place the 15 Check the 2D Full View Window for the result.
following lines of code above the line containing the ELSE
keyword:
HOTSPOT2 Insert_Length/2 + Top_Length2, 0
HOTSPOT2 Insert_Length/2 + Top_Length2,
Top_Width/2
HOTSPOT2 Insert_Length/2 + Top_Length2,
-Top_Width/2
HOTSPOT2 -Insert_Length/2 - Top_Length2, 0
HOTSPOT2 -Insert_Length/2 - Top_Length2,
Top_Width/2
HOTSPOT2 -Insert_Length/2 - Top_Length2,
-Top_Width/2
HOTSPOT2 Insert_Length/2 + Top_Length, 0
HOTSPOT2 -Insert_Length/2 - Top_Length, 0

We have placed hotspots at the centers of the curves and at the


quarter points of the curves: eight hotspots in all.
This gives us hotspots in case there is an Insert piece. Now we need
to make the same hotspots for when there is no Insert piece.
16 Insert the following lines of code before the ENDIF
command in the 2D Script.
HOTSPOT2 Top_Length2, 0
HOTSPOT2 Top_Length2, Top_Width/2
HOTSPOT2 Top_Length2, -Top_Width/2
HOTSPOT2 -Top_Length2, 0
HOTSPOT2 -Top_Length2, Top_Width/2
HOTSPOT2 -Top_Length2, -Top_Width/2
HOTSPOT2 Top_Length, 0
HOTSPOT2 -Top_Length, 0

Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide 147


8. Basics of GDL Scripting – Part 3

Just as in the case of the Master Script, there are certain hotspots we
want to define that are located at the same place regardless of the
value of the Show_Insert parameter.
We place these after the whole IF-THEN structure to ensure they
will always be executed.
18 Insert the following lines of code after the ENDIF command
in the 2D Script.
HOTSPOT2 0, 0
HOTSPOT2 0, Top_Width/2
HOTSPOT2 0, -Top_Width/2

17 Switch off the Show_Insert parameter and check the 2D Full


View Window for the result.

With this we create three additional hotspots at the middle, the top
middle and the bottom middle of the Table.

148 Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide


8. Basics of GDL Scripting – Part 3

19 Activate the 2D Full View Window to see the result. 8.4 TESTING THE COMPLETED OBJECT
1 Go back to the Floor Plan Window of your Project.
2 Activate the Object Tool and go into its Settings Dialog. The
“Extension_Table_H98.gsm” Object will be shown.

With this step we are finished with the geometry.


As an additional optional step, you can take your 2D Script, and based
on what you learned about the 3D Script, place comments in it. You
can use the “Indent” and “Remove Indent” features and by placing
empty lines you can organize the look of the 2D Script for better
readability.
20 Save the completed Object.

Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide 149


8. Basics of GDL Scripting – Part 3

3 In the Parameters panel, modify the various parameters 4 Switch the Preview Window to show a shaded 3D
related to the object’s Type, Insert Piece and 2D Axonometry, and modify the various parameters related to
Representation and see how its 2D View is updated. the object’s Type, Insert Piece, 3D Representation and
Material, and see how its 3D View is updated.

This completes this chapter of the Interactive Training Guide.

150 Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide


9. Advanced GDL Scripting

9. ADVANCED GDL SCRIPTING


This chapter presents some more concepts and commands for you to 2 Open up the “AC Guide GDL Chapter 09” folder in the View
get familiar with. Map of the Navigator palette and activate (by
You will again work in the Library Part Editor Window. This lesson double-clicking) the “9.1 Door Side View” saved view in the
demonstrates the following object-making techniques: “Chapter 9” folder.
• Controlling the possible range of values
• Hiding parameters in the parameter list using the
HIDEPARAMETER command
• Creating Doors in GDL
• Using the WALLHOLE command to cut non-rectangular holes in walls
• Using Macros in GDL
• Using the RECT2 command in the 2D Script
• Creating scale-dependent 2D for objects

9.1 OVERVIEW
AC Guide GDL Ch
09_01.mp4
Watch Movie
1 To start the ninth lesson of the ArchiCAD GDL training Here you can see the Door we are going to create.
guide, open the “AC Guide GDL Ch 09.pla” file. Select the The Door is pentagon-shaped. The two upper edges of the pentagon
“Read elements directly from archive” option. meet at 45 degrees. There is a glass inset within the Door Panel. The
shape of the inset is a square, at equal distances from the two upper
edges of the frame.
There is also a small rectangular hole toward the bottom of the Door
for ventilation purposes.
The Door will have a Handle on both sides. The Handle will have
various styles selectable or it can be turned OFF.
On the 2D side, we will create a 2D View which will have varying
levels of detail depending on the scale set for the Floor Plan Window.

Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide 151


9. Advanced GDL Scripting

9.2 CREATING THE PARAMETERS 3 Select “General GDL Object > Model Element > Opening >
Wall Opening > Door (Wall)” in the hierarchy, and click the
AC Guide GDL Ch “Select” button.
09_02.mp4
Watch Movie
1 Choose the “File > Libraries and Objects > New Object…”
menu command.
2 Click the “Select Subtype…” button in the Library Part
Editor Window to bring up the Subtype Hierarchy Dialog.

The default parameter list of the Object has changed to that of a


Door.

152 Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide


9. Advanced GDL Scripting

We are going to use many of the default parameters of the Door


subtype and we will also create some of our own.
4 Choose the “File > Save as…” command to save the file.
Give it the name “Pentagonal_Door.gsm” in the Save Dialog, Here you can see the variables and measurements we are going to use
and click “OK” to save it to a location of your choice. for the Door Frame. Here is the list of parameters and variables and
what they will be used for:
5 Go back to the Floor Plan and activate (by double-clicking) Parameter/Variable Purpose
the “9.2 Door Variables” saved view in the “Chapter 9” folder name
of the View Map of the Navigator. A Width of Door
B Height of Door
gs_frame_width Frame thickness of Door
Side_Height Height of vertical portion of frame on sides
Side_Height_In Height of vertical portion of inside of frame
side on sides
Frame_Y Vertical component of frame width

The first three items are parameters.

Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide 153


9. Advanced GDL Scripting

The last three are variables the values of which we will create Here you can see those parameters and variables that are going to
formulas for at the beginning of the 3D Script. These are values we affect the Glass inset of the Door Panel.
will need to use when creating the geometry of the Frame. Since Parameter/Variable Purpose
some of them have complicated formulas, it is better to assign their name
values to new variables and use that variable in the code instead of
always entering the formula of the variable. Panel_Border Width of panel around Glass
6 Activate (by double-clicking) the “9.3 Glass Variables” saved Panel_Border_Y Vertical component of Panel_Border
view in the “Chapter 9” folder of the View Map of the Glass_Y Horizontal/Vertical dimension of half the
Navigator. Glass measured from center of Glass
Glass_Center_Y Vertical position of center of Glass

Panel_Border is a parameter that we will be able to set to any


desired value.
The other three variables will be calculated from the other
dimensions of the Door.
7 Go back to the Library Part Editor Window.
We are now going to create the parameters necessary for our Door.
The following parameters are to be created:
Variable Type Name Value
_Glass Title Glass
Panel_Border Length Border of panel around 100
Glass
Glass_Thk Length Glass Thickness 10
Glass_Pen Pen Glass Pen 6
Glass_Mat Material Glass Material 24
Handle_Style Integer Handle Style 0
Handle_Mat Material Handle Material 44
Handle_Acc_Mat Material Handle Accessory Material 40

154 Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide


9. Advanced GDL Scripting

For the “Handle_Style” parameter, we switch the Bold toggle ON to The “Glass_Thk” parameter defines the thickness of the Glass in the
indicate that this parameter is used to denote a title for a set of Door Panel. The “Glass_Pen” parameter specifies the View Pen of
parameters (the reason we did not use the more obvious “Title” the Glass in 3D, and the “Glass_Mat” parameter determines the
parameter type is because we want it to be able to take values, material used on the Glass surface.
something the “Title” parameter type cannot do). The “Handle_Style” parameter will specify what kind of handle will
For all parameters except “_Glass” and “Handle_Style”, switch the be used for the Door. There are two kinds of material used in
subordinate toggles ON so they will become the subordinate Handles: the “Handle_Mat” and “Handle_Acc_Mat” parameters
parameters belonging to their respective title parameters. specify the materials for these.

Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide 155


9. Advanced GDL Scripting

8 One by one, drag all the parameters in the list so they will be The Door cut out a hole from the Wall in 2D but since there is no 2D
positioned above the “ac_details” title parameter, while Script written for the Door yet, nothing is displayed.
retaining their positions relative to one another. The reason we placed the Door into a Wall is because we will need to
know the thickness of the Wall later while previewing our Door in the
Library Part Editor Window. We will use a variable there that returns
the thickness of the Wall the Door is placed into, but for it to work
correctly in the Library Editor, at least one Door must be placed into
a Wall.

9.3 CREATING THE PARAMETER SCRIPT


AC Guide GDL Ch
09_03.mp4
Watch Movie
1 Go back to the Library Part Editor Window and click on the
“Parameter Script Window” button to open the Parameter
Script in a separate Window.

9 Save the Door object using the “File > Save” menu
command. 2 Type or copy-paste the following lines into the Parameter
10 Go back to the Floor Plan and activate (by double-clicking) Script:
the “9.4 Door Placement” saved view in the “Chapter 9” VALUES "Handle_Style" 1, 2, 3, 4, 5, 6, 7, 8,
folder of the View Map of the Navigator. 9, 10, 11, 12, 13, 14, 15, 0

11 Select the Door Tool. Make sure the “Pentagonal Door.gsm”


object is selected in the Info Box. Place the Door into the
Wall in the middle of the Floor Plan screen. We are already familiar with the VALUES command of GDL. We will
create the possible values for the Handle_Style parameter. You
will study why values “0” through “15” are available later in this
chapter. When the value of Handle_Style is “0” it means that
there is no handle for the Door.

156 Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide


9. Advanced GDL Scripting

3 Type or copy-paste the following lines into the Parameter


Script:
VALUES "gs_frame_thk", RANGE (, WALL_THICKNESS]

The STEP keyword is an additional option, which we are not going


Here we again have a VALUES command, but with some new to use now, so we only need the following part of the syntax:
parameters. The first novelty is the RANGE keyword.
RANGE left_delimiter [expression1], [expression2]
The RANGE keyword lets you limit the range a parameter can take. right_delimiter
For example, with this line of code we want to limit the thickness of A RANGE keyword is followed by a maximum of five items: a left
the frame to the thickness of its enclosing Wall, meaning we never delimiter, an optional expression, a comma, another optional
want the frame of the Door to be greater than the thickness of the expression and a right delimiter.
Wall into which it was placed.
The left_delimiter is either the “[” character, or the “(”
4 Click the “Help > ArchiCAD GDL Reference Guide” menu character. The former means greater than or equal, the latter means
item. greater than.
Expression1 is optional. If it is given, it will be the lower limit for
the value the parameter can take. If it is not given, there will be no
lower limit. Expression1 can be a value, parameter, variable or
numerical expression.
Examples:
[1 means that the value of the parameter must be 1 or greater
5 Find the VALUES command on Page 183 of the Guide. Copy (1 means that the value of the parameter must be greater than 1
the RANGE command syntax from the PDF file and paste it The comma is always required.
at the bottom of the Parameter Script:
Expression2 is also optional. If it is given, it will be the upper
RANGE left_delimiter [expression1], limit for the value the parameter can take. If it is not given, there will
[expression2] be no upper limit. Expression2 can also be a value, parameter,
right_delimiter [STEP step_start_value, variable or numerical expression.
step_value]
The right_delimiter is either the “]” character, or the “)” character.
The former means less than or equal, the latter means less than.
Examples:
5] means that the value of the parameter must be 5 or less
5) means that the value of the parameter must be less than 5

Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide 157


9. Advanced GDL Scripting

Hint: although both expressions are optional, at least one of them For example, there are Global Variables that provide data about Walls.
should be specified, because otherwise no limit is set, in which Door and Window objects can inquire and make use of this data
case one should not use the RANGE keyword in the first place. about their enclosing Walls.
Examples: The WALL_THICKNESS variable always returns the thickness of the
(8, 15)8 < x < 15 Wall into which the Door/Window is placed.
[8, 15)8 <= x < 15 With the VALUES command shown above we want to limit the
(8, 15]8 < x <= 15 maximum thickness of the Door Frame to the thickness of the Wall
[8, 15]8 <= x <= 15 into which it is placed.
[, 15] x <= 15 You can find the list of Global Variables on Page 223 of the
[, 15) x < 15 ArchiCAD GDL Reference Guide.
(8,) 8 < x
[8,) 8 <= x
The RANGE expression can take the place of the list of values in the
VALUES command.
Going back to the original expression written in the Paramater Script:
VALUES "gs_frame_thk", RANGE (, WALL_THICKNESS]
The command means that:
gs_frame_thk <= WALL_THICKNESS
This is so because there is no value, parameter, variable or numerical
expression between the left delimiter and the comma.
The variable WALL_THICKNESS is between the comma and the
right delimiter “]”, so gs_frame_thk must be less than or equal
to WALL_THICKNESS.

The next question is: what is this WALL_THICKNESS variable?


WALL_THICKNESS is a so-called Global GDL Variable. Global
Variables are special variables within GDL that hold specific values
related to GDL or the Project environment, or related to various
elements that interact with the GDL object during its generation.
There are variables that provide information about that state of the
Project, about Stories, and other general information.
There are many Global Variables that give data about the specific
instance of the GDL Library Part in which they are used and other 6 Delete the RANGE command syntax from the Parameter
ArchiCAD elements with which the GDL Library Part is interacting. Script.

158 Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide


9. Advanced GDL Scripting

The WALL_THICKNESS global variable has a non-zero value only


when at least one Door is actually placed into a Wall. That is why we
had to place a Door. Now we can see the possible range for the
gs_frame_thk parameter.
Since the value of the Wall is 300 millimeters, the value of the
parameter must be less than or equal to 300 millimeters.
7 Type or copy-paste the following lines into the Parameter Script:
9 Select the “gs_leaf_thk” parameter. Click on the
VALUES "gs_leaf_thk", RANGE (, gs_frame_thk] right-pointing arrow in its Value column.

With this command we specify another range for the


gs_leaf_thk parameter: we limit it so than it can take values that
are less than or equal to the gs_frame_thk parameter. We do not
set a lower limit for it.
8 Go back to the parameter list and select the gs_frame_thk
parameter. Click on the right-pointing arrow in its Value
column.
As you can see, the following are the possible values:
<= 100
This is so because the current value of “gs_frame_thk” is 100.
10 Select the “gs_frame_thk” parameter and modify its value to
“80”, then again select the “gs_leaf_thk” parameter and click
on the right-pointing arrow in its Value column.

You can see the following for possible values:


<= 300
The reason we placed the Door into a Wall is because we used the
thickness of the enclosing Wall to limit the value of the
gs_frame_thk parameter.

Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide 159


9. Advanced GDL Scripting

Here we see a new command called HIDEPARAMETER.


The HIDEPARAMETER command does a simple execution: it hides
the specified parameters in the list of parameters in the Library Part
Settings Dialog (in our case, the Door Settings Dialog).
You can see the following for possible values:
This can be useful when we have many parameters. There is limited
<= 80 space available in the Settings Dialog for the display of parameters.
As you can see, the upper limit for the “gs_leaf_thk” value changed Organizing parameters into groups with the Title and Subordinate
according to the value change made to the “gs_frame_thk” features is one way of saving space. We covered that earlier.
parameter.
Another method is to simply hide those parameters that are not used.
11 Select the “gs_frame_thk” parameter and change its value
back to 100. For example, the command shown above hides the Handle_Mat
and Handle_Acc_Mat parameters when Handle_Style
equals zero. If Handle_Style equals zero, it means that there is
no Handle generated for the Door. In such a case we do not need to
specify Handle materials, so these parameters can be hidden.
13 Save the Door object using the “File > Save” menu
command.
14 Go back to the Floor Plan and click on the Door to select it.
Go to its Settings Dialog.

12 Go to the Parameter Script and type or copy-paste the


following code at its end:
IF Handle_Style = 0 THEN
HIDEPARAMETER "Handle_Mat", "Handle_Acc_Mat"
ENDIF

160 Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide


9. Advanced GDL Scripting

As you can see in the Parameters panel, the value of the “Handle The right-pointing arrow appeared. If you click it, it will reveal the
Style” parameter is 0, and there is no right-pointing arrow to the left two subordinate Handle material parameters, and you can set their
of the name of the parameter to signify that it has subordinate values.
parameters (“Handle_Mat” and “Handle_Acc_mat”). The command we wrote in the Parameter script hides these two
15 Modify the value of the “Handle Style” parameter from its values only when the “Handle Style” parameter is set to “0”;
value list to any other value. otherwise they will be shown.
We are now finished with the Parameter Script.
16 Leave the Door Settings Dialog by clicking the Cancel
button.

Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide 161


9. Advanced GDL Scripting

9.4 CREATING THE 3D SCRIPT


AC Guide GDL Ch
09_04.mp4
Watch Movie
1 Go back to the Library Part Editor, and click on the 3D
Script View Window to open it in a separate window.

2 Type or copy-paste the following lines into the 3D Script:


!Setting used variable values
Frame_Y = SQR(2) * gs_frame_width
Side_Height = B - A/2
Side_Height_Inside = B - Frame_Y - (A/2 - Here you can see the values, parameters and variables that we will
gs_frame_width) need to create the Door Panel with the Glass in it.
4 Go back to the Library Part Editor, and type or copy-paste
the following lines into the 3D Script:
Panel_Border_Y = SQR(2) * Panel_Border
Glass_Y = A/2 - gs_frame_width - Panel_Border
Glass_Center_Y = B - Frame_Y - Panel_Border_Y -
Glass_Y

Here we start defining the variables we need for the creation of the
Door Frame. You can refer to the “9.2 Door Variables” saved view to
see what dimensions these variables refer to.
3 Go to the Floor Plan and activate the “9.3 Glass Variables”
saved view in the “Chapter 9” folder of the View Map of the
Navigator.

With this we are defining the values of the variables needed for the
Glass.
Now we can start creating the Door.

162 Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide


9. Advanced GDL Scripting

5 Go to Page 261 in the ArchiCAD GDL Reference Guide, and 7 Type or copy-paste the following lines into the 3D Script:
check the illustration there. PRISM_ 11, gs_frame_thk,
A/2 - gs_frame_width, 0, 15,
A/2, 0, 15,
A/2, Side_Height, 15,
0, B, 15,
-A/2, Side_Height, 15,
-A/2, 0, 15,
-A/2 + gs_frame_width, 0, 15,
-A/2 + gs_frame_width, Side_Height_Inside, 15,
0, B - Frame_Y, 15,
A/2 - gs_frame_width, Side_Height_Inside, 15,
A/2 - gs_frame_width, 0, -1

The illustration shows how you need to create your Doors/Windows


in GDL. The main point is that you need to write your GDL as if the
Door/Window was placed into a Wall that is lying on its side. What
you create in GDL for a Door/Window will be rotated around its
x-axis in ArchiCAD when it is placed into a Wall. To put it in another
way, what you see as a Top View of a Door/Window in the Library
Part Dialog will become the elevation of the Door/Window when it
is placed into a Wall. Keep this in mind when creating these objects.
6 Type or copy-paste the following lines into the 3D Script:
!Setting Frame attributes and generating frame
PEN gs_frame_pen
MATERIAL gs_frame_mat

This will generate the Door Frame for us. You can refer to the “9.2
Door Variables” saved View to check the coordinates of each point
of the PRISM_.
Hint: Note that we used the default parameters gs_frame_thk
and gs_frame_width, plus we used the variables
Side_Height, Side_Height_Inside and Frame_Y we defined
at the beginning of the Script.
Hint: Also note that we generated the Door Frame so that its
Here we set the PEN and MATERIAL attributes for the Door Frame. width is symmetrical along its y-axis. Refer to the illustration on
Notice that we are using default parameters derived from the subtype. Page 252 of the GDL Reference Guide. The Door/Window

Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide 163


9. Advanced GDL Scripting

should always be created this way because the hole ArchiCAD cuts 10 Type or copy-paste the following lines into the 3D Script:
for the Door/Window is also generated this way. PRISM_ 16, gs_leaf_thk,
8 Activate the 3D View Window to see the result. A/2 - gs_frame_width, 0, 15,
A/2 - gs_frame_width, Side_Height_Inside, 15,
0, B - Frame_Y, 15,
-A/2 + gs_frame_width, Side_Height_Inside, 15,
-A/2 + gs_frame_width, 0, 15,
A/2 - gs_frame_width, 0, -1,
Glass_Y, Glass_Center_Y, 15,
0, Glass_Center_Y + Glass_Y, 15,
-Glass_Y, Glass_Center_Y, 15,
0, Glass_Center_Y - Glass_Y, 15,
Glass_Y, Glass_Center_Y, -1,
.2, .1, 15,
.2, .16, 15,
-.2, .16, 15,
-.2, .1, 15,
9 Type or copy-paste the following lines into the 3D Script: .2, .1, -1
!Setting Panel attributes and generating panel
PEN gs_leaf_pen
MATERIAL gs_leaf_mat

Here we created the Door Panel. Let us review it in a bit of detail.


We are setting the PEN and MATERIAL attributes for the Door
Panel. The Door has separate default parameters for these, so we are You may notice that the first six defined points are the same as for the
using them to keep consistent with other Doors. Door Frame, which is understandable since they must be located at

164 Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide


9. Advanced GDL Scripting

the same points. The sixth point has the status code “-1”, meaning 12 Type or copy-paste the following lines into the 3D Script:
that the polygon is closed: any new points will start defining a hole !Setting Glass attributes and generating Glass
into the body. PEN Glass_Pen
The next five points are the points of the panel around the Glass. We MATERIAL Glass_Mat
used the Glass_Y and Glass_Center_Y variables defined at
the beginning of the script. You may refer to the “9.3 Glass
Variables” saved View to check the coordinates of these points of the
PRISM_.
The status code of the last point of the hole’s definition is again a
“-1”, meaning that the hole polygon is closed. In such a case, if there
are further points defined, it means that there are other holes within
the same body.
The last five points define the hole we created at the bottom of the
Door panel for ventilation purposes. The coordinates of the point
can be checked in the “9.3 Glass Variables” saved View.
11 Activate the 3D View Window to see the result. Orbit around
it to see the holes in the Door Panel.

Here we set the PEN and MATERIAL attributes for the Glass. For
this we used the parameters we created in the parameter list.
13 Type or copy-paste the following lines into the 3D Script:
ADDZ gs_leaf_thk/2 - Glass_Thk/2
PRISM_ 5, Glass_Thk,
Glass_Y, Glass_Center_Y, 15,
0, Glass_Center_Y + Glass_Y, 15,
-Glass_Y, Glass_Center_Y, 15,
0, Glass_Center_Y - Glass_Y, 15,
Glass_Y, Glass_Center_Y, -1
DEL 1

We now are ready with both the Frame and the Panel. We still need to
generate the Glass.

Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide 165


9. Advanced GDL Scripting

If the glass is too transparent for you to see the Glass very well in
OpenGL, you can set the “Transparency in Shading” field of the 3D
Window Settings Dialog to OFF.
15 Save the Door object using the “File > Save” menu
command.
16 Go back to the Floor Plan. Select the Door in the Wall and
right-click (Windows) / CTRL-click (Mac) to bring up the
context menu. In the context menu, select the “Show
Selection > Marquee” in 3D command.

The ADDZ command moves the Local Coordinate System along the
z-axis so that the Glass will be generated in its proper position.
The PRISM_ command generates the Glass body. The coordinates
of the points are the same as those of the last five points of the Door
Panel.
The DEL command undoes the coordinate transformation of the
ADDZ command and returns the Local Coordinate System to its
default position.
14 Activate the 3D View Window to see the result.

As you can see, a rectangular-shaped hole is cut for the Door into the
Wall. We need to modify this with scripting.
17 Go back to the Library Part Editor and type or copy-paste the
following lines into the 3D Script:
!Cutting shape of Door out of Wall (WALLHOLE)
WALLHOLE 6, 1,
A/2 - gs_frame_width, 0, 7,
A/2, 0, 7,
A/2, Side_Height, 7,
0, B, 7,
-A/2, Side_Height, 7,
-A/2, 0, -1

166 Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide


9. Advanced GDL Scripting

The WALLHOLE command is very similar to the PRISM_ command


in its structure.
The n parameter defines the number of edges of the cut polygon.
The status parameter influences the attributes of the cut edges and
surfaces. If it is “1”, the PENS and MATERIALS defined for the
Here we have a new GDL command. The WALLHOLE command is enclosing Wall will be used. If it is “2”, the PENS and MATERIALS
used to cut a non-rectangular hole into the Wall. defined and in effect in the 3D script will be applied to those edges
For rectangular Walls, ArchiCAD automatically cuts a rectangle and surfaces.
shaped hole into the Wall into which the Door/Window is placed. The mask values are similar to the values of the PRISM_ command,
The width of that hole is “A” and its height is “B”. It is cut but there are only “1”, “2”, “4” and “64” values (the three edges
symmetrically along the y-axis of the Door/Window. plus the method used for drawing contours – as we discussed in
In case the Door/Window Frame is non-rectangular, you need to use Chapter 7).
the WALLHOLE command to manually define the shape of the hole The last three values are optional and define a vector. As a default, the
that should be cut into the Wall for the Door/Window. vector of the WALLHOLE cut is perpendicular to the sides of the
18 Find the WALLHOLE command syntax on Page 255 of the Wall. This serves our purposes, so we will not use these optional
ArchiCAD GDL Reference Guide. parameters now.
WALLHOLE n, status, Hint: The WALLHOLE command will not generate any visible
x1, y1, mask1, shape in the 3D View of the Library Part Editor. You need to save
... the Door and place it into a Wall before you can see the shape it
xn, yn, maskn cuts from the Wall.
[, x, y, z] 19 Save the Door object using the “File > Save” menu
command.

Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide 167


9. Advanced GDL Scripting

20 Go back to the Floor Plan. Select the Door in the Wall and ArchiCAD has many macros within its Library. We are now going to
select the “Show Selection/Marquee in 3D” command in the use the Macro Object from the ArchiCAD Library that is used to
context menu. create Door Handles. The name of the Macro Object is
da_handletyp.gsm.
1 Open the object “da_handletyp.gsm” using the “File >
Libraries and Objects > Open Object” command. The file is
located in the same folder as the “AC Guide GDL Ch 09.pla”
file.

You can see now that a hole with a correct shape is cut into the Wall
for the Door.

9.5 CREATING THE MACRO CALL


AC Guide GDL Ch
09_05.mp4
Watch Movie
The Macro object is opened.
Macros are complete Library Parts that can have their own scripts and Above the “New” button you can see that its subtype is Macro.
parameters. Macros are used to generate models that are used in many
other objects. For example, you may have 10 different types of Doors, If you take a look at its parameter list, you can see that there are about
but all of them may use a Door Panel. In such a case, it is advisable to a dozen parameters. These specify various things about its geometry,
write a Macro Object for the Door Panel and reference or “call” the materials, shadow casting, etc.
Macro Object from the Door Objects to generate the Door Panel.
This is like calling a sub-routine, with the difference that in this case
the sub-routine is a completely separate Object file.
Another advantage of Macros is the fact that in case you need to
modify them, you need to modify the Macro Object only once: all
calling Library Parts can then reap its benefits.

168 Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide


9. Advanced GDL Scripting

2 Select the “gs_handle_typ_m” parameter and click the 3 Activate the 3D View Window to see the 3D model of the
right-pointing arrow in its Value column to see the available Macro.
values.

Note the position of the Local Coordinate System of the Macro


As you can see, there are 16 possible values, the same values defined object. This is important because when calling the Object we need to
for the “Handle_Style” parameter of the Door object. move the Local Coordinate System to the position where we want the
We gave these possible values for the “Handle_Style” parameter at Macro to be created.
the beginning of the Parameter Script. If you open the Parameter We will use three parameters of the Macro in the Door Object. We
Script of this Macro Object you will see that the “gs_handle_typ_m” will transfer the values of these parameters to the Macro when we call
parameter of the Macro has the same value set. it. If there is no value transferred to the Macro for a given parameter
The reason we did this is because we will call the Macro from our then the Macro will use the default value of that parameter.
Door object and we will transfer values to it. The Macro will generate We will use the gs_handle_typ_m, gs_handle_mat and
its 3D based on the values that were transferred from the calling gs_handle_ac_mat parameters. We have corresponding parameters
Door object. in the Door object that we will be able to specify there and thus
transfer their values when calling the Macro.
4 Go back to the “Pentagonal_Door.gsm” object and activate
its 3D Script. Type or copy-paste the following code into it:
!Put Local Coordinate System in correct place
for Handle
ADD -A/2 + gs_frame_width + .05, .9, gs_leaf_thk

Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide 169


9. Advanced GDL Scripting

We do this in a FOR_NEXT loop because we need to call the Macro


twice to create the Door Handle on both sides of the Door. The
Here we move the Local Coordinate System to its correct position for MULZ and ADDZ commands are there to move the Local Coordinate
the Door Handle. Its center will be at a height of .9 meters and 50 System to its correct position for the Door Handle on the other side
millimeters from the Door Frame. of the Door.
5 Type or copy-paste the following code into the 3D Script: The Macro call happens with the CALL command. Let us look at this
!Call macro to generate Handles on both sides in detail.
FOR t=1 TO 2 6 Go to Page 222 of the ArchiCAD GDL Reference Guide file
CALL "da_handletyp" and find the CALL command.
PARAMETERS gs_handle_typ_m =
Handle_Style,
gs_handle_mat = Handle_Mat,
gs_handle_ac_mat = Handle_Acc_Mat
MULZ -1
ADDZ gs_leaf_thk
NEXT t
DEL 5

There are several variations of the CALL command. We will use the
following one:

170 Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide


9. Advanced GDL Scripting

CALL macro_name_string [,] PARAMETERS 7 Make sure that the “Handle_Style” parameter of the Door
[name1=value1 , ... namen=valuen][[,] object is set to a non-zero value.
This command calls a Macro Object and transfers several values to
certain parameters of the Macro Object such that it will create its 2D
and 3D based on those transferred values.
Here we have the following parts:
CALL this is the name of the command
macro_name_string this is the name of the Macro Object. It must
not have a file extension, and should be put between quotation marks.
(Example: “da_handletyp”)
PARAMETERS this is the keyword that shows that a list of
parameters within the macro object follows; values will be assigned to
these parameters
name1 = value1 this is the name of a parameter within the Macro
Object and the numeric expression which assigns a value to it.
If it is set to “0”, no handle will be generated for the Door.
If we do not assign values to certain parameters of the Macro Object
they will use their default values as specified in their parameter list. 8 Activate the 3D View Window to see the result.
So the following command:
CALL "da_handletyp"
PARAMETERS gs_handle_typ_m = Handle_Style,
gs_handle_mat = Handle_Mat,
gs_handle_ac_mat = Handle_Acc_Mat
will call the Macro Object called da_handletype. It will set
values for three parameters within the Macro Object. The
gs_handle_typ_m parameter of the Macro Object will take the
value of the Handle_Style parameter of the calling Library Part (
Pentagonal_Door.gsm in this case). The gs_handle_mat
parameter of the Macro Object will take the value of the
Handle_Mat parameter of the Pentagonal_Door.gsm Library
Part. The gs_handle_ac_mat parameter of the Macro Object
will take the value of the Handle_Acc_Mat parameter of the
Pentagonal_Door.gsm Library Part. If you Orbit around the Door in 3D you can see that it has Door
Handles on both sides.
After the Macro Object’s code is executed, it will return to the calling
Library Part and the execution will continue at the line after the 9 Save the Object with the “File > Save” menu command.
CALL command of the calling Library Part.
With this step we finished creating the 3D for the Object.

Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide 171


9. Advanced GDL Scripting

9.6 CREATING THE 2D SCRIPT 3 Type or copy-paste the following code into the 3D Script,
replacing the previously placed commands:
AC Guide GDL Ch Inside_Frame_Half = A/2 - gs_frame_width
09_06.mp4
Watch Movie IF GLOB_SCALE > 50 THEN
1 Open the 2D Script of the Door object. RECT2 Inside_Frame_Half, 0, A/2,
-gs_frame_thk
RECT2 -Inside_Frame_Half, 0, -A/2,
-gs_frame_thk
LINE2 Inside_Frame_Half, 0,
Inside_Frame_Half,
2 * Inside_Frame_Half
2 Type or copy-paste the following code into the 3D Script: ARC2 Inside_Frame_Half, 0, A - 2 *
gs_frame_width,
IF GLOB_SCALE > 50 THEN
90, 180
HOTSPOT2 Inside_Frame_Half, A - 2 *
ELSE
gs_frame_width
ELSE
ENDIF
RECT2 Inside_Frame_Half, 0, A/2,
-gs_frame_thk
RECT2 -Inside_Frame_Half, 0, -A/2,
-gs_frame_thk
RECT2 Inside_Frame_Half, 0,
Inside_Frame_Half –
gs_leaf_thk, 2 * Inside_Frame_Half -
We will create two different versions of the 2D of the Door gs_leaf_thk
depending on the Floor Plan scale. We wish to create a more detailed ARC2 Inside_Frame_Half - gs_leaf_thk, 0, 2 *
2D Symbol for the Floor Plan scale in which the Door will be Inside_Frame_Half - gs_leaf_thk, 90, 180
displayed in 1:50 or less (e.g., 1:20, 1:10 etc.). HOTSPOT2 Inside_Frame_Half, A - 2 *
The GLOB_SCALE global variable can be used especially for this gs_frame_width –
purpose. gs_leaf_thk
GLOB_SCALE always returns the scale of the current View. In the ENDIF
case of a 2D Script of a Door, this means the Floor Plan Scale. When
the Door is placed into a Wall, ArchiCAD draws its 2D based on the
2D Script. We want ArchiCAD to check the scale set in the Floor
Plan Window and create different 2Ds based on the given value.

172 Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide


9. Advanced GDL Scripting

4 Click the “2D Full View” button to see the 2D of the Door.

In the first line we set a variable called Inside_Frame_Half,


which is the distance from the Door center to the inside of the Frame
along the x-axis. We will use this value in the subsequent commands.
Let us look at the commands placed between the IF and the ELSE
commands: The Door is displayed at a scale of 1:100. The Door Panel is
The first 2D command is the RECT2 command. This is a new symbolized by a Line.
command we use and it is a simple one. It simply creates a rectangle 5 At the lower left corner of the 2D Full View Window, click the
in 2D. The first two parameters define the x and y-coordinates of one scale button, set the scale to 1:50 in the Dialog that appears
of its corners, and the next two parameters define the x and and click “OK” to accept this change.
y-coordinates of the corner opposite the first defined corner. The two
RECT2 commands create the two rectangles that symbolize the
Frame of the Door on the two sides.
The LINE2 command symbolizes the Door panel in its 90-degree
open position.
The ARC2 command symbolizes the 90-degree opening angle of the
Door in 2D.
The HOTSPOTS2 command placed a hotspot at the end of the Door
Panel line so that we will be able to select it by that point.
The commands placed between the ELSE and the ENDIF
commands are very similar to those between the IF and ELSE
commands. There are only two differences: the Door Panel is created
with the RECT2 command instead of the LINE2 command, and the
hotspot at the end of the Door Panel is at a slightly different location.
As you can see, the Door Panel is now displayed with a rectangle.

Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide 173


9. Advanced GDL Scripting

6 Set the scale back to 1:100, and return to the 2D Script. 9 Go back to the Floor Plan and make sure the “9.4 Door
As you can see, it is relatively easy to create objects whose displays Placement” saved View is activated. Select the Door placed
respond to scale changes. in the Wall.
7 Type or copy-paste the following code into the 2D Script,
after the ENDIF command:
HOTSPOT2 A/2, 0
HOTSPOT2 A/2, -gs_frame_thk
HOTSPOT2 -A/2, 0
HOTSPOT2 -A/2, -gs_frame_thk
You can see that the 2D of the Door is now displayed according to
the way it is scripted in the 2D Script and is based on the current
scale.
You can also see that the hotspots of the Door are there.
Hint: The Wall Contour can now be set using the “Wall
Contours” parameter in the parameter list. Set it to “2” to draw the
Wall edges in 2D.
10 Modify various settings of the Door in its Settings Dialog and
the Info Box and check its 2D and 3D to make sure
everything is correctly scripted.

With these hotspot definitions we create four hotspots at the four


corners of the Door Frame so we will be able to select the Door using
these points.
We placed these after the IF-THEN structure because these hotspot
definitions are the same regardless of what scale the Door is displayed
in.
8 Save the Door Object using “File > Save”.

This concludes this Chapter.

174 Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide


10. Advanced GDL Scripting – continued

10. ADVANCED GDL SCRIPTING – CONTINUED


This chapter of the Interactive Training Guide will take it lightly and The reason we extract the folders in this Chapter is because we wish
introduce some of the fun parts of GDL. to modify an element. Library Parts located in a PLA file or LCF file
You will again work in the Library Part Editor Window. This lesson cannot be modified and saved back into that PLA/LCF file.
demonstrates the following object making techniques: 2 Open up the “AC Guide GDL Chapter 10_1” folder in the
• Creating objects that modify their shape in animations View Map of the Navigator palette and activate (by
double-clicking) the “10.1 Overview” saved view in the
• Using a Global variable in GDL to inquire about the current frame “Chapter 10” folder.
of the animation
• Using the CUTPLANE – CUTEND command pair for cutting the
3D Model

PART 1 – OPENING DOOR


10.1 Overview
AC Guide GDL Ch
10_1_01.mp4
Watch Movie
1 To start the tenth lesson of the ArchiCAD GDL training
guide, open the “AC Guide GDL Ch 10_1.pla” file. Select the
“Extract elements to a folder” option. In the Dialog that
appears select the default location for the folder and click the
“OK” button to execute it. The Project we will use for this purpose is an example Project
provided by Graphisoft on its web site.
The Project is a Pavilion. Its architect is Holger Kreienbrink, who is
with Graphisoft Deutschland GmbH. The Pavilion has a simple and
elegant structure with full glass walls all around.
What we wish to do is create a short animation. We will move from
outside the Pavilion, up the steps, and into the glass-enclosed area.
Before entering, we will stop in front of the entrance Door. We will
program the Door to open during the animation, and when it is fully
open, we will move into the inside of the Pavilion.
How can we create animations?
There are three interacting factors we use for this:

Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide 175


10. Advanced GDL Scripting – continued

• ArchiCAD GDL provides a Global variable. By using it one can 10.2 Creating the parameters
find the exact frame number of a running animation in any Script.
• Based on such a variable we change the 3D opening angle of the AC Guide GDL Ch
Door Library Part. 10_1_02.mp4
Watch Movie
• We’ll set ArchiCAD to rebuild each frame during animation so the
modified geometry will be displayed in different frames. We will not create a completely new object. Instead, we will only
3 You can see the Path of the animation in the Floor Plan. make some small additions to some code that will serve our purpose.
Select the Door the Path will go through. 1 Find the parameter named “gs_open_3D” in the list of
parameters.

4 Use the “File > Libraries and Objects > Open Object” menu
command to open the Door for editing.

This parameter defines the opening angle of the Door Panel in 3D. It
can range from 0 degrees (completely closed) to 180 degrees
(completely open to the side).

176 Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide


10. Advanced GDL Scripting – continued

2 Create three new parameters in the parameter list based on Further parameters can be added to make the animation more
the following table: sophisticated. For example, there could be two additional parameters
Variable Type Name Value defining the starting opening angle and the ending opening angle of
the Door leafs. For the sake of simplicity we will not include these at
Door_Open Boolean Door opens in animation this time.
Beg_Frame Integer Beginning frame of Door 0 3 Switch on the bold toggle of the “Door_Open” parameter.
opening Also, switch on the subordinate toggles of the other two
End_Frame Integer Ending frame of Door 0 parameters.
opening

The “Door_Open” parameter will control whether the animation


feature is turned ON or OFF. It must be turned ON for any
animation of the Door to occur.
“Beg_Frame” specifies the number of the Frame of the animation
at which the Door begins to open from its 0 degree closed state.
“End_Frame” specifies the number of the Frame of the animation
at which the Door reaches its final opened state. We will open the
Door leaf to only 90 degrees in this example.

Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide 177


10. Advanced GDL Scripting – continued

4 Move all three parameters above the “Parameters for 6 Type or copy-paste the following lines of code at the top of
Listing” parameter such that their position relative to one the Parameter Script:
another remains the same. IF NOT(Door_Open) THEN
HIDEPARAMETER "Beg_Frame", "End_Frame"
ENDIF

5 Open the Parameter Script. This familiar code piece will hide the two latter parameters when the
first one is not enabled, as in that case they are not relevant and so
should not be shown.

178 Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide


10. Advanced GDL Scripting – continued

10.3 Creating the 3D Script


AC Guide GDL Ch
10_1_03.mp4
Watch Movie
1 Open the 3D Script for editing.

The first line makes sure that the operations are executed only when
the Door_Open parameter is turned ON.
In the next line we can see the GDL Global variable we use in this
example:
GLOB_FRAME_NR
3 Open the “ArchiCAD GDL Reference Guide” PDF file from
the Help menu.

2 Type or copy-paste the following lines of code at the top of


the Parameter Script:
IF Door_Open THEN
IF GLOB_FRAME_NR < Beg_Frame THEN
gs_open_3D = 0
ELSE
gs_open_3D = (GLOB_FRAME_NR - Beg_Frame) * (90 /
(End_Frame - Beg_Frame))
ENDIF
ENDIF

Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide 179


10. Advanced GDL Scripting – continued

4 Find the description of the GLOB_FRAME_NR variable on At any given frame the product of (GLOB_FRAME_NR -
Page 228 of the GDL Reference Guide. Beg_Frame) and (90 / (End_Frame - Beg_Frame))
will give the opening angle of the Door.
5 Save the changes to the Door and return to the Floor Plan.

10.4 Creating the animation


This Global variable returns the current frame of the animation.
AC Guide GDL Ch
This second IF structure does the following: as long as the 10_1_04.mp4
GLOB_FRAME_NR is lower than the beginning frame number of the Watch Movie
Door opening, the Door Leaf stays closed at 0 degrees. This is what
the next line of code does. 1 Open the Camera Settings Palette.
Hint: we need to specifically set the value of the gs_open_3D
parameter to “0”. If it were set to another value (e.g., 45 degrees),
it would be at that value to begin. Then at Beg_Frame it would
suddenly change to 0 degrees, whereupon it would gradually open.
The ELSE clause of the
IF structure defines what happens when the value of
GLOB_FRAME_NR is equal to or greater than the value of
Beg_Frame.
We want the value of gs_open_3D at Beg_Frame to be 0, and we
want its value at End_Frame to be 90.
The number of frames that pass while the Door opens from 0
degrees to 90 degrees is the value given by (End_Frame -
Beg_Frame).
From the above we get that the Door must open (90 /
(End_Frame - Beg_Frame)) degrees with each passing
frame. So (90 / (End_Frame - Beg_Frame)) gives the
unit change of the Door’s opening angle per frame.
The value (GLOB_FRAME_NR - Beg_Frame) gives the
number of frames passed since the Door started opening (how many
units of change happened in the opening angle of the Door).

180 Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide


10. Advanced GDL Scripting – continued

2 Click the “Path” button to view the animation Path settings. 3 Close the Path Options Dialog, then close the Camera
Settings Palette.

We need to know exactly which frame we will be at when we arrive in


front of the entrance Door.
As you can see in the lower left area of the Dialog, the animation
consists of 101 frames. There are five times twenty frames, with
twenty frames between each Camera. 4 Select the entrance Door and go to its Settings Dialog.
The positions of the Cameras are contained in the table below:
Camera Number Located at Frame Number
Camera 1 1
Camera 2 21
Camera 3 41
Camera 4 61
Camera 5 81
Camera 6 101

If you look at the Path in the Floor Plan, you will see that Camera 4
and Camera 5 are very close to each other. This is a good place to
wait for the Door to open before entering the pavilion.
The Door needs to open between Frames 61 and 81.

Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide 181


10. Advanced GDL Scripting – continued

6 Click on the right-pointing arrow that appears to the left of


5 Switch the “Door opens in animation” parameter “ON” in
the parameter, and specify “61” and “81” as values for the
the parameter list of the Door.
Beginning and Ending frames of the animations,
respectively.

182 Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide


10. Advanced GDL Scripting – continued

10 Also make sure you check the “Rebuild Model for Each
Frame” checkbox in the lower left corner of the Dialog.
This step is crucial. When the program enters the 3D Window, it has
already generated the model. The Door leaf is at a certain opened
angle. If this checkbox is not checked, all frames of the animation will
be created using the already generated model.
If you check this checkbox, ArchiCAD rebuilds the model for every
single frame of the animation. This enables the program to read the
value of “GLOB_FRAME_NR” in the Door object, and generate a
Now the Door will begin to open at Frame 61, just as we arrive at the
different model for the Door with each passing Frame.
position of Camera 4, and it will complete its opening movement at
Frame 81, just as we start to move into the Pavilion from the position
of Camera 5.
7 Click “OK” to accept the changes. Set the 3D Engine to
Open GL 3D Engine with the “View > 3D View Mode >
Open GL 3D Engine” command.

8 Select the “Document > Creative Imaging > Create


Fly-Through” menu command.
9 Select “QuickTime Movie File” (or another format of your
choice) in the Result field.

Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide 183


10. Advanced GDL Scripting – continued

11 Click the “Save” button. In the Dialog that appears specify a


name for the video file to be generated and click the “Save”
button for the generation to begin.

You can see the current Frame being generated on the Title bar as the
animation is generated. Watch Frame 61, where the Door leaf will
start to open.
This concludes the first Project created in this chapter.

184 Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide


10. Advanced GDL Scripting – continued

PART 2 – CONSTRUCTION SIMULATION


In the second part we will again use the “object animation”
capabilities that can be built in GDL.
We will take a portion of a city in Google Earth, create a Model of a
building and create a “construction simulation” animation in which
the building will be built from the ground up in its planned
environment with 3D buildings around it.

10.5 Bringing in data from Google Earth


AC Guide GDL Ch
10_2_01.mp4
Watch Movie
We will bring in two images from Google Earth: the image of a map
of a portion of a city, and the image of a 3D view of the same portion
with a modeled 3D building in it. b Using the File > Save > Save Image command, we saved the
We will not do these steps ourselves, but will talk you through how we image of the location to a file named Miami.jpg.
went about them under steps a-f below. At this point you should be
able to envision the steps that were taken to achieve this.
1 Finding the location
a We searched for “Miami, FL” in Google Earth. The application
took us to an aerial view of downtown Miami. We selected a
parking lot and decided to put a building in its place. We only
panned the desired position, but we did not rotate the View in
c Using the File > External Content > Place External
Google Earth. As a result the view remained in Top View.
Drawing… menu command in ArchiCAD, we placed the image
on the Floor Plan.

Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide 185


10. Advanced GDL Scripting – continued

e Going back to ArchiCAD, we drew a line over the placed image of


the downtown area between the same two points on the map
image. We zoomed in as close as was sensible to make it as
accurate as possible.

d We needed to scale the Drawing correctly, therefore we went back


to Google Earth, and used the Tools > Ruler menu command to
draw a line from one corner of one building to another corner of
another building. We read off the exact length of this line in
centimeters. It measured 23755.9 centimeters (237559 millimeters f We selected both the line and the placed Drawing of the image,
or 237.559 meters). and using the Resize command, we resized them both graphically.
The graphical resize operation’s origin was one end of the line, and
it was done such that as a result, the length the line measured
237559 millimeters, just as in Google Earth. With this we managed
to enlarge the image to the correct size.
2 Open the “AC Guide GDL Ch 10_2.pla” file. Select the “Read
elements directly from archive” option. In the Dialog that
appears select the default location for the folder and click the
“OK” button to execute.

186 Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide


10. Advanced GDL Scripting – continued

4 Activate (by double-clicking) the “10.2 Modeled Building


Mass” saved view in the “Chapter 10” folder.

3 Open up the “AC Guide GDL Chapter 10_2” folder in the At this stage of the Project you can see that the Building was modeled
View Map of the Navigator palette and activate (by using Slabs and Double-Slanted Walls.
double-clicking) the “10.1 Placed Map Image” saved view in
We already prepared the 3D Window for the animation for you. To
the “Chapter 10” folder.
do this we took the following steps:
a We went back to Google Earth and switched on the Layer called
3D Buildings. The application at this point displayed all
3D-modeled building available for Miami.

Here you can see the result of steps a-f above. Note the blue Line that
was drawn and check to make sure its length is indeed 237559
millimeters.

Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide 187


10. Advanced GDL Scripting – continued

b We moved around to find an aerial view in which our building site


is clearly visible and the building we plan to place will not be
obstructed by any other building.

c Using the File > Save > Save Image command we saved the
image of the location to a file named Miami_background.jpg.

e We then went to the View > 3D View Mode > 3D Window


Settings Dialog, and chose Internal 3D Engine for the 3D
Engine. (We want to use the 3D Window as the source of the
animation.) Also, in the Background field, we chose the As In
PhotoRendering radio button.

d We went to the Document > Creative Imaging >


Photorendering Settings Dialog. In the Background panel we
selected this newly saved Picture as our background. We used the
Load Other Object button in the Load Image from Library
Dialog to load the image file. We also set the size of the Rendering
Engine Window to match the size of the image so that the
background image perfectly fits the size of the Rendering Engine
Window.

188 Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide


10. Advanced GDL Scripting – continued

g In the 3D Window we entered Explore mode and moved around


our Camera position until we found a View in which our designed
building fit correctly into the surroundings shown in the
background image.
5 Activate (by double-clicking) the “10.3 Perspective of
Building Mass” saved view in the “Chapter 10” folder.

f In the 3D Projection Setting Dialog we switched to Perspective


View and tried to find a Camera position in the Dialog that would
be close to where the Camera was located in Google Earth. After
doing this we activated the 3D Window. You can see the result in this saved 3D Perspective View.
h It is a good idea to save the Camera position, and not only the
View resulting from it. Therefore, we used the View > 3D
Navigation Extras > Put a camera into the path menu
command to place a Camera at the current position as seen in the
3D Window.
i Since we want to create an animation, we needed at least two
Cameras. Therefore we placed another Camera extremely close to
the one we had just placed by dragging a copy of that original
Camera. We set the in-between frames for these two Cameras to
99. This way we will have a total of 100 Frames in our animation.
6 Go to the Camera Settings Palette, and click the “Path”
button. In the Dialog that appears select the “Everything”
option from the drop-down list below the “Display Options”
field. Click “OK” to close the Dialog.

Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide 189


10. Advanced GDL Scripting – continued

10.6 Creating the Object from the Mass


AC Guide GDL Ch
10_2_02.mp4
Watch Movie
Now we will start to create our Object. For this purpose we first need
to save the 3D mass in GDL.
1 Activate (by double-clicking) the “10.5 Mass Top View”
saved view in the “Chapter 10” folder.

7 Activate (by double-clicking) the “10.4 Camera positions”


saved view in the “Chapter 10” folder.

The 3D mass of the building is shown in Top View in the 3D


Window. We will save it from here.
2 Select the “File > Libraries and Objects > Save 3D Model
as…“ menu command.
3 In the File Dialog Box that appears specify a name and
location for the new Object file. In our case we’ll save it
under the name “SkyScraper_Block.gsm”.

Here you can see the two Cameras placed on the Floor Plan at a very
high zoom level.

190 Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide


10. Advanced GDL Scripting – continued

We chose the non-editable option because we do not want to modify


the object. This way our 3D script will be short and clean.
5 Select the “Object” tool and enter its Dialog. The
“Skyscraper_Block.gsm” Object is selected. Specify “0” for
the Object vertical position. Also, select its lower left
selection hotspot then click “OK” to leave the Dialog.

4 In the next Dialog that appears specify the 3D Model to be


saved as an Object. Check the “Remove redundant lines
from symbol” checkbox. In the 3D description format field,
choose the “Non-editable binary 3D data” radio button.

Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide 191


10. Advanced GDL Scripting – continued

6 Activate (by double-clicking) the “10.6 Object Placement” 7 Activate (by double-clicking) the “10.7 Placed Object 3D”
saved view in the “Chapter 10” folder. saved view in the “Chapter 10” folder.

Click the lower left corner of the Slabs and Walls mass to place the
Object.
The Object we saved from the 3D model has now been replaced with
the Slabs and Walls mass in the 3D Window.

192 Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide


10. Advanced GDL Scripting – continued

10.7 Creating the parameters The “Time_Build” parameter will control whether the animation
feature is turned ON or OFF. It must be turned ON for any
AC Guide GDL Ch animation of the Building to occur.
10_2_03.mp4 The “Beg_Frame” specifies the number of the Frame of the
Watch Movie animation at which the Building starts to be built from the ground up.
1 Select the Object and select the “File > Libraries and Objects The “End_Frame” specifies the number of the Frame of the
> Open Object…” menu command to open the Object for animation at which the Building will be built completely to its full
editing. height.
2 Create three new parameters in the parameter list based on 3 Switch on the bold toggle of the “Time_Build” parameter.
the following table: Also switch on the subordinate toggles of the other two
Variable Type Name Value parameters.
Time_Build Boolean Built during animation
Beg_Frame Integer Beginning Frame of Building 0
End_Frame Integer Ending Frame of Building 0

We could also create a Parameter Script that would hide the two latter
parameters when the first parameter is turned OFF. This was the case
for the Object in the first part of this Chapter. We will skip this step
now, because we do not have too many parameters.

Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide 193


10. Advanced GDL Scripting – continued

10.8 Creating the 3D Script


AC Guide GDL Ch
10_2_04.mp4
Watch Movie
1 Open the 3D Script for editing.

Both IF structures are the same as in the first part of the chapter.
The difference lies in how the animation effect is achieved.
In this case what we do is define a so-called Cut Plane in the 3D
Script of the Object. The Cut Plane will cut off everything from the
Object above a plane located at a certain level and parallel to the x-y
plane.
The location of the Cut Plane will be dependent on the current frame
number of the animation. We elevate the Cut Plane to its desired
2 Type or copy-paste the following code into the beginning of height using the ADDZ command. By using this we will relocate the
the 3D Script: origin of the Local Coordinate System. The Cut Plane defined by the
IF Time_Build THEN CUTPLANE command will always be on the x-y coordinate plane of
IF GLOB_FRAME_NR >= Beg_Frame THEN the Local Coordinate System.
ADDZ (GLOB_FRAME_NR - Beg_Frame) *
We want the vertical position of the Cut Plane at Beg_Frame to be
(270 / (End_Frame - Beg_Frame))
0, and we want its value at End_Frame to be 270. We choose 270
CUTPLANE
because the Skyscraper is 265 meters high and we want to make sure
DEL 1
no part of it is cut off when End_Frame is reached in the
ENDIF
animation.
ENDIF
The number of frames that pass while the Cut Plane moves from a
height of 0 to 270 meters is the value given by (End_Frame -
Beg_Frame).
From the above we get that the Cut Plane must be raised (270 /
(End_Frame - Beg_Frame)) meters with each passing frame.

194 Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide


10. Advanced GDL Scripting – continued

Thus, (270 / (End_Frame - Beg_Frame)) gives the unit We will also need to place a CUTEND command at the end of the 3D
change of the Cut Plane’s height per frame. Script.
The value (GLOB_FRAME_NR - Beg_Frame) gives how many One more thing about the CUTPLANE command is that it will always
frames passed since the Building started to rise (i.e., how many units cut that portion of the 3D model that is above the x-y plane, in the
of change happened given the height of the Cut Plane). z-region of the Local Coordinate System. In our example, the portion
So at any given frame, the product of (GLOB_FRAME_NR – of the 3D Model above the Cut Plane will be cut and removed from
Beg_Frame) and (90 / (End_Frame – Beg_Frame)) View. If we mirrored the orientation of the z-axis using a MULZ –1
will give the position of the Cut Plane. command, the portion of the 3D Model below the Cut Plane would
be cut and removed from view.
3 On Page 100 of the ArchiCAD 10 GDL Reference Guide find
the description of the CUTPLANE command. Let us consider one more thing about the CUTPLANE command and
the commands surrounding it:
ADDZ (GLOB_FRAME_NR - Beg_Frame) * (270 /
(End_Frame - Beg_Frame))
CUTPLANE
DEL 1
As you can see, an ADDZ command precedes the CUTPLANE
command, and a DEL 1 command follows it. The ADDZ command
is needed to elevate the Cut Plane to its desired position, but a DEL
1 command is also needed to move the Local Coordinate System
origin to where it was before the CUTPLANE command commenced.
This is needed because the commands generating the 3D model
Although the CUTPLANE command can have several parameters, we follow, and those have the previous position of the Local Coordinate
are now using its simplest form, the syntax of which look as follows: System as their origin. So the Coordinate Transformation preceding
CUTPLANE the CUTPLANE command must be undone immediately after the
<any number of gdl commands> CUTPLANE command, otherwise it will affect other elements, and
CUTEND they will be generated in an incorrect position in space.
This can be considered similar to an IF-THEN structure in which all 4 Type or copy-paste the following code at the very end of the
commands between the IF and ENDIF commands are executed. For 3D Script:
the CUTPLANE and CUTEND command pair, the cut operation will IF Time_Build THEN
be performed on all GDL bodies generated between these two IF GLOB_FRAME_NR >= Beg_Frame THEN
commands, and only on those commands. CUTEND
So, if we want to cut the whole 3D model, we need to place a ENDIF
CUTPLANE command before the command generating the 3D ENDIF
model, and place a CUTEND command after those commands.
This is why we placed the IF-THEN structure containing the
CUTPLANE command at the beginning of the 3D Script.

Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide 195


10. Advanced GDL Scripting – continued

We are now finished with the modification of the Object. We are now
ready to do the steps necessary to create the animation.

10.9 Creating the animation


AC Guide GDL Ch
10_2_05.mp4
Watch Movie
1 Go to the 3D Window, and select the Object. Go to its
Settings Dialog.

As you can see, this is a CUTEND command (as mentioned above),


but it is in the same double IF-THEN structure as the CUTPLANE
command.
This is because the CUTPLANE and CUTEND commands come in
pairs. If one is executed in the 3D Script and the other is not,
ArchiCAD will give an error message. Therefore, the CUTEND
command must always be executed under the same conditions as the
CUTPLANE command it is paired with.
Consider a case where there was only a CUTEND command at the
end of the 3D Script, without any conditions.
In such a case, if the Time_Build parameter were OFF, the whole
IF-THEN structure would not let the CUTPLANE command be
executed at the beginning of the Script, but the CUTEND command
would be executed at the end. The result would be an error message
that there is a CUTEND command without a corresponding
CUTPLANE command. 2 Turn the “Built during animation” parameter “ON”. For the
5 Save the changes you have made to the Object. Close the “Beginning Frame of Building” parameter, “0” will be fine.
Library Part Editing Window. For the “Ending Frame of Building” parameter, set a value of
“95”. Close the Dialog with the “OK” button.

196 Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide


10. Advanced GDL Scripting – continued

4 Check the “Rebuild Model for Each Frame” checkbox in the


lower left corner of the Dialog.

5 Click the “Save” button. In the Dialog that appears specify a


3 Select the “Document > Creative Imaging > Create name for the video file to be generated and click the “Save”
Fly-Through” menu command. In the Dialog, make sure the button for the generation to begin.
“3D Window” is the source window and that “All frames” are
selected to be generated.

In the “Result” field, select “QuickTime Movie File” (or another


format of your choice).

This concludes the second Project created in this chapter.

Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide 197


10. Advanced GDL Scripting – continued

198 Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide

You might also like