Creating GDL Objects E Guide
Creating GDL Objects E Guide
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.
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.
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.
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.
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.
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.
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.
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).
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.
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.
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.
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.
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”.
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.
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.
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.
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.
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.
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:
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.
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.
The floor plan shows the original model and indicates the point
where you can place the object that has just been created.
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.
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.
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.
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
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.
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
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.
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.
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.
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
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.
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:
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°.
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.
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.
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.
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”
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.
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.
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.
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”.
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.
Hint: If you prefer you can create more complex door leafs using
the techniques described below.
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.
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
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.
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.
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”.
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.
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.
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.
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.
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.
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
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.
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.
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.
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”.
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”.
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.
Before we start working, let’s have a quick look at the gothic rose
window that is the subject of this lesson.
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.
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.
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.
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.
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:
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
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.
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.
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.
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.
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.
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.
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”.
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”.
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.
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”.
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.
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.
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.
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.
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
in place of the parameter list. If you click the button to its right, it will
open in a separate window.
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.
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
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.
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
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
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
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
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
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.
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, ...]
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.
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).
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.
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
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.
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.
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,
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.
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
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.
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”.
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.
With the use of the two-pointed arrows you can move any parameter
in the list of parameters to any desired location.
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.
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
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.
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.
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
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.
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
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
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.
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
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.
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
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
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.
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.
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.
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.
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.
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.
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.
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.
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
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.
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.
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.
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
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).
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
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
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
Here we mirrored not along the x, but along the y-axis before calling
the sub-routine.
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.
We will now check to see whether the lower right leg is placed in the
correct position.
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.
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.
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
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.
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.
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
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
With this we create three additional hotspots at the middle, the top
middle and the bottom middle of the Table.
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.
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.
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.
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 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
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.
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 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
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.
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.
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.
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
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
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
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.
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
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.
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.
There are several variations of the CALL command. We will use the
following one:
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.
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.
4 Click the “2D Full View” button to see the 2D of the Door.
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.
• 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).
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
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.
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.
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.
2 Click the “Path” button to view the animation Path settings. 3 Close the Path Options Dialog, then close the Camera
Settings Palette.
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.
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.
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.
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.
c Using the File > Save > Save Image command we saved the
image of the location to a file named Miami_background.jpg.
Here you can see the two Cameras placed on the Floor Plan at a very
high zoom level.
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.
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.
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.
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.
We are now finished with the modification of the Object. We are now
ready to do the steps necessary to create the animation.