198
Graphisoft ® ArchiCAD ® Creating GDL Objects Interactive Training Guide

Creating GDL Objects E-Guide

Embed Size (px)

Citation preview

Page 1: Creating GDL Objects E-Guide

Graphisoft® ArchiCAD® Creating GDL Objects Interactive Training Guide

Page 2: Creating GDL Objects E-Guide

GraphisoftVisit the Graphisoft website at http://www.graphisoft.com for local distributor and product availability information.

Graphisoft® ArchiCAD® 11 Creating GDL Objects – Interactive Training GuideCopyright © 2008 by Graphisoft, all rights reserved. Reproduction, paraphrasing or translation without express prior written permission is strictly prohibited.TrademarksArchiCAD®, Virtual Building™, Virtual Trace™ and Virtual Building Solutions™ are trademarks of Graphisoft.All other trademarks are the property of their respective holders.

Page 3: Creating GDL Objects E-Guide

CONTENTSPreface ___________________________________________________ 5

What is GDL?. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .5

How to learn GDL? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .5

Getting started with the ArchiCAD Interactive Training Guide . . . . . . . . . . .5Step 1: Download and install ArchiCAD . . . . . . . . . . . . . . . . . . . . . . . . . . .6Step 2: Create the interactive training environment . . . . . . . . . . . . . . . . . . .7Step 3: How to use Movie Player in ArchiCAD? . . . . . . . . . . . . . . . . . . . . .9

1. Saving 2D Symbols from the Floor Plan_______________________ 11

1.1 Creating the Symbol . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11

1.2 Saving the Object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12

1.3 Checking the Result . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13

1.4 Final Touches . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15

1.5 Using the 2D Symbol View . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17

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

2.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21

2.2 Modeling. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .22

2.3 Creating the GDL Object. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .25

2.4 Editing the GDL Object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .28

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

3.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .35

3.2 Modeling. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .36

3.3 Creating the GDL Object. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .38

3.4 Editing the GDL Object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41

3.5 Adding Material Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .44

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

4.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .48

4.2 Modeling. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .49

4.3 Creating the GDL Object. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .53

4.4 Editing the GDL Object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55

4.5 Creating Custom Door Panels . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57

5. Auto Saving Non-rectangular Windows. ____________________ 63

5.1 Overview. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63

5.2 Modeling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64

5.3 Creating the GDL Object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68

5.4 Enhancing the 2D Symbol . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71

5.5 Adding Material Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73

5.6 Make a Preview Picture with Lightworks . . . . . . . . . . . . . . . . . . . 75

6. Basics of GDL Scripting __________________________________ 79

6.1 Overview. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79

6.2 Creating Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82

6.3 Creating the 3D geometry. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84

6.4 Assigning materials . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92

6.5 Creating value lists for parameters . . . . . . . . . . . . . . . . . . . . . . . . . 94

6.6 Checking the 3D model. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96

6.7 Creating the 2D of the Object. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97

6.8 Placing and working with the Object . . . . . . . . . . . . . . . . . . . . . . . 98

7. Basics of GDL Scripting – Part 2 __________________________ 103

7.1 Overview. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103

7.2 Creating the parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104

7.3 Creating the master Script . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .111

7.4 Creating the 3D Script. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114

8. Basics of GDL Scripting – Part 3 __________________________ 126

8.1 Overview. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126

8.2 Creating the Legs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132

8.3 Creating the 2D Script. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141

8.4 Testing the completed object . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149

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

Page 4: Creating GDL Objects E-Guide

Contents

9. Advanced GDL Scripting_________________________________ 151

9.1 Overview. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151

9.2 Creating the Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152

9.3 Creating the Parameter Script. . . . . . . . . . . . . . . . . . . . . . . . . . . . 156

9.4 Creating the 3D Script. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162

9.5 Creating the macro call . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 168

9.6 Creating the 2D Script . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 172

10. Advanced GDL Scripting – continued _____________________ 175

Part 1 – Opening Door . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175

10.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17510.2 Creating the parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17610.3 Creating the 3D Script. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17910.4 Creating the animation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 180

Part 2 – Construction simulation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18510.5 Bringing in data from Google Earth . . . . . . . . . . . . . . . . . . . . 18510.6 Creating the Object from the Mass . . . . . . . . . . . . . . . . . . . . . 19010.7 Creating the parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19310.8 Creating the 3D Script. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19410.9 Creating the animation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 196

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

Page 5: Creating GDL Objects E-Guide

Preface

PREFACEThe following ten Interactive Training Guide (ITG) chapters will cover the most important aspects of GDL object making in ArchiCAD. The first five lessons will illustrate how you can create Library Parts without any GDL scripting, by using only existing ArchiCAD tools. In the second part we will show you some basic GDL programming examples. This Training Guide was developed to introduce the world of GDL to a wide audience so that users can increase their productivity in ArchiCAD.

WHAT IS GDL?There is a powerful technology at the heart of ArchiCAD – GDL. This three letter abbreviation stands for Geometric Description Language. GDL has been developed specially for ArchiCAD to describe 2D and 3D elements in a user-friendly parametric programming environment. GDL objects are stored in external libraries; the objects are called Library Parts in ArchiCAD. Each Library Part contains several text-based scripts dedicated to different purposes, including 2D symbols, 3D models and descriptions for quantity take-offs.Whenever a GDL object is inserted into an ArchiCAD project, only a 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.

HOW TO LEARN GDL?In addition to this Training Guide there are several other learning tools available for those who want to know more about GDL:• 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.

• Beginners who are not interested in advanced GDL scripting can find useful information in the Introduction to Object Making PDF document.

• Those who want to learn how to create more advanced parametric objects with scripting can buy the GDL Cookbook from David Nicholson Cole.

• Finally, it is recommended that professional library developers read the GDL Technical Standards document to understand Graphisoft object standards.

GETTING STARTED WITH THE ARCHICAD INTERACTIVE TRAINING GUIDE

This interactive training guide was written to ease and speed up your learning process, saving you time.Please read the three steps of this short introduction to familiarize yourself with the interactive training environment in ArchiCAD. Every chapter of the interactive training guide contains the following elements:

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 movie clips within ArchiCAD, while completing the steps using the training project files.

• a section of the PDF Guide with detailed explanations and screenshots;

• narrated movie clips providing step-by-step instructions,

• an ArchiCAD training project file to complete the exercises.

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

Page 6: Creating GDL Objects E-Guide

Preface

Step 1: Download and install ArchiCADTo 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.

• If you are a professional architect, visit https://trialregistration.graphisoft.com/ to register and download a fully functional 30-day trial version of ArchiCAD. Projects saved with this TRIAL version can be automatically

upgraded to FULL versions upon purchase of a commercial license.

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.

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

Page 7: Creating GDL Objects E-Guide

Preface

In case you have not done so already, please install the interactive training guide on your computer.4 Start the installer of the interactive training guide and follow

the instructions on the screen. We recommend you install the guide to the “default” location suggested in the installation wizard.

Once you have successfully installed both Graphisoft ArchiCAD and any of the Interactive Training Guide packages, please proceed with the following steps to initiate the interactive learning environment.

Step 2: Create the interactive training environment

1 Start ArchiCAD on your computer by double-clicking its desktop shortcut.

The ArchiCAD splash screen will appear shortly after you start the program, and the “Start ArchiCAD” dialog will be displayed.2 Select the “Standard Profile” for the active Work

Environment in the “Start ArchiCAD” dialog. Select the “Open Project” option, then click the “Browse” button to locate the ArchiCAD training project file on your local computer.

Introduction.mp4Watch Movie

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

Page 8: Creating GDL Objects E-Guide

Preface

If you installed the interactive training guide to its default location, then you will find its folder in the “Graphisoft” folder of your machine. The Graphisoft folder is located in the “Applications” folder on Macintosh, or in the “Program Files” folder on Windows operating systems. 3 Browse the chapters of this training guide and open any of

the ArchiCAD Project archive (.PLA) files.

4 Select the “Read elements directly from archive” option for Active Library Usage in the “Open Archive Project” dialog.

ArchiCAD will open the selected archive project and read all the library elements directly from the archive file. The ArchiCAD training project files are all saved as archive files. This is important because the library elements have different names in localized versions of ArchiCAD (“localized” meaning translated to foreign languages and customized to meet different local standards).5 Activate the “File > Save As…” command, and save an

ArchiCAD Solo Project of the currently open design file to the folder in which the previously opened archive file was located. The Solo Project format and the correct library are

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

Page 9: Creating GDL Objects E-Guide

Preface

selected automatically, so practically all you have to do is to click the “Save” button to proceed.

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

Step 3: How to use Movie Player in 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.

3 Click the Play button on the player to start the first clip. You can pause the movie at any time, or use the slider to repeat or skip any parts of the clip.

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

Page 10: Creating GDL Objects E-Guide

Preface

4 Once the movie is over and you have completed the current step of the exercise, click the “Next” button to proceed to the next step of the exercise and open the corresponding training clip. You can also click the “Previous” button if you wish to open the previous clip.

The title bar of the movie player always indicates the number of the current step and the total number of steps available in the current chapter.

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

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

Page 11: Creating GDL Objects E-Guide

1. SAVING 2D SYMBOLS FROM THE FLOOR PLAN

1. SAVING 2D SYMBOLS FROM THE FLOORPLANIn this first chapter we will save a custom 2D object – a north symbol – from the floor plan and then make some final refinements in the Library Part Editor. The final – optional - step demonstrates an alternative way to create custom 2D objects by copying 2D elements from the floor plan into the 2D symbol view window of a Library Part. Although these are all really simple operations, they will highlight some basic concepts of making objects with ArchiCAD.All elements of the ArchiCAD floor plan can be saved automatically as 2D symbol objects. You don’t have to be afraid to open the GDL Object Master Window. This logical setup dialog allows you to modify your existing objects according to your needs.You can add more value to your auto saved objects with some easy-to-learn techniques.The 2D symbol view of GDL elements allows you to create a 2D symbol for your object with standard 2D ArchiCAD tools.

1.1 CREATING THE SYMBOL

Let’s start this lesson by completing our custom north symbol on the floor plan.1 Open the “AC Guide GDL Ch 01.pla” ArchiCAD project file

to start the first lesson of this interactive, hands-on ArchiCAD training guide. Select the “Read elements directly from archive” option.

Please review the “Getting started with the ArchiCAD Interactive Training Guide” chapter if you need further information on how to set up ArchiCAD, adjust the necessary ArchiCAD Working Environment, or open the training guide project files.

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

2 Open the “AC Guide GDL Ch 1” folder in the Navigator and activate (by double-clicking) the “1.1 Complete the Symbol” pre-set view in the “Chapter 1” folder.

As you can see we have prepared a nearly complete north symbol for you on the floor plan. We used the standard ArchiCAD tools (Line, Circle, Text) and commands (e.g., Multiply) to create this custom symbol. These techniques were discussed in greater detail in previous ITG lessons; therefore, these steps are not described here. In the next step we’ll add some solid fills to the drawing to make it complete.

AC Guide GDL Ch 01_01.mp4Watch Movie

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

Page 12: Creating GDL Objects E-Guide

1. SAVING 2D SYMBOLS FROM THE FLOOR PLAN

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” type from the pop-up dialog. Set “Pen 1” for all three adjustable pen types (Outline, Cover Fill, Cover Fill Background Pen).

5 Click OK to leave the “Fill Default Settings” dialog box. Zoom in on the north sign. Press the Space button to activate the “Magic Wand” . The cursor’s shape changes to a magic wand indicating that ArchiCAD will automatically trace the boundaries of the area where you click with the cursor

6 Use the left mouse button to click in the middle of those empty areas that you would like to cover with solid fills. You can check the completed symbol on the right side of the screen for reference.

Hint: To avoid segmentation of curved polygon edges, make sure that the “Tracing Method” is set to “Best Match” in the “Magic Wand Settings” dialog (Options > Magic Wand Settings…) before you click.

1.2 SAVING THE OBJECT

Let’s save the previously created drawing elements as a GDL object.1 Open up the “ArchiCAD Guide” folder in the Navigator and

activate (by double-clicking) the “1.2 Create the GDL Object” pre-set view in the “Chapter 1” folder.

AC Guide GDL Ch 01_02.mp4Watch Movie

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

Page 13: Creating GDL Objects E-Guide

1. SAVING 2D SYMBOLS FROM THE FLOOR PLAN

2 Click on the Arrow Tool. Select all the drawing elements with a selection polygon.

Hint: Alternatively, you can hold down the shift button and click the elements for selection one by one. You can also launch the “Select All” command (Edit > Select All) for the same result.

3 Activate the “Save Selection as...” command (File > Libraries and Objects > Save Selection as…) and in the opening dialog specify the name and location of the new Library Part to be created. Save the object as “ITG_North_Symbol” into the “ArchiGuide\ITG Library” folder.

Hint: For easier library management we suggest you always save your custom Library Parts into a dedicated folder other than the standard ArchiCAD Library folder. For each new project we recommend you create a new library folder where the project-specific elements can be stored. Furthermore, it’s very important to give a descriptive name (e.g., with a project-specific suffix or prefix) to your custom objects in order to avoid any Library Part naming conflicts among the loaded libraries.

4 Click OK to create the GDL object at the specified location.

Hint: Whenever a new GDL object is made in ArchiCAD it is automatically loaded into the actual project. You can double check this if you open the Library Manager (File > Libraries and Objects > Library Manager) and review the list of Library Parts under the “Other Objects” category. Naturally, if you want to use this object in your other projects you have to load it (or the folder that contains it) with the Library Manager.

1.3 CHECKING THE RESULT

Let’s look at the capabilities of the newly created Library Part.1 Open up the “ArchiCAD Guide” folder in the Navigator and

activate (by double-clicking) the “1.3 Check the Result” pre-set view in the “Chapter 1” folder.

2 Open the “Object Default Settings” dialog by double-clicking on the Object Tool in the Toolbox. Note that “ITG North Symbol” is the currently active object in the browser on the left side. Click OK to go back to the floor plan and click anywhere with the left mouse button to place an example of the new object. You may also place additional copies of this element with additional mouse clicks.

AC Guide GDL Ch 01_03.mp4Watch Movie

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

Page 14: Creating GDL Objects E-Guide

1. SAVING 2D SYMBOLS FROM THE FLOOR PLAN

3 Activate the Arrow Tool from the Toolbox and select the object by making a selection rectangle around it. The active points (hotspots) of the element become visible.

Hint: GDL objects can be selected with their hotspots or over the areas of their 2D fills. ArchiCAD places hotspots on the bounding box corners and in the center of auto-saved objects. Additional hotspots can be found at the corners of fill polygons.

4 Move your cursor over one of the bounding box hotspots until the cursor’s shape changes to a checkmark. Click to open the “Pet Palette”.

5 Click on the rightmost button (Stretch mode), move the hotspot and click again to finish the operation.

The object is automatically stretched to fit into the resized bounding box.

Hint: In order to avoid distortions of the symbol you have to stretch it along the diagonal of the bounding box. Alternatively, you can select the object, then open “Object Selection Settings” and enter the required values in the Length and Width fields under “Parameters”.

ArchiCAD also allows you to adjust the pen and the line-type of auto-saved objects. 6 Select the North Symbol again with the Arrow Tool and then

open the “Object Selection Settings” dialog by double clicking on the Object tool or by clicking once on the Object Settings icon in the Info box.

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

Page 15: Creating GDL Objects E-Guide

1. SAVING 2D SYMBOLS FROM THE FLOOR PLAN

7 Under “Floor Plan and Section” uncheck the “Enable Object’s Pens” checkbox and change the “Symbol Line Pens” value to six.

8 Click OK to return to the floor plan and check the result.

1.4 FINAL TOUCHES

Our current object doesn’t have a preview picture associated with it. That makes it difficult to identify it in the object browser should there be many elements loaded. In this section we are going to learn how we can add a preview image and a short description to your object.1 Select the object and open the “Object Selection” dialog as

described above. Click on the “Preview options” buttons one by one.

Note that both the Preview picture and the Comment windows are empty.

2 Click Cancel to return to the floor plan.

3 Leaving the element selected, activate the “Open Object” command (File > Libraries and Objects > Open Object…).

This opens the selected element’s GDL Master Window.

Hint: Each GDL Object has its own Master Window. All controls needed to edit a GDL Object are present in the Master Window. Any number of GDL Object Master Windows can be open at the same time.

The elements of the GDL Master Window will be introduced in more detail in the next lessons.

AC Guide GDL Ch 01_04.mp4Watch Movie

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

Page 16: Creating GDL Objects E-Guide

1. SAVING 2D SYMBOLS FROM THE FLOOR PLAN

4 Click on the Preview Picture button.

The Preview picture window opens, even though it is empty at this 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 Files” types option is selected.

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).

8 Return to the GDL Master Window (Window > ITG North Symbol).

9 Click on the “Preview Picture” button and paste the content of the clipboard with the Paste command (Edit > Paste).

10 Close the “Preview Picture” window by clicking on the top 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

12 Close the Comments window.

13 Save your changes to the object with the Save command (File > Save) and close the GDL Master Window.

14 Back on the floor plan open the Object Selection Settings dialog then check the preview picture and comments added to the ITG North Symbol Object.

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

Page 17: Creating GDL Objects E-Guide

1. SAVING 2D SYMBOLS FROM THE FLOOR PLAN

15 Return to the floor plan with OK. Save the project file with Save (File > Save) and close it (File > Close).

1.5 USING THE 2D SYMBOL VIEW

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.

In this last chapter we’ll explain how you can create a symbol object that you can easily modify with just the standard ArchiCAD 2D editing tools.1 Open up the “ArchiCAD Guide” folder in the Navigator and

activate (by double-clicking) the “1.4 Use the 2D Symbol View” pre-set view in the “Chapter 1” folder. AC Guide GDL Ch

01_05.mp4Watch Movie

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

Page 18: Creating GDL Objects E-Guide

1. SAVING 2D SYMBOLS FROM THE FLOOR PLAN

2 Select the symbol with the area selection and copy it to the clipboard.

3 Create a new GDL object with “File > Libraries and objects > New Object...”.

The object’s GDL Master Window opens.

4 Click on the “2D Symbol” button.

The 2D symbol window opens.

If the actual scale of this window is other than 1:50 then please set it to 1:50 in the bottom-left corner of the dialog.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.

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

Page 19: Creating GDL Objects E-Guide

1. SAVING 2D SYMBOLS FROM THE FLOOR PLAN

7 Click outside the selection marquee or hit Enter to place the copied elements.

Please note that the 2D symbol window provides an environment similar to the ArchiCAD floor plan view. All the standards 2D tools (e.g., Line, Fill, Text) and editing commands (Trim, Rotate, Copy, etc.) can be used here to create the desired 2D symbol. Consequently, you don’t have to know GDL if you want to edit these elements. To demonstrate how easy it is to modify this object let’s add a few more hotspots to it.8 Activate the Hotspot tool and place a hotspot in the middle

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.

9 Click on the “Details” button in the currently open GDL Master window and in the opening dialog check the “Fit size to 2D symbol” checkbox. Close the dialog with OK.

The A and B parameters were automatically set according to the original size of the symbol.

Hint: You can also add a preview picture and comments to your object as described in Chapter 1.4.

10 Save the object as “ITG_North_Symbol_02” into the “ArchiGuide\ITG Library” folder with “File > Save”. Close the GDL Master window with OK.

11 Back on the floor plan place the newly created object with the Object Tool and check the result.

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

Page 20: Creating GDL Objects E-Guide

1. SAVING 2D SYMBOLS FROM THE FLOOR PLAN

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

12 Close the project with “File > Close”.

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

Page 21: Creating GDL Objects E-Guide

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

2. SAVING 3D MODELS FROM THE FLOORPLAN AS GDL OBJECTSThe previous chapter explained how you can save 2D symbol objects from the floor plan. In this lesson we’ll go one step further and make a 3D GDL object using only the standard ArchiCAD tools. This interactive training session demonstrates the following basic object-making techniques:• Three-dimensional ArchiCAD models can be saved automatically as

GDL objects. This process doesn’t require any GDL knowledge.• Any kind of ArchiCAD Tool can be used to develop 3D models

that can be saved as a GDL object

2.1 OVERVIEW

1 Open the “AC Guide GDL Ch 02.pla” ArchiCAD project file to start the second lesson of this interactive, hands-on ArchiCAD GDL training guide. Select the “Read elements directly from archive” option.

Before we start working let’s have a quick look at the object that we are going to model.2 Open up the “AC Guide GDL Chapter 02” folder in the

Navigator and activate (by double-clicking) the “2.1 Overview” pre-set view in the “Chapter 2” folder.

The Double Coffee Table known as “907B” was designed by Alvar Aalto in 1933. The table's two-tier design is unique given Aalto's output and is unusual in its construction. The lower tier is suspended from the tabletop so that it appears to float. For more info please visit the manufacturer’s website: www.artek.fi

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.

AC Guide GDL Ch 02_01.mp4Watch Movie

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

Page 22: Creating GDL Objects E-Guide

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

2.2 MODELING

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.

We start the modeling process by creating the double tabletops. The active view set shows only the contours of the elements to allow the use of the Magic Wand function.

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

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

The required Slab parameters are set for modeling the first main frame element.

AC Guide GDL Ch 02_02.mp4Watch Movie

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

Page 23: Creating GDL Objects E-Guide

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

5 Click OK on the “Slab Default Setting” dialog box to return to the floor plan.

6 Zoom in the bigger circle (the upper tabletop) 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 polygon.

7 Move the cursor over the bigger circle until the cursor’s shape shows that it has found a polygon, then click.

8 Open the Slab Tool again and click on the “Favorites” button.

9 Select “Lower Tabletop” from the list and click “Apply”.

10 Click “OK” on the Slab Default Setting dialog box to return to the floor plan.

11 Zoom in the smaller circle (the lower tabletop) 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 polygon.

12 Move the cursor over the smaller circle until the cursor’s icon indicates that it has found a polygon and click.

Now the two tabletops are ready (you can check them in the 3D window), so we can start creating the suspensions that connect them.13 Activate (by double-clicking) the “2.4 Model the

Suspensions” pre-set view in the Navigator.

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

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

Page 24: Creating GDL Objects E-Guide

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

14 Open the Column Tool and click on the “Favorites” button.

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

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

box to return to the floor plan.

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

18 Activate (by double-clicking) the “2.5 Model the Legs” pre-set view in the Navigator.

The floor plan shows the four lines where the legs need to be placed.

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

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

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

Page 25: Creating GDL Objects E-Guide

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

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

To revise the Wall’s profile click on Design > Complex Profiles > Profile Manager… and choose the “Table Leg” profile.

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

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

Now we are finished with the modeling.

2.3 CREATING THE GDL OBJECT

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:

AC Guide GDL Ch 02_03.mp4Watch Movie

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

Page 26: Creating GDL Objects E-Guide

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

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

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

Before we continue we have to understand the concept of auto-saving GDL. The rule is very simple: the viewpoint of the 3D window will define the top view of the automatically saved Library Part. Thus we 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.

Hint: You can check the actual 3D window setting if you activate the View > 3D View Mode > 3D Projection Settings command. As you can see in the opening dialog the Top view mode is active and the camera azimuth is set to 270°.

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

Page 27: Creating GDL Objects E-Guide

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

4 Activate the “File > Libraries and Objects > Save 3D Model as…” command.

5 In the opening dialog select a folder where you want to save the new object and enter “Coffee_Table_907B.gsm” in the “Save As:” field.

Hint: Make sure to save the object into a folder where you will be able to find it later. We suggest you store it near the currently open ArchiCAD file.

6 The “Save as Library Part” dialog opens. Select the Object type and turn on the “Remove redundant lines from symbol” and the “Editable GDL script” options. Click “Save” to create the object and to close this dialog.

Hint: The Editable GDL Script option allows us to make modifications in the object’s scripts later.

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

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

8 Double click on the Object Tool and make sure that “Coffee_Table_907B.gsm” is the active object. Click OK to return to the floor plan

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

Page 28: Creating GDL Objects E-Guide

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

9 Place the coffee table object on the floor plan with a click of the mouse where indicated by the label.

10 Activate (by double-clicking) the “2.10 Check 3D” pre-set view in the “Chapter 3” 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.

2.4 EDITING THE GDL OBJECT

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.

2 Activate the Arrow tool and make an area selection around the object.

AC Guide GDL Ch 02_04.mp4Watch Movie

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

Page 29: Creating GDL Objects E-Guide

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

Note that the object’s 2D symbol doesn’t contain a background fill, thus it can’t be selected with the Quick selection mode (Magnet) over its area. You either have to make a selection rectangle around it or you have to click on one of the bounding box corner points to select it. Furthermore, the floor plan symbol contains two line segments instead of real circles since the 2D symbol was 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.

As you can see the object doesn’t have a Preview Picture associated with it, thus it is difficult to identify in the object browser. Let’s fix these problems with some easy-to-learn techniques. 4 Click “Cancel” to return to the floor plan.

5 Keeping the object selected, activate the “File > Libraries and Objects > Open Object” command.

The 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

deal with the Preview Picture and the 2D Symbol. Other elements of the Master Window will be discussed in more detail in the following ITG chapters. Let’s start editing the object by enhancing the 2D symbol.6 Click on the “2D Symbol” button to open the 2D symbol

editing window.

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

Delete button on your keyboard.

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

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

Page 30: Creating GDL Objects E-Guide

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

8 Activate (by double-clicking) the “2.11 Edit the Object” pre-set view in the Navigator to return to the floor plan.

9 Select the new 2D symbol with the Arrow Tool on the top left corner of the floor plan.

Note that this enhanced 2D symbol drawing contains real circles, hotspots and a white background fill.10 Activate the “Edit > Copy” command.

11 Click on “Window > Coffee_Table_907B” to return to the object’s Master window.

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

elements to place them into the current view.

Before we continue with adding the Preview Picture let’s check that the 2D symbol was placed to the correct location as compared with the 3D model. This control step is always recommended when you modify the 2D symbol of an existing 3D object. Please take a look at the 2D symbol window and note that the center point of the tabletop is located in the origin of the coordinate system (the origin is marked with an “X”).14 Close the 2D Symbol window.

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

Page 31: Creating GDL Objects E-Guide

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

15 Open “View > 3D View Mode > 3D Projection Settings”, choose the top view and set the camera azimuth to 270.

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. One of them is marked with “L” (meaning Local Coordinate System), the other one is labeled with “G” (Global Coordinate System). The differences between the Local and the Global coordinate systems will be explained in a later chapter. At this stage all you have to know

about the 3D GDL coordinate system is that the Global Coordinate 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.

The 2D symbol is now at the correct location.Hint: ArchiCAD put hotspots on the bounding box of automatically saved GDL objects. If you want to turn them off you have to click on the “Details” button in the object’s GDL Master Window and uncheck the “Hotspots on bounding box” option in

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

Page 32: Creating GDL Objects E-Guide

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

the opening dialog. Once you have done this only the hotspots defined in the 2D symbol window will be displayed in the floor plan. The default hotspot in this case is always the one that was placed first when you made the symbol. In this example the default hostpot is in the center of the table.

20 Close the 2D Symbol window and click on the “Preview Picture” button.

The Preview Picture window, which is currently empty, opens. There are two ways to add a Preview Picture to a Library Part: you can copy an existing image from an external source, or you can create a new image in ArchiCAD (e.g., in the rendering window) and paste it to the Preview Picture window. We are going to copy a previously made picture.

Hint: The size of the preview window is 128x128 pixels. In order to avoid the distortion of the Preview Picture use rectangular

images for this purpose. If you want to make rendered images to be used as Preview Pictures make sure that the 3D window is set to a rectangular shape and the size of the photorendering window is exactly 128x128 pixels.

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.

23 Activate the “Edit > Copy” command.

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

Page 33: Creating GDL Objects E-Guide

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

24 Click on “Window > Coffee_Table_907B” to return to the object’s Master window.

25 Click on the “Preview picture” window to activate it and launch the “Edit > Paste” command.

The pasted image is added to the object’s Preview Picture window.

26 Close the Preview Picture window.

27 Save your changes with “File > Save”.

28 Close the object 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.

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

Part’s settings dialog.

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

Page 34: Creating GDL Objects E-Guide

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

The object is now displayed with its Preview Picture in the object browser. The parameter list contains the new material parameters. 32 Click OK to return to the floor plan. If you prefer you can

save this ArchiCAD project with “File > Save”. The

“Coffee_Table_907B” object will be available for later use from the folder where you saved it.

33 Close the project with “File>Close”.

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

Page 35: Creating GDL Objects E-Guide

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

3. ROTATING AUTO-SAVED OBJECTS. ADDING MATERIAL PARAMETERS TO LIBRARY PARTS.In this chapter we will show how you can change the 3D orientation of your automatically saved GDL objects without any GDL scripting. You will also learn how you can make the object’s materials parametric without any manual GDL coding. In this example an armchair laid on its side will be modeled with ArchiCAD tools. Then the model will be saved from its 3D side view window as a GDL object in order to create a chair that is standing on the floor. This lesson demonstrates the following basic object-making techniques:• The viewpoint of the 3D window (from where the model is saved

as a GDL element) defines the 3D orientation of the resulting Library Part.

• You can add material parameters to your objects with the use of the “Find & Replace” command.

3.1 OVERVIEW

1 Open the “AC Guide GDL Ch 03.pla” ArchiCAD project file to start the third 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 object that we are going to model.2 Open up the “AC Guide GDL Chapter 03” folder in the

Navigator and activate (by double-clicking) the “3.1 Overview” pre-set view in the “Chapter 3” folder.

The “Paimio Chair” - which has become a classic piece of furniture - was designed by Alvar Aalto for the Paimio Sanatorium in 1931-1932. The structure is made entirely of bent plywood. The frame is a birch color and the seating is available in lacquered white or black finish. For more information please visit the manufacturer’s website: www.artek.fi

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

AC Guide GDL Ch 03_01.mp4Watch Movie

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

Page 36: Creating GDL Objects E-Guide

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

3.2 MODELING

1 Open up the “AC Guide GDL Chapter 03” folder in the Navigator and activate (by double-clicking) the “3.2 Modeling Steps” pre-set view in the “Chapter 3” folder.

You can save precious time if you make a plan before you start modeling. We have chosen this chair for this lesson because it can be modeled relatively easily with just the standard ArchiCAD tools, provided that the object is laid on its side. We will model the chair in three steps: first we’ll create the main frames, then the bracings and finally the seating. All these elements will be modeled with the Slab tool. We’ll use the side elevation drawing of the chair as a construction aid.

2 Activate (by double-clicking) the “3.3 Model the Frames” pre-set view in the Navigator.

We start the modeling process by creating the main frames. The active view set shows only the contours of the main frame to allow for the use of the Magic Wand function. 3 Open the Slab Tool and click on the “Favorites”

button.

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

The required Slab parameters are set for modeling the first main frame element. 5 Click “OK” on the “Slab Default Setting” dialog

box to return to the floor plan.

6 Zoom in the main frame’s external contour 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 polygon.

7 Move the cursor over the frame’s external contour until the cursor’s shape shows that it has found a polygon, then click.

8 Select the slab with the Arrow and then activate the Slab Tool with one click.

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

AC Guide GDL Ch 03_02.mp4Watch Movie

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

Page 37: Creating GDL Objects E-Guide

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

9 Leave the slab selected, zoom on the frame’s internal contour and click on it with the Magic Wand (Space+click).

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 appears.

Now we have the two main frames ready (you can check them in the 3D window), so we can start creating the bracings that support the seating and connect the two frames.13 Activate (by double-clicking) the “3.4 Model the Bracings”

pre-set view in the Navigator.

The floor plan shows the contours of the three bracings. First we’ll 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.

18 Open the Slab Tool and click on the “Favorites” button.

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.

21 Keep the Space button pressed to activate the Magic Wand and click once over the third bracing’s contour.

The main frames and the bracings are finished.22 Activate (by double-clicking) the “3.3 Model the Seating”

pre-set view in the Navigator.

The floor plan shows the contour of the seating.

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

Page 38: Creating GDL Objects E-Guide

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

23 Open the Slab Tool and click on the “Favorites” button.

24 Select “Seating” from the list and click “Apply”.

The required Slab setting values are set for modeling the seating.25 Click “OK” on the Slab Default Setting dialog box to return

to the floor plan.

26 Keep the Space button pressed to activate the Magic Wand and click once over the first seating’s contour.

Now we have finished modeling.

Hint: The “Paimio” chair is available with hollowed and solid seating options. In this lesson we modeled the former. If you prefer the hollowed version you can model the seating with curved walls and place empty openings in it.

3.3 CREATING THE GDL OBJECT

1 Open up the “AC Guide GDL Chapter 03” folder in the Navigator and activate (by double-clicking) the “3.6 Check 2D” pre-set view in the “Chapter 3” folder.

The floor plan shows the complete model. If you’ve followed the previous steps you should see this figure:

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

AC Guide GDL Ch 03_03.mp4Watch Movie

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

Page 39: Creating GDL Objects E-Guide

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

The 3D window opens and you can check the consistency of your 3D model. Before we continue we have to understand the concept of auto-saving GDL. The rule is very simple: the viewpoint of the 3D window will be defined as the top view of the automatically saved Library Part. This concept allows users to easily rotate their custom GDL objects in space without the need for GDL scripting.3 Activate (by double-clicking) the “3.8 Open the Side View”

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°.

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.

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.

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

Page 40: Creating GDL Objects E-Guide

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

Hint: The Editable GDL Script option allows us to make modifications in the object’s scripts (e.g., to add new material 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.

9 Place the armchair object on the floor plan with a click of the mouse where indicated by the label.

10 Activate (by double-clicking) the “3.10 Check 3D” pre-set view in the “Chapter 3” folder.

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

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

Page 41: Creating GDL Objects E-Guide

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

3.4 EDITING THE GDL OBJECT

1 Open up the “AC Guide GDL Chapter 03” folder in the Navigator and activate (by double-clicking) the “3.11 Edit the Object” pre-set view in the “Chapter 3” folder.

2 Activate the Arrow tool and make an area selection around the object.

Note that the object’s 2D symbol doesn’t contain a background fill, thus it can’t be selected with the Quick selection mode (Magnet) over its area. You either have to make a selection rectangle around it or you have to click on one of the bounding box corner points to select it. 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.

4 Click Cancel to return to the floor plan.

5 Keeping the object selected activate the “File > Libraries and Objects > Open Object” command.

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 deal with the parameter list, the Preview Picture, the 2D Symbol and the 3D Script windows. Other elements of the Master Window will be discussed in more detail in the following ITG chapters. Let’s start editing the object by enhancing the 2D symbol.

AC Guide GDL Ch 03_04.mp4Watch Movie

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

Page 42: Creating GDL Objects E-Guide

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

6 Click on the “2D Symbol” button to open the 2D symbol editing window.

The 2D Symbol window is very similar to the floor plan window since you can use the standard ArchiCAD tools and editing techniques here, with the exception of the 3D elements (e.g., Walls, 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 us since it contains too many lines but no background fills or hotspots. Let’s delete all elements from the 2D symbol window.7 Activate the “Edit > Select All” command and then hit the

delete button on your keyboard.

All elements are cleared from the window. Now you can start drawing the required new symbol with the 2D ArchiCAD tools or you can copy an existing drawing from the floor plan. We’ll do the latter.8 Activate (by double-clicking) the “3.11 Edit the Object”

pre-set view in the Navigator to return to the floor plan.

9 Select the new 2D symbol with the Arrow Tool on the top left corner of the floor plan.

Note that this enhanced 2D symbol drawing contains fewer lines and a white background fill.10 Activate the “Edit > Copy” command.

11 Click on “Window > Armchair_Paimio” to return to the object’s Master window.

12 Click on the 2D Symbol window to activate it and launch the “Edit > Paste” command.

The content of the clipboard (the new symbol) is pasted into the active view. If the current zoom of the 2D symbol window is not big enough to include the pasted elements you’ll see a warning dialog. In that case select the following options:• “Paste to Original Location”• “Zoom to Pasted Elements”

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

Page 43: Creating GDL Objects E-Guide

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

13 Click outside the selection marquee around the pasted elements to place them into the current view.

14 Activate the Hotspot Tool and place hotspots on the corner points of the arms and the seating.

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.

15 Close the 2D Symbol window and click on the “Preview Picture” button.

The Preview Picture window, which is currently empty, opens. There are two ways to add a Preview Picture to a Library Part: you can copy an existing image from an external source or you can create a new image in ArchiCAD (e.g., in the rendering window) and paste it to the Preview Picture window. We are going to copy a picture from an external source.

Hint: The size of the preview window is 128x128 pixels. In order to avoid distortion of the Preview Picture use rectangular images for this purpose. If you want to make rendered images to be used as Preview Pictures make sure that the 3D window is set to rectangular shape and the size of the photorendering window is exactly 128x128 pixels.

16 Activate (by double-clicking) the “3.11 Edit the Object” pre-set view in the Navigator to return to the floor plan.

17 Activate the “File > Open…” command and select the “AaltoArmchair41Two” file in the “Chapter 03” folder. Make sure that the “All Files” types option is selected.

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

Page 44: Creating GDL Objects E-Guide

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

18 Activate the “Edit > Copy” command.

19 Click on “Window > Armchair_Paimio” to return to the object’s Master window.

20 Click on the “Preview Picture” window to activate it and launch the “Edit > Paste” command.

The pasted image is added to the object preview picture window.21 Close the Preview Picture window.

22 Save your changes with “File > Save”.

3.5 ADDING MATERIAL PARAMETERS

Before we can make the frame and the seating materials parametric we have to add two new parameters to the object’s parameter list. 1 Click on the “New” button to create a new

parameter.

2 Select the Variable field of the new parameter with the mouse and rewrite the default variable name to “frame_material”.

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 setting” dialog.3 Select the Type field and in the opening palette select the

Material parameter type.

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

AC Guide GDL Ch 03_05.mp4Watch Movie

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

Page 45: Creating GDL Objects E-Guide

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

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

This parameter description will be displayed in the Object Settings dialog.5 Click on the pop-up button near the Value field and select

“WD-Pine Horizontal” from the list. Alternatively, you can enter 15 in the “Value” field.

This will be used as the default value of the new parameter.6 Click on the “New” button to create an additional parameter.

7 Set the following parameter values:

• Variable: seating_material

• Type: Material

• Name: Seating Material

• Value: 18 (Paint-01)

Now we can open the 3D script, which describes the 3D model in GDL format. We have to modify the GDL code to use the newly created material parameters instead of the fixed material values stored in the script.8 Click on the “3D Script” button.

Don’t be frightened by the commands and numbers that you see in the script. You don’t have to understand the meaning of this code at this stage. Simply browse the text with the slider on the right side of the 3D script window and note that the following material descriptions appear in the script:• “Wd-Pine Horizontal”• “Paint-01”

These are the materials of the slabs that we used to model the chair on the floor plan. All we have to do now is to substitute them with the variable names of the newly created parameters:• "Wd-Pine Horizontal" --> frame_material• "Paint-01" --> seating_materialPlease note that text type parameter values are stored between quotation marks ("") in the GDL script. You don’t need 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 that can do this job automatically.9 Activate the “Edit > Find & Replace…” command.

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

Page 46: Creating GDL Objects E-Guide

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

10 Enter "Wd-Pine Horizontal" in the upper field of the dialog and “frame_material” in the bottom one.

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”.

Now the 3D script is using our custom parameters for material definitions. Let’s test the result of our changes.14 Click on the “3D View” button to see the object in the 3D

window. You can orbit in this window if you activate the “View > Orbit” command.

15 Close the 3D window and change the Values of the two material parameters. For instance you can set the “Paint-05” material for the seating.

16 Open the 3D View again and check the result of the parameter changes.

If the parameters have no affect on the 3D model or if you get an error message when opening the 3D view you must have made a mistake during the last steps. In that case you have to check the 3D script and the two parameters. The parameter variable names in the 3D script and on the parameter list have to be identical. You also have to avoid ‘0’ parameter values.17 Close the 3D view and save the last changes with “File >

Save”.

18 Close the object Master Window.

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

Page 47: Creating GDL Objects E-Guide

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

19 Back on the floor plan, select the object with the arrow tool.

Note that the 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.

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.

22 Close the project with “File > Close”.

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

Page 48: Creating GDL Objects E-Guide

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

4. AUTO SAVING RECTANGULAR DOORS. CREATING CUSTOM DOOR PANELS.This chapter is dedicated to making custom rectangular doors in ArchiCAD. We’ll introduce two ways you can create such objects without GDL scripting. The first method can be used if you have to model the entire door object from scratch. The second one allows you to apply custom door panels to standard ArchiCAD library door objects. This lesson covers the following topics:• Rules for creating doors in ArchiCAD• Modeling rectangular doors on the floor plan• Using custom door panels with standard ArchiCAD library doors

4.1 OVERVIEW

1 Open the ‘AC Guide GDL Ch 04.pla’ ArchiCAD project file to start the fourth lesson of this interactive, hands-on ArchiCAD GDL training guide. Select the “Read elements directly from archive” option.

Before we start working let’s have a quick look at the door that we intend to model.2 Open up the “AC Guide GDL Chapter 04” folder in the

Navigator and activate (by double-clicking) the “4.1 Overview” pre-set view in the “Chapter 4” folder.

“Prairie School” was a late 19th and early 20th century architectural style, most common to the Midwestern United States. “Prairie” style door and window panels are still widely used in North America in different variations. This version of Prairie panels is a relatively simple one that divides the glazing into 9 parts with four grilles.

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

AC Guide GDL Ch 04_01.mp4Watch Movie

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

Page 49: Creating GDL Objects E-Guide

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

4.2 MODELING

1 Open up the “AC Guide GDL Chapter 02” folder in the 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

elements in the x-y plane. See the illustrations at the bottom of this project view.2 Activate (by double-clicking) the “4.3 Model the Door

Frame” pre-set view in the Navigator.

We start modeling with the door frame. The active view set shows only the contours of the frame to allow for easy use of the Magic Wand.

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

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

AC Guide GDL Ch 04_02.mp4Watch Movie

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

Page 50: Creating GDL Objects E-Guide

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

The required Slab parameters are set so that we can model the door frame element. 5 Click “OK” on the “Slab Default Setting” dialog

box to return to the floor plan.

6 Move the cursor over the door frame’s polygon and hold down the Space button on the keyboard to activate the Magic Wand function. The cursor’s shape changes to a magic wand, indicating that ArchiCAD will automatically trace the contours of the clicked element.

7 Click with the mouse.

Let’s continue the modeling with the door leaf.8 Activate (by double-clicking) the “4.4 Model the Door

Panel” pre-set view in the Navigator.

The floor plan shows the 2D outlines of the door leaf.

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

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

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

box to return to the floor plan.

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

Page 51: Creating GDL Objects E-Guide

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

12 Activate the Magic Wand (press the Space button) and click on the external contour of the door panel.

13 Hold down the Shift key and select the slab with a click of the mouse.

14 Make sure that the Slab Tool is still active.

15 Activate the Magic Wand and click on the glazing’s contour. Deselect the slab.

The hole for the glazing is cut from the slab.16 Open the Slab Tool again and click on the

“Favorites” button.

17 Select “Glazing” from the list and click “Apply”.

18 Click “OK” on the “Slab Default Setting” dialog box to return to the floor plan.

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

Page 52: Creating GDL Objects E-Guide

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

19 Activate (by double-clicking) the “4.5 Model the Window Grilles” pre-set view in the Navigator.

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”.

The required Slab setting values are applied, so now we can start 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.

We are now finished with the door modeling, so let’s save the GDL door object.

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

Page 53: Creating GDL Objects E-Guide

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

4.3 CREATING THE GDL OBJECT

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

The floor plan shows the complete model. If you’ve followed the previous steps precisely you should see the figure as above.2 Activate the Arrow Tool and select all the door model

elements with a rectangular selection.

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

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

This view set shows the model from a generic axonometric view. Unlike in the case of a generic auto-saved GDL object, the 3D viewpoint doesn’t have any affect on the resulting GDL door object. 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.

AC Guide GDL Ch 04_03.mp4Watch Movie

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

Page 54: Creating GDL Objects E-Guide

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

4 Activate the “File > Libraries and Objects > Save 3D Model as…” command.

5 In the opening dialog select a folder in which you want to save the new object and enter “Door_Prairie_Style.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 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.

Hint: The Editable GDL Script option allows us to make modifications in the object’s scripts at any time.

7 Open up the “AC Guide GDL Chapter 04” folder in the Navigator and activate (by double-clicking) the “4.8 Place the Door” pre-set view in the “Chapter 4” folder.

The floor plan shows a solid wall and indicates the point where you can place the recently made custom door.

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.

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

Page 55: Creating GDL Objects E-Guide

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

10 Place the Door object on the floor plan with two mouse clicks where indicated by the label.

The first click defines the location of the door in the wall and the second one determines the opening direction of the leaf.

11 Activate (by double-clicking) the “4.9 Check 3D” pre-set view in the “Chapter 4” folder.

The rectangular hole was automatically created in the wall. The 3D model is now finished, but the 2D symbol is far from complete. It contains too many lines and the opening line is not shown. Let’s fix these problems.

4.4 EDITING THE GDL OBJECT

1 Activate the Arrow tool and select the door.

2 Keeping the object selected, activate the “File > Libraries and Objects > Open Object” command.

The GDL Master Window opens.3 Click on the 2D Symbol button to open the 2D symbol

editing window.

AC Guide GDL Ch 04_04.mp4Watch Movie

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

Page 56: Creating GDL Objects E-Guide

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

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.

All unnecessary lines are cleared from the door.5 Complete the 2D symbol using the “Line” and the “Circle”

Tools as shown below.

6 Close the 2D Symbol window.

7 Save your changes with “File > Save”.

8 Close the GDL Master Window.

9 Back on the floor plan, check the result of your last changes.

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

Page 57: Creating GDL Objects E-Guide

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

Our custom door is now complete, although - compared to the standard door objects of the ArchiCAD library - its capabilities are limited. Let’s just list a few of these missing features:• The size and material of door components (e.g., frame) are not

parametric.• No optional door accessories (e.g., trim, sill, header, shutter,

handle) are available.• The floor plan symbol is not scale sensitive.• The door leaf can’t be opened with editable hotspots in 2D and

3D views.In the next part of this Interactive Training Guide Chapter we’ll explain how you can create and use custom door panels with standard ArchiCAD door library objects.

4.5 CREATING CUSTOM DOOR PANELS

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

ArchiCAD “Library/Custom Object Macros” folder and they are loaded by default from the ArchiCAD startup file.

• Elements of the custom object macro folder can’t be loaded in archive format (i.e., no pla or lcf library file format allowed).

Our currently open ArchiCAD file is an archive project (pla file) that refers to the archived library included within itself. Before we can start using custom components we have to load the custom object macros in uncompressed format.1 Activate the “File > Libraries and Objects > Library

Manager...” command

2 Click on the “Local LAN” tab page and on the left side of the dialog locate the “Object Macros” folder in the “Chapter 04” folder of this Interactive Training Guide. Alternatively, you can find these macros in the standard ArchiCAD library folder.

AC Guide GDL Ch 04_05.mp4Watch Movie

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

Page 58: Creating GDL Objects E-Guide

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

3 Select the folder and click on the “Add” button. Click “Done” to load the required library.

4 Open up the “AC Guide GDL Chapter 04” folder in the Navigator and activate (by double-clicking) the “4.10 Save a Custom Door Panel” pre-set view in the “Chapter 4” folder.

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 Chapter.

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

Page 59: Creating GDL Objects E-Guide

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

Please also note that the bottom of the door panel model has to be on the zero level for correct 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.

6 Activate the “File > Libraries and Objects > Save Custom Component” command.

7 Select the “Custom Door Panel” Type from the opening dialog.

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 a folder where you will be able to find it later. We suggest you store it near the currently open ArchiCAD file.

After you’ve saved the file, a new dialog appears and informs you about how you can use your custom panel.

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

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

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

Page 60: Creating GDL Objects E-Guide

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

10 Activate the “File > Libraries and Objects > Library Manager...” command.

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.

The floor plan shows a standard single door from the ArchiCAD library. Currently a simple flush door panel is selected for it.13 Activate the Arrow Tool and select the door.

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

15 Open the “Internal Door Settings” tab page and select the “Door Panel” from the pop-up menu.

16 Browse through the available panel styles and select “Custom Panel” at the end of the list.

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

Page 61: Creating GDL Objects E-Guide

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

17 Locate the “Custom Panel Name” parameter on the active tab page and select “Prairie Style Panel”.

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

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

The custom panel fits perfectly into the door opening. Furthermore, all the parametric features of ArchiCAD doors are at your disposal, such as the optional trim, sill and handle elements. Finally, you can open the door leaf with editable hotspots as described in the next steps.

20 Activate the Arrow Tool and select the door.

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

22 Select the first item in the Pet Palette (“Move Node”) and open the door by moving the mouse.

Now let’s change the door opening angle on the floor plan as well.23 Close the 3D window to return to the floor plan.

24 Activate the Arrow Tool and select the door.

25 Click on the magenta hotspot located at the corner of the door leaf.

26 Select the last item in the Pet Palette (“Stretch”) and modify the door opening angle by moving the mouse.

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

Page 62: Creating GDL Objects E-Guide

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

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

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

Page 63: Creating GDL Objects E-Guide

5. Auto Saving Non-rectangular Windows.

5. AUTO SAVING NON-RECTANGULAR WINDOWS. This chapter is dedicated to making custom non-rectangular windows in ArchiCAD. We’ll introduce how you can model such objects without GDL scripting and how you can enhance them with some simple techniques. This lesson covers the following new topics:• Rules for creating windows in ArchiCAD• Modeling non-rectangular windows on the floor plan• Creating Preview Pictures with the Lightworks rendering engine

5.1 OVERVIEW

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.

2 Open up the “AC Guide GDL Chapter 05” folder in the Navigator and activate (by double-clicking) the “5.1 Overview” pre-set view in the “Chapter 5” folder.

The circular window shown on the floor plan is a typical example of Decorated Style gothic rose windows. The window is unglazed and divided by profiled stone traceries.

Hint: If you want to check the complete window object, open the Window Tool and locate the “Gothic_Rose_Window_Final” Library Part in the Library Part browser. The window is located in the “Finished Objects” folder.

AC Guide GDL Ch 05_01.mp4Watch Movie

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

Page 64: Creating GDL Objects E-Guide

5. Auto Saving Non-rectangular Windows.

5.2 MODELING

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” pre-set view in the Navigator.

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 Magic Wand.

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

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

The required Slab parameters are set so that we can start modeling the mullions.

AC Guide GDL Ch 05_02.mp4Watch Movie

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

Page 65: Creating GDL Objects E-Guide

5. Auto Saving Non-rectangular Windows.

5 Click “OK” on the Slab Default Setting dialog box to return to the floor plan.

6 Move the cursor over the exterior circle 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.

8 Select the slab and activate the Slab Tool again.

9 Hold down the Shift key and click on the contours of the internal polygons with the Magic Wand.

The required holes are added to the slab. Now let’s model the profile of the mullions with the Slab Tool.

10 Activate (by double-clicking) the “5.4 Add the Mullion Profile” pre-set view in the Navigator.

The floor plan shows the 2D outlines of the mullion profiles.

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

12 Select the “Mullion Profile” option from the list and click “Apply”.

The required Slab parameter values are set, so now you can add the profile to the traceries.

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

Page 66: Creating GDL Objects E-Guide

5. Auto Saving Non-rectangular Windows.

13 Click “OK” on the Slab Default Setting dialog box to return to the floor plan.

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

Hint: You can regulate the segmentation of curved elements made with the Magic Wand in the “Magic Wand” settings. You have to set the required values prior to creating the model elements with the magic wand.

15 Hold down the Shift key and select the slab with a click of the mouse.

16 Make sure that the Slab Tool is still active.

17 Activate the Magic Wand (with the Space key) and click on the contours of the internal polygons.

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:

As a rule, ArchiCAD always cuts a rectangular opening for auto-saved doors and windows, unless you define a custom opening contour with a special model element (see the description in the next step). If you have a closer look at the picture you can also see that the size of the opening is equal to the bounding box size of the model. In the next

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

Page 67: Creating GDL Objects E-Guide

5. Auto Saving Non-rectangular Windows.

step – which is very important - we’ll show you how you can define 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 floor plan shows the contour of the rectangular opening.19 Open the Slab Tool again and click on the

“Favorites” button.

20 Select “Wall Opening” from the list and click “Apply”.

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.

22 Click “OK” on the Slab Default Setting dialog box to return to the floor plan.

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

Page 68: Creating GDL Objects E-Guide

5. Auto Saving Non-rectangular Windows.

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

Now we are finished with the modeling part so, let’s save the GDL window object.

5.3 CREATING THE GDL OBJECT

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.

The floor plan shows the complete model. If you’ve followed the previous steps precisely, you should see the same figure as above.2 Activate the Arrow Tool and select all the rose window model

elements with a rectangular selection.

AC Guide GDL Ch 05_03.mp4Watch Movie

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

Page 69: Creating GDL Objects E-Guide

5. Auto Saving Non-rectangular Windows.

3 Activate (by double-clicking) the “5.7 Save the Rose Window” pre-set view in the Navigator.

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

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 Parts’ coordinate system is rotated so that the x-y plane is vertical and the z-axis points horizontally into the wall. Note that the black slab marked with the WALLHOLE ID will not be included in the resulting GDL object. However, it will be implemented as a circular hole in the wall.4 Activate the “File > Libraries and Objects > Save 3D Model

as…” command.

5 In the opening dialog select a folder in which you want to save the new object and enter “Gothic_Rose_Window.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 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.

Hint: The “Editable GDL Script” option allows us to make modifications (e.g., add material parameters) in the object’s scripts at any time.

7 Open up the “AC Guide GDL Chapter 05” folder in the Navigator and activate (by double-clicking) the “5.8 Place the Window” pre-set view in the “Chapter 5” folder.

The floor plan shows a solid wall and indicates the point where you should place the rose window object.

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

Page 70: Creating GDL Objects E-Guide

5. Auto Saving Non-rectangular Windows.

8 Double click on the Window Tool and make sure that “Gothic_Rosw_Window.gsm” is the active object. Click OK to return to the floor plan.

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.

10 Activate (by double-clicking) the “5.9 Check 3D” pre-set view in the “Chapter 5” folder.

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

Page 71: Creating GDL Objects E-Guide

5. Auto Saving Non-rectangular Windows.

Note that the circular hole is automatically created in the wall and the black slab is excluded from the model. The 3D model is now finished, although the 2D symbol is far from complete. It contains too many lines that look bad on printouts. Let’s fix this problem first.

5.4 ENHANCING THE 2D SYMBOL

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.

2 Activate the Arrow tool and select the window.

3 Keeping the window selected, activate the “File > Libraries and Objects > Open Object” command.

The GDL Master Window opens.

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

AC Guide GDL Ch 05_04.mp4Watch Movie

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

Page 72: Creating GDL Objects E-Guide

5. Auto Saving Non-rectangular Windows.

The current symbol, which was derived from the 3D model, is not suitable for us as it contains too many line segments.5 Activate the Arrow Tool and select all lines with the area

selection.

6 Delete the selected elements by hitting the “Delete” key.

The 2D symbol window is cleared.7 Click on the floor plan area to return to the floor plan.

8 Select the previously drawn enhanced 2D window symbol at the bottom of the floor plan with the Arrow Tool.

9 Put the selected elements on the clipboard with “Edit > Copy”.

10 Return to the GDL Master Window with “Window > Gothic_Rose_Window”.

11 Activate the 2D Symbol window and the paste the content of the clipboard with “Edit > Paste”.

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”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 mullion material parametric.

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

Page 73: Creating GDL Objects E-Guide

5. Auto Saving Non-rectangular Windows.

5.5 ADDING MATERIAL PARAMETERS

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 standard window parameters that are used in all ArchiCAD library window objects. At this stage we want to use only the Frame Material parameter for the traceries, so let’s hide the list’s unnecessary parameters.1 Hide each parameter on the list with the Hide Parameter

icon, except for “A”, “B”, “gs_window_material” and “gs_frame_mat”.

We’ll use the “gs_frame_material” variable for the mullion material. If you wish, you can change the parameter name from “Frame Material” to “Mullion or Tracery Material”. Let’s open the 3D script, which describes the 3D model in GDL format. We have to modify the GDL code in order to use the chosen material parameter instead of the fixed material values stored in the script.2 Click on the 3D Script button.

The 3D script window allows you to explore the GDL description of the slabs that we used to model the window on the floor plan. All we have to do now is to substitute the material names with the variable name of the material parameter:• "Stn-Marble White" --> gs_frame_material

AC Guide GDL Ch 05_05.mp4Watch Movie

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

Page 74: Creating GDL Objects E-Guide

5. Auto Saving Non-rectangular Windows.

Hint: Please note that text type parameter values are stored between quotation marks ("") in the GDL script. You don’t need 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 do this job automatically.3 Activate the “Edit > Find & Replace…” command.

4 Enter "Stn-Marble White" in the upper field of the dialog and “gs_frame_material” in the bottom field.

Hint: You can copy these texts straight from the 3D script and the parameter’s Variable name field.

5 Click on the “Replace All” button.

Now the 3D script is referring to the frame parameter for material definitions. Let’s test the results of our changes.6 Click on the 3D View button to see the object in the 3D

window. You can orbit in this window if you activate the “View > Orbit” command.

The rose window is displayed with wood material, which is the current value of the Frame Material parameter.

7 Close the 3D window and and set “Stn-Marble Pink” or number “6” for the Frame Material parameter.

8 Open the 3D View again and check the result of the parameter changes.

Hint: If the material parameter has no affect on the 3D model or if you get an error message when opening the 3D view, you must have made a mistake during the last steps. In that case you have to double check the 3D script and the parameter. The parameter variable name in the 3D script and on the parameter list must be identical. You also must avoid ‘0’ parameter values.

9 Save your changes with “File > Save”.

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

Page 75: Creating GDL Objects E-Guide

5. Auto Saving Non-rectangular Windows.

5.6 MAKE A PREVIEW PICTURE WITH LIGHTWORKS

1 Click on the “Preview Picture” button.

The Preview Picture window opens. It is currently empty. This may prevent other users from finding this window in the Library Part browser. In the previous lessons we have shown how you can copy an existing image into the Preview Picture window. Now let’s make a nice preview image with the Lightworks rendering engine.There are a few things that you have to consider before you start making Preview Pictures: • The size of the Library Parts’ Preview window is always 128x128

pixels. • If you want to use rendered images as Preview Pictures, make sure

that the 3D window is rectangular • In order to avoid any loss in Preview Picture quailty, set the

photorendering window size to 128x128 pixels.2 Activate (by double-clicking) the “5.11 Make a Preview

Picture” pre-set view in the Navigator to return to the floor plan. Do not close the GDL Master Window at this time.

Note that the floor plan already contains two special light objects (SkyObject, SunObject) that are essential when making high quality images with the LightWorks rendering engine.3 Select the rose window in the wall and open its “Window

Settings” dialog.

4 Set the frame material parameter to “Stn-Marble White”.

5 Click “OK” to return to the floor plan and deselect the window.

6 Open the 3D Window (“View > Elements in 3D View > Show All in 3D”).

AC Guide GDL Ch 05_06.mp4Watch Movie

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

Page 76: Creating GDL Objects E-Guide

5. Auto Saving Non-rectangular Windows.

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

8 Turn off the “Keep Proportions” option and set the window size to 600x600 pixels.

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

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

Let’s adjust the photo rendering parameters to get a nice rendered image.11 Activate the “Document > Creative Imaging >

Photorendering Settings” command.

12 Modify the rendering parameters as shown on the picture.

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

Page 77: Creating GDL Objects E-Guide

5. Auto Saving Non-rectangular Windows.

• Engine --> LightWorks Rendering Engine• Method --> Best• Effects --> All turned on• Shadow casting --> By lamp settings• Light sources --> Only Lamps is active

• Shadow Resolution --> By lamp settings• Background --> Sky and Ground color is black

Hint: You may play with these parameters and find the settings you think are best.

13 Close the “PhotoRendering Settings” dialog with “OK”.

14 Start the photo rendering process with “Document > Creative Imaging > Photorendering Projection”.

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

16 Copy the content of the marquee onto the clipboard with “Edit > Copy”.

17 Return to the GDL Master window with “Window > Gothic_Rose_Window”.

18 Click on the “Preview Picture” button.

19 Paste the content of the clipboard into the Preview Picture window with “Edit > Paste”.

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

Page 78: Creating GDL Objects E-Guide

5. Auto Saving Non-rectangular Windows.

20 Close the Preview Picture window and save the changes with “File > Save”.

21 Close the GDL Master Window to return to the floor plan.

22 Back on the floor plan, select the rose window that is placed in the wall.

23 Open the “Window Settings” dialog.

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

24 Click “OK” to return to the floor plan. If you prefer, you can save this ArchiCAD project with “File > Save”. The “Gothic_Rose_Window” object will be available for later use in the folder where you saved it.

25 Close the project with “File > Close”.

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

Page 79: Creating GDL Objects E-Guide

6. Basics of GDL Scripting

6. BASICS OF GDL SCRIPTINGIn this chapter you will start using GDL commands. The object that we’ll use as an example is a simple circular tabletop with a round leg.You will work in the Library Part Editor Window and learn about the various elements of this environment:• The Object Hierarchy (Subtypes)• ZZYZX Parameter• The Global Coordinate System and the Local Coordinate System• 3D Script and 3D View, plus 2D Script and 2D Full View windows• Parameter Script Window• 3D hotspots of ObjectsThis lesson demonstrates the following basic object-making techniques:• Using basic 3D shape generating commands• Using parameters in GDL commands to make objects parametric• Manipulating the Local Coordinate System (moving, mirroring),

undoing coordinate transformations• Using commands to set materials• Checking the created model in 3D for correctness

6.1 OVERVIEW

1 To start the sixth lesson of this interactive, hands-on ArchiCAD GDL training guide, open “AC Guide GDL Ch 06.pla”. Select the “Read elements directly from archive” option.

Let’s have a look at the object that we are going to model.2 Open up the “AC Guide GDL Chapter 06” folder in the View

Map of the Navigator palette and activate (by double-clicking) the “6.1 Overview” saved view in the “Chapter 6” folder.

The pedestal table shown on the picture was designed by the famous Swedish furniture designer Ben af Schulten. It is made of natural lacquered birch. The pedestal on which it stands may be chrome, white or black lacquered. The leg is made of birch. Its top material may be birch veneer, linoleum or laminate. For more information please visit the manufacturer’s website: www.artek.fi

AC Guide GDL Ch 06_01.mp4Watch Movie

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

Page 80: Creating GDL Objects E-Guide

6. Basics of GDL Scripting

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.

.

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.

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

Page 81: Creating GDL Objects E-Guide

6. Basics of GDL Scripting

Subtypes are arranged in a hierarchy. Subtypes at any given level of the hierarchy are based on the Subtype immediately above them in the hierarchy and its inherit behavior and parameter set. Further, they can have their own special behavior and parameters.5 In the hierarchy select “General GDL Object > Model

Element > Opening > Roof Opening > Skylight”, and click the “Select” button.

The default parameter list of the Object has changed.

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.

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

Page 82: Creating GDL Objects E-Guide

6. Basics of GDL Scripting

6.2 CREATING PARAMETERS

We will now create the necessary parameters that we are going to use in our Object.1 Go back to the Floor Plan of ArchiCAD, and activate (by

double-clicking) the “6.2 Creating Parameters” saved view in the “Chapter 6” folder of the Navigator.

The Floor Plan Window shows which dimensions and attributes of the Object we want to make parametric. These include:• Radius_Top: The radius of the circular tabletop• Thickness_Top: The thickness of the circular tabletop• Radius_Leg: The radius of the circular leg of the table• Material_Top: The material assigned to the table top• Material_Leg: The material assigned to the leg of the table• Material_Bottom: The material assigned to the pedestal on

which the table stands (also the material of the conical shape below the table top)

• ZZYZX: the Height of the TableHint: It is good practice to create descriptive variable names so that later you can easily identify what they control or specify. Please note that ArchiCAD reserves certain variable names. These names are called keywords and they included names of GDL functions, operators, etc. You can find a list of these on Page 265 of the AC GDL Reference Guide.

2 Let us start creating these parameters. Select the “Window > Untitled-1” menu item. “Untitled-1” is currently the name of the GDL Library Part we started creating.

3 Using the same procedure you learned in previous chapters of this tutorial, create the following variables and set them to the values contained in the table below.

AC Guide GDL Ch 06_02.mp4Watch Movie

Variable Type Name Value

Radius_Top Length Radius of tabletop

375

Thickness_Top Length Thickness of tabletop

40

Radius_Leg Length Radius of table leg

30

Material_Top Material Material of tabletop

15 (Wd-Pine Horizontal)

Material_Leg Material Material of leg 15 (Wd-Pine Horizontal)

Material_Bottom Material Material of bottom element

13 (Mtl-Chrome)

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

Page 83: Creating GDL Objects E-Guide

6. Basics of GDL Scripting

Hint: As you created these variables you may have noticed that they are displayed in the color black in the list. The rule is that default parameters are displayed in blue, and user-created parameters are displayed in black.

4 Modify the default Name and Value fields of the ZZYZX default parameter. For “Name” enter “Height of table”, and for “Value” enter “710”.

We did not create the variable ZZYZX in the previous step, because this is a default variable already available. The ZZYZX variable always defines the full height of the Object. Using the ZZYZX default variable enables you to later vertically stretch your created Object by displaying 3D hotspots with which you can grab and stretch the Object.Also, the ZZYZX default variable can be set directly in the Settings Dialog of the Object or in the Info Box.You could create and use another parameter to control the height of the Object, but it would not make the Object vertically stretchable and you would have to go to the Settings Dialog to modify it.

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

Page 84: Creating GDL Objects E-Guide

6. Basics of GDL Scripting

6.3 CREATING THE 3D GEOMETRY

1 Click the “3D View” button to display the 3D View of the Editor.

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.

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 Local Coordinate System.As default, these two coordinate systems are located at the same point.There are coordinate transformation commands in GDL that let you 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 two buttons produce different behaviors. If you click the “3D Script” button, the 3D Script will be displayed in the Editor Window

AC Guide GDL Ch 06_03.mp4Watch Movie

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

Page 85: Creating GDL Objects E-Guide

6. Basics of GDL Scripting

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

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

The “AC GDL Reference Guide PDF” file is opened in Acrobat Reader. When we start using a new command, we will find its exact syntax in the GDL Reference Guide and copy-paste it from there. This way we will only need to modify the values in the command, thereby eliminating possible error messages resulting from incorrect syntax.4 Go to Page 33 in the AC GDL Reference Guide and find the

description of the CONE command there.

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

6 Go back to the ArchiCAD window and click in the 3D Script Window of the Object. Paste (CTRL+V) the GDL code into the 3D Script Window.CONE h, r1, r2, alpha1, alpha2

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

Page 86: Creating GDL Objects E-Guide

6. Basics of GDL Scripting

The syntax of a GDL command is as follows:• First comes the name of the keyword (CONE in this case)• 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.

h means the height of the Cone, r1 and r2 specify the radius of the Cone at its base and at its highest level, respectively. alpha1 and alpha2 are inclinations of the end surfaces of the Cone relative to its vertical axis.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.

Hint: As a default, length/area/volume values are given in meters in all GDL scripts. It is also possible to specify them in imperial units (e.g., 1/2" or 1'-3 1/2"). Further, when specifying values with a leading zero, it is not necessary to type in the leading zero. So 0.06 and .06 are equally correct.

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 Script:ADDZ .06

This command shifts the position of the Local Coordinate System .06 meters in the positive direction along the z-coordinate of the Local Coordinate System.9 Activate the 3D View.

You will see that the Global Coordinate System origin and the Local Coordinate System origin are now not at the same location. The Cone is already generated, and we moved the Local Coordinate System origin to the top of the Cone so that we can script the next element in the GDL Object from that position.

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

Page 87: Creating GDL Objects E-Guide

6. Basics of GDL Scripting

10 In the GDL Reference Guide, find the description of the CYLIND command (Page 31). Copy its syntax code (CYLIND h, r) to the Clipboard.CYLIND h, r

This command will create a cylindrical shape. The height of the shape will be the value defined by the h parameter, and its radius is defined by the r parameter. The center of its base will be located at the origin of the Local Coordinate System and its body will be generated in the positive direction.11 Go to the 3D Script and paste the syntax code into the next

line.

12 Modify the code to the following:CYLIND .05, Radius_Leg

This way the Radius_Leg parameter will be used to specify the radius of this element.

13 Enter the following command in the next line of the 3D Script:ADDZ .05

We again move the position of the Local Coordinate System .05 meters along the z-axis in the positive direction. Should you wish to view the progress of the model anytime after finishing a command, you can enter the 3D View to check it.14 Enter the following command in the next line of the 3D

Script:Height_Leg = ZZYZX-Thickness_Top-.04-.05-.06

The next element we need to create is the leg portion of the Table. If 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.

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

Page 88: Creating GDL Objects E-Guide

6. Basics of GDL Scripting

15 Enter the following command in the next line of the 3D Script:CYLIND Height_Leg, Radius_Leg

In creating the leg portion, we use this new variable in the CYLIND command. 16 Enter the following command in the next line of the 3D

Script:ADDZ Height_Leg+.04

With this instruction, we again shifted the Local Coordinate System. At this point in time it is located at the bottom plane of the table top as planned. If you activate the 3D View, you can see where the Local Coordinate System origin is located. The reason we did that is because we need to create an upside-down Cone. The next two commands will explain why this is necessary.

17 Enter the following command in the next line of the 3D Script:MULZ -1

The MULX, MULY, and MULZ commands invert the direction of the respective axes of the Local Coordinate System. Activate the 3D View and see that the z-axis now points downward. The x and y-axes point in the original directions.

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

Page 89: Creating GDL Objects E-Guide

6. Basics of GDL Scripting

This basically has the same effect as if we mirrored the Local Coordinate System on its x-y plane. Since elements are always created relative to the position of the Local Coordinate system, a cone will now be generated downward, which was our purpose with this step.18 Enter the following command in the next line of the 3D

Script:CONE .04, .15, Radius_Leg, 0, 0

ArchiCAD will display an error message saying that you have a Parameter error.

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 correction.In this case, the problem (after consulting the GDL Reference Guide) is that the last two parameters (the angle parameters) must be greater than zero.19 Modify the last line of the 3D Script to the following:

CONE .04, .15, Radius_Leg, 90, 90

This will generate the upside-down Cone. Activate the 3D View to see the result. As you can see the upside-down Cone adjoins the top of the leg portion. This is why in Step 16 we moved the Local Coordinate System by the value of the leg (Height_Leg) plus the height of the upper cone (.04).

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

Page 90: Creating GDL Objects E-Guide

6. Basics of GDL Scripting

20 Enter the following command in the next line of the 3D Script:DEL 1

The DEL command undoes coordinate transformations. By coordinate transformation we mean any command that alters the position, direction or unit length of any or all of the Local Coordinate System axes. The parameter (1) following the command name (DEL) instructs the program to undo 1 coordinate transformation. The last such transformation was the MULZ –1 command. This is what is undone in this step. By activating the 3D View, you can see that the Local Coordinate System returned to its state prior to the MULZ -1 coordinate transformation.

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

This will create the tabletop. Its height will be the value specified by the Thickness_Top parameter, and its radius will be the value specified by the Radius_Top parameter. Here you can see the utility of giving descriptive parameter names: you look at the command and know exactly what it does.

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

Page 91: Creating GDL Objects E-Guide

6. Basics of GDL Scripting

With this last command, we finished creating the 3D model of the Table. 22 Enter the following command in the next line of the 3D

Script:DEL TOP

When the DEL command is followed by the TOP parameter, it instructs ArchiCAD to delete (undo) all coordinate transformations. This will result in the Local Coordinate System origin returning to its position coinciding with the Global Coordinate System origin.23 Activate the 3D View to see the whole model.

As you can see, the entire model is complete. Move around the model using the ArchiCAD’s Orbit feature (hold down the SHIFT key and the middle mouse key simultaneously, and move around with the mouse). You will also see that the Global and Local Coordinate Systems are coincident.

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

Page 92: Creating GDL Objects E-Guide

6. Basics of GDL Scripting

6.4 ASSIGNING MATERIALS

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_stringSET] MATERIAL index

The [SET] portion of the command is in parentheses because it is an optional element. The command can be MATERIAL or [SET] MATERIAL: either one is correct. Materials defined in ArchiCAD all have a name and an index number. An example of a name is Wd-Pine Horizontal. An example of an index number is 15. Of course this can also be the name of a variable.The MATERIAL command works by setting the current material to be used in all subsequent 3D elements generated until another MATERIAL command changes it.

Hint: There are certain commands that include material specification in the command as part of the parameter list. Elements created with these commands will use their own materials, while all other elements not having their own material defined in their command will use the material defined in the MATERIAL command.

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 so it will look like this:[SET] MATERIAL indexCONE .06, .25, Radius_Leg, 90, 90

3 Modify the command to the following:MATERIAL Material_BottomCONE .06, .25, Radius_Leg, 90, 90

We deleted the [SET] part as it is not necessary, and we modified the parameter. The result: all elements generated after this will use the material defined by the parameter Material_Bottom.

AC Guide GDL Ch 06_04.mp4Watch Movie

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

Page 93: Creating GDL Objects E-Guide

6. Basics of GDL Scripting

4 Activate the 3D View to see the result.

We should not generate the entire table using the material specified by Material_Bottom. As such, whenever we want an element to be generated using a different material, we need to insert a new MATERIAL command just before its code.5 Insert the other MATERIAL definitions. Place three more

material commands in their respective places so the code reads as follows:MATERIAL Material_LegCYLIND Height_Leg, Radius_Leg

MATERIAL Material_BottomCONE .04, .15, Radius_Leg, 90, 90

MATERIAL Material_TopCYLIND Thickness_Top, Radius_Top

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 Material_Leg, the upper cone will use Material_Bottom, and the tabletop will use Material_Top.6 Activate the 3D View to see the result.

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

Page 94: Creating GDL Objects E-Guide

6. Basics of GDL Scripting

Orbit around the model to see it from below. Note how each of the elements are shaded differently for different materials.7 In the parameter list, select the Material_Bottom parameter

and assign a different material to it by clicking on the right-pointing arrow in the Value column and selecting a new material from the upcoming list of available materials.

8 Activate the 3D View to see the result.

Orbit around to see which elements changed their materials.9 Set the Material_Bottom parameter back to Mtl-Chrome.

This concludes setting the materials.

6.5 CREATING VALUE LISTS FOR PARAMETERS

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, ...]

AC Guide GDL Ch 06_05.mp4Watch Movie

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

Page 95: Creating GDL Objects E-Guide

6. Basics of GDL Scripting

3 Go to the Parameter Script of the Object and paste the code into it.

The portions of the command in parentheses are optional, so we will not go into those right now. If you clean these from the command, the following remains:

VALUES "fillparam_name" value_definition1 [, value_definition2, ...]

The fillparam_name parameter is the name of the parameter to which these possible values will be assigned.There must be at least one value definition parameter, but there can be as many as you wish.4 Modify the command as follows:

Values "Radius_Top" .300, .375

This means that a value list consisting of two possible values of “.3” and “.375” will be applied to the parameter Radius_Top.Again, metric values in scripts are always in meters.

5 Close the Parameter Script and select the Radius_Top parameter in the parameter list.

You will see that the “Value” field is now greyed. This grey color means that the value cannot be freely modified, as it comes from a value list.6 Click on the right-pointing arrow in the “Value” field of the

Radius_Top parameter and select 375 from the value list.

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 of the Options > Project Preferences > Working Units & Levels... dialog. It is currently set to millimeters: this is why you see “375” (millimeters) displayed and not “.375” (meters).

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

Page 96: Creating GDL Objects E-Guide

6. Basics of GDL Scripting

6.6 CHECKING THE 3D MODEL

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.

2 Go back to the Editor Window, and modify the value of the “ZZYZX” parameter to 1.000 (1000 mm), then activate the 3D View to see the result.

Orbit around the model to see that the individual parts join correctly.3 Set several other parameters to see if the model is still

correct.

4 Set the modified parameters back to their defaults.

The following table shows what the defaults should be:

AC Guide GDL Ch 06_06.mp4Watch Movie

Variable ValueA 1000B 1000ZZYZX 710Radius_Top 375Thickness_Top 40Radius_Leg 30Material_Top 15 (Wd-Pine Horizontal)Material_Leg 15 (Wd-Pine Horizontal)Material_Bottom 13 (Mtl-Chrome)

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

Page 97: Creating GDL Objects E-Guide

6. Basics of GDL Scripting

6.7 CREATING THE 2D OF THE OBJECT

We will now create a simple 2D Representation of the Object.1 Find the “CIRCLE2” command in the GDL Reference

Guide (Page 121) and copy its syntax code to the Clipboard.CIRCLE2 x, y, r

The CIRCLE2 command creates a full circle in 2D. x and y specify the coordinates for the center of the circle, while r defines its radius.2 Open the 2D Script by clicking its button in the Editor

Window.

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

4 Modify the command to the following:CIRCLE2 0, 0, Radius_Top

Basically, the 2D View of the object is a Top View. When viewing the table model in the 3D View, its center is located at the 0,0 coordinates. The 2D and 3D of the Object must correspond to each other, so obviously we need to ensure that the center of the circle representing the table in 2D has its center at 0,0. Another required correspondence is that the radius of the tabletop be defined by the Radius_Top parameter. So we use this same parameter in the 2D representation of the tabletop.5 Activate the 2D Full View by clicking on its button in the

Editor Window to see the result.

With this step the 2D of the table is ready.Hint: You may add a preview picture to your object as described in the previous chapters of this Interactive GDL Training Guide.

AC Guide GDL Ch 06_07.mp4Watch Movie

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

Page 98: Creating GDL Objects E-Guide

6. Basics of GDL Scripting

6.8 PLACING AND WORKING WITH THE OBJECT

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.

3 Close the Editor Window and go back to the Floor Plan. Activate (with a double-click) the “6.3 Working with the Object” saved View.

4 Select the Object Tool in the Tool Bar. In the Info Box, click on the Object Tool icon to open its Settings Dialog.

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

AC Guide GDL Ch 06_08.mp4Watch Movie

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

Page 99: Creating GDL Objects E-Guide

6. Basics of GDL Scripting

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

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

middle of the screen to place the Object.

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.

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

Page 100: Creating GDL Objects E-Guide

6. Basics of GDL Scripting

8 Select the Object in the 3D Window.

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,

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.

10 Move your cursor around to see how the 3D bounding box of the Object stretches along with your movements. It provides a visual feedback of how large the Object will be after the stretch.

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

Page 101: Creating GDL Objects E-Guide

6. Basics of GDL Scripting

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

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

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.

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

Page 102: Creating GDL Objects E-Guide

6. Basics of GDL Scripting

This concludes this chapter.12 Save the project and close it.

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

Page 103: Creating GDL Objects E-Guide

7. Basics of GDL Scripting – Part 2

7. BASICS OF GDL SCRIPTING – PART 2In this chapter you will continue exploring various GDL commands and concepts. You will model part of another, slightly more complex table.You will again work in the Library Part Editor Window. This lesson demonstrates the following basic object making techniques:• Using IF-THEN commands to implement the creation of model

pieces based on user-defined conditions• Using subroutines to create parts of the model that occur multiple

times• Using commands (PRISM_ command) and so-called “Status

Codes” to control the visibility of individual surfaces and edges of Objects in 3D

• Using additional special “Status Codes” for creating curved objects

7.1 OVERVIEW

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 archive” option.

Let’s have a look at the object that we are going to model.2 Open up the “AC Guide GDL Chapter 07” folder in the View

Map of the Navigator palette and activate (by double-clicking) the “7.1 Overview H98” saved view in the “Chapter 7” folder.

This piece of furniture was designed by Alvar Aalto in 1956.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.fiThere 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.

AC Guide GDL Ch 07_01.mp4Watch Movie

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

Page 104: Creating GDL Objects E-Guide

7. Basics of GDL Scripting – Part 2

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

7.2 CREATING THE PARAMETERS

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”.

Since we are now creating a Table, we need to modify the Subtype to fit our desired Object type.2 Choose the “File > Save as…” command to save the file.

Give it the name “Extension_Table_H98.gsm” in the Save Dialog, and click “OK” to save it to a location of your choice. AC Guide GDL Ch

07_02.mp4Watch Movie

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

Page 105: Creating GDL Objects E-Guide

7. Basics of GDL Scripting – Part 2

3 Click the “Select Subtype…” button in the Library Part Editor Window to bring up the Subtype Hierarchy Dialog.

4 In the hierarchy select “General GDL Object > Model Element > Furnishing > Table”, and click the “Select” button.

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

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

Page 106: Creating GDL Objects E-Guide

7. Basics of GDL Scripting – Part 2

As you can see, many new default parameters have appeared on the list of parameters. These parameters can be divided into three categories: 2D Representation parameters, Material parameters and Parameters for listing. We are going to use several of these parameters and we will also create some new ones.5 Go back to the Floor Plan and activate (by double-clicking)

the “7.3 Object Parameters” saved view in the “Chapter 7” folder of the Navigator.

The View shows the kind of parameters we want to create for this Table.

The parameters starting with a “gs_” string are built-in parameters that come from the Table element subtype. Using these default parameters has the advantage of having a standard parameter set when creating object libraries. Another advantage is that when transferring parameters from one element to another (CTRL-ALT-click [Windows] / CMD-OPT-click [Mac]), the maximum number of parameters will have their values transferred because these parameters exist in both Library Parts involved in the parameter transfer.The parameters not starting with “gs_” are the kind we will create for this object.6 Go back to the Editor Window and create several new

parameters based on the following table:

Variable Type Name Value

Table_Type Text Type of table H98Show_Insert Boolean Show Insert piece Off_3D_representation Title 3D RepresentationThickness_Top Length Thickness of table top 50Pen_Top Pen View pen of table top

in 3D4

Pen_Leg Pen View pen of legs in 3D

4

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

Page 107: Creating GDL Objects E-Guide

7. Basics of GDL Scripting – Part 2

When the number of parameters increases, it becomes necessary subdivide the parameters into categories that make them organized and easier to use. The Editor Window has several options that help you do that.7 Select the “Table_Type” variable and click on the

two-pointed arrow in the left end of its row. Drag the parameter by this arrow to the position below the parameter “AC_show2DHotspotsIn3D”.

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

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

Page 108: Creating GDL Objects E-Guide

7. Basics of GDL Scripting – Part 2

8 Drag the “Show_Insert” parameter to the position below the parameter “Table_Type”.

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

We moved these parameters around so that the two most important ones will be at the top of the parameter list, and the 3D representation-related parameters come after the 2D representation parameters.

Hint: The first four parameters (A, B, ZZYZX, AC_show2DHotspotsIn3D) will not appear in the list of parameters in the Settings Dialog. They appear on the right of the parameter list in the Settings Dialog.

10 Click on the Type button of the “_3D_representation” parameter and look over the types of parameters that are available.

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

Page 109: Creating GDL Objects E-Guide

7. Basics of GDL Scripting – Part 2

The following table shows the parameter Types and their uses:

So the Title Parameter Type is used for grouping. It is always bolded. In our case, we used the _3D_representation parameter as a title for a group of additional parameters which belong under it.There are four more toggles to the left side of each Variable in the parameter list. From left to right, these are:• Hidden toggle: if you switch this on for a parameter, the

parameter will not be visible in the parameter list and the user of the object will not be able to directly set its value.

• Subordinate toggle: this switch will list the parameter below the next non-subordinate parameter above it in the list. This toggle is used in conjunction with the Title parameter type.

• Bold toggle: you can make any parameter in the list bold with this switch.

• Unique toggle: if you switch this toggle on, this parameter will not accept parameter values from the default settings during a parameter transfer (CTRL-ALT-click [Win] / CMD-OPT-click [Mac]).

11 Select the “Thickness_Top” parameter in the list and click on its Subordinate button.

Type Usage

Length used for physical dimensions of elements, such as the length of an edge or the height of an element

Angle used for angle values, e.g., the value by which an element is rotated

Real Number

used for any kind of number used in your scripts

Integer used for whole number type of variables, such as the number of pieces in a structure, or the number of 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 scriptsMaterial used for assigning materials to elements in GDLLine type used for assigning line types to GDL elementsFill pattern used for assigning fill types to GDL elementsPen color used for assigning pen color/index numbers to GDL

elementsSeparator used to separate parameters from each other in the

parameter listTitle used to create a bolded title line under which you can

group parameters

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

Page 110: Creating GDL Objects E-Guide

7. Basics of GDL Scripting – Part 2

12 Repeat this operation with the “Pen_Top” and “Pen_Leg” parameters.

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

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

15 In the Parameters panel of the Dialog, click on the 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.

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

Page 111: Creating GDL Objects E-Guide

7. Basics of GDL Scripting – Part 2

16 Close the Setting Dialog and go back to the Editor Window. Open the Parameter Script and type in (or copy-paste from this document) the following code:VALUES "Table_Type" "H98", "H99"

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.

7.3 CREATING THE MASTER SCRIPT

1 Click on the “Master Script Window” button to open the Master Script in a separate Window.

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

AC Guide GDL Ch 07_03.mp4Watch Movie

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

Page 112: Creating GDL Objects E-Guide

7. Basics of GDL Scripting – Part 2

time and space because you will only need to script commands you use in many scripts once (in the Master Script).We will now use the Master Script to define variables we are going to use in both the 2D Script and the 3D Script. These variables define some of the most important dimensions of the table based on the value selected for the Table_Type parameter.2 Type or paste the following code into the Master Script:

IF Table_Type = "H98" THENTop_Length = .95Top_Width = 1.2Top_Length2 = Top_Length - Top_Width/2Insert_Length = .6Leg_Origin_X = .63

ENDIF

3 Click the “Help > ArchiCAD GDL Reference Guide” menu item to open the GDL Manual. Find the IF command on Page 216.

Here we are using the IF-THEN pair of commands. The general working method is as follows:If <Condition> THEN

<Commands to execute if condition is true>ENDIFTo use the command, you define a condition and then define a command or a set of commands that should be executed if the condition is true.In our case the condition is the following:Table_Type = "H98"So, the command(s) between the THEN keyword and the ENDIF line will be executed if the value of the Table_Type parameter is “H98”.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 values when the value of the Table_Type parameter is “H98”. These are all values we use when the “H98” type Table is generated.

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

Page 113: Creating GDL Objects E-Guide

7. Basics of GDL Scripting – Part 2

4 Go back to the Floor Plan and activate (by double-clicking) the “7.4 Master Script variables” saved view in the “Chapter 7” folder of the Navigator.

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 = .825Top_Width = 1.05Insert_Length = .45Leg_Origin_X = .555

ENDIF

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/2Insert_Width = Top_WidthLeg_Height = ZZYZX - Thickness_TopLeg_Origin_Y = .295

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

Page 114: Creating GDL Objects E-Guide

7. Basics of GDL Scripting – Part 2

These four lines of code are not in an IF-THEN structure. The reason for this is that these two values are the same for both the H98 and the H99 types, so we did not include them in the two IF-THEN structures. Instead, we placed them at the end of the script so they are always executed no matter what the value of the Table_Type parameter.

Hint: As you can see in the Master Script, the Top_Length2 variable is calculated using both the Top_Length and the Top_Width variables. For this reason, both these variables should be defined before they are used to define another variable. This ensures they have the correct, expected value when they are used. As you know, the values of these variables do not come from parameters, so their default value is zero. If the Top_Length2 = Top_Length - Top_Width/2 line preceded the two lines before it, the value of Top_Length2 would always be zero, because the values of those other two variables would be zero at that time.

7.4 CREATING THE 3D SCRIPT

1 Click the “3D Script Window” button to open the 3D Script in a separate Window.

2 Copy-paste the following lines of code into the 3D Script Window:PEN Pen_TopMATERIAL gs_top_matADDZ Leg_Height

The PEN command sets the Pen to be used for the contours of the elements drawn from there on, until another PEN command changes it. You can find a description of the PEN command on Page 154 of the GDL Reference Guide. We will use the value defined by the Pen_Top parameter for the contours of the Tabletop.We will use the gs_top_mat default parameter to specify the material of the Tabletop.We’ll move the Local Origin up to the bottom of the Tabletop with the ADDZ command. As you can see, we used the Leg_Height variable as the parameter for the ADDZ command, and it will carry the correct value, since it was already set in the Master Script (which is executed before the 3D Script).3 Find the description of the PRISM_ command on Page 34 of

the GDL Reference Manual.

4 Copy the code syntax of the command and paste it below the existing lines of code of the 3D Script:PRISM_ n, h, x1, y1, s1, ... xn, yn, sn

The PRISM_ command is a very versatile and widely used command in GDL. It creates a Slab-type element. The interesting thing about

AC Guide GDL Ch 07_04.mp4Watch Movie

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

Page 115: Creating GDL Objects E-Guide

7. Basics of GDL Scripting – Part 2

the PRISM_ command is that: a), it can have holes in it, and b), any of its side surfaces and any of its edges may be set to be invisible.n defines the number of points we define in the command by giving (for each point) the x-value, the y-value, and a so-called status code which defines the visibility of edges and the side surface starting from that point.h defines the height of the PRISM_ element and may even be set to a negative value. The body of the PRISM_ will extrude along the z-axis of the Local Coordinate System in the direction based on the sign of the h value.For each side surface there is one surface and three edges between the given point and the next point of the PRISM_.5 Go back to the Floor Plan and (by double-clicking) activate

the “7.5 PRISM_ Status Codes” saved view in the “Chapter 7” folder of the Navigator.

Here you will see a drawing explaining how these status codes work.The PRISM_ command creates a vertically extruded shape based on a polygon defined in the x-y plane of the Local Coordinate System.

Let’s make use of a pentagon-based extruded element. The last defined point is the same as the starting point: this is how we close the PRISM_.At any point three edges and one side surface are created when the surface going from the given point to the next point is generated.The value of the bottom horizontal edge is “1”, the value of the vertical edge at the point is “2”, the value of the top horizontal edge is “4” and the value of the surface is “8”. If you want any edge or the side surface to be visible, you should add its value to the status value belonging to that edge. If you don’t want visibility, its value should be zero. The sum of these values will make up the status code for that point of the PRISM_.For example, if you want the top and bottom edges, plus the side surface starting from point 3 to be visible, but want the vertical edge at point 3 to be invisible, the status code would be 13 (1+0+4+8=13).1: bottom horizontal edge visible0: vertical edge invisible4: top horizontal edge visible8: side surface visibleThus, 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,0,180, 4013,0, Top_Width/2, 15,0, -Top_Width/2, -1

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

Page 116: Creating GDL Objects E-Guide

7. Basics of GDL Scripting – Part 2

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

This PRISM_ command will create the Tabletop for us.As you can see, we defined six points for the PRISM_, and the height of the PRISM_ is the value defined by the Thickness_Top parameter.Each line contains an x and a y-coordinate value (in this order) and the status code for the point located at those coordinates and its associated edges and side surface.

8 Go back to the Floor Plan and activate (by double-clicking) the “7.6 Table Top piece” saved view in the “Chapter 7” folder of the Navigator.

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 be 15 (1+2+4+8).

Hint: Generally, all edges and the side surface are visible, so the value of the status code is “15”. In case the status code is different, it is good practice to break it up so you can see the values from which it is constructed.

0, -Top_Width/2, 1+2+4+8,

From the above you can immediately read off the visibility status ofeach edge and the side surface. ArchiCAD will automatically add upthe values to calculate the status code.

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

Page 117: Creating GDL Objects E-Guide

7. Basics of GDL Scripting – Part 2

You can also see another illustration of this on Page 140 of the GDL Reference Guide.

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 be drawn, regardless of whether it is a contour of the element or not.9 Go to Page 36 in the GDL Reference Guide, and find the two

shapes shown there.

The shape on the left does not have the value 64 in the status codes 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.

In GDL there are special status codes (like the 64 value) that can be added to the status code. These values serve the purpose of enabling you to create curved edges of your objects more easily or to create segments based on the geometry, tangent, etc., of already defined segments of the shape.If you want to create a curve, you can do it in two steps: first, you need to define the center of the arc of that curve, then draw the actual curve, taking into consideration the last point defined and the center of the arc.The 900 status code is used to define the center of the arc to be drawn in a later step of the PRISM_ command.The first two values define the x and y-coordinates of the center, and the third value gives the status code. In this case the status code is really 900+15, which results in 915. So you define the edges and

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

Page 118: Creating GDL Objects E-Guide

7. Basics of GDL Scripting – Part 2

side as usual, then add the value 900, just as you added the value 64 in the previous line of code.The next step is to define the actual arc or curve. The next line of code does it:0,180, 4013,11 Go to Page 147 of the GDL Reference Manual for a

description of the Arc using center point and angle Status Code.

The 4000 status code draws a curved segment which is a true arc, using the center point just defined and an angle value.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, -1The 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.

Hint: It is also possible to leave out this last line of code. In that case the number of the point will be one less, and ArchiCAD will automatically close the shape.Hint: It is also possible to define holes as shapes. In that case the main shape must always be closed with the -1 status code method, and then the next line of the PRISM_ command will define the first point of the hole. In such a case, the hole must also 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

12 Open the 3D View of the Editor Window again to see the result.

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

Page 119: Creating GDL Objects E-Guide

7. Basics of GDL Scripting – Part 2

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

14 Modify the third line of the PRISM_ command as follows (take out the “64” part):Top_Length2,-Top_Width/2, 15,

15 Activate the 3D View Window to see the change.

As you can see, the vertical edges appear in the curved portion of the Tabletop. This is why we need the 64 status code.16 Modify the third line of the PRISM_ command back to its

original state (put the “64” part back in):Top_Length2,-Top_Width/2, 15+64,

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

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

Page 120: Creating GDL Objects E-Guide

7. Basics of GDL Scripting – Part 2

code into a sub-routine and call this sub-routine several times to perform the same task repeatedly.A subroutine has three parts:1. A label2. The actual code of the sub-routine3. A RETURN commandWe will make a sub-routine out of this PRISM_ command. 17 Modify your code as follows:

100: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

RETURN

We place a label before the PRISM_ command. A label can be a number or a text string with a colon after it (e.g., “100:”)The RETURN command tells ArchiCAD that the sub-routine is finished and it now can return to that line of code that called the sub-routine and continue executing the code from the next line.Sub-routines must be called to be executed.The command used for calling a sub-routine is called GOSUB.

Its syntax is the following (refer to Page 213 of the GDL Reference Guide):GOSUB labelExample: GOSUB 100

Hint: no colon follows the number of the label in the GOSUB command.

The effect is that at this point, the execution of the code in the script will continue at the sub-routine located after the 100: label, and when it reaches the RETURN command, it will come back and continue executing the next line of code after the GOSUB command.18 In the 3D Script Window, place the following lines of code

after the ADDZ line:GOSUB 100END

The GOSUB command will call our sub-routine at label “100”.The END command ends the script. It is needed is because otherwise the code would again reach the 100: label and execute the commands of the sub-routine again. However, when it reaches the RETURN command, it would give an error message because the code cannot return anywhere, since it was not called by a GOSUB command.These kinds of scripts are structured such that sub-routines are usually placed at the end of the script and they are always preceded by an END command.

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

Page 121: Creating GDL Objects E-Guide

7. Basics of GDL Scripting – Part 2

19 Activate the 3D View. Notice that this did not modify the generated shapes. The lines that generate the shape are executed only once.

20 Paste three lines of code between the GOSUB and END lines as follows:GOSUB 100MULX -1GOSUB 100DEL 1END

We are already familiar with the MULX –1 command, and now the advantage of using the sub-routine becomes apparent: we mirror the 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.

The other mirrored Tabletop piece was generated.For the next task we want to generate the Insert piece in the middle.22 Copy and paste the following code before the END

statement in the 3D Script:IF Show_Insert THEN

PRISM_ 5, Thickness_Top,Insert_Length/2, -Insert_Width/2, 15,Insert_Length/2, Insert_Width/2, 15,-Insert_Length/2, Insert_Width/2, 15,-Insert_Length/2, -Insert_Width/2, 15,Insert_Length/2, -Insert_Width/2, -1

ENDIF

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

Page 122: Creating GDL Objects E-Guide

7. Basics of GDL Scripting – Part 2

Here we encounter another IF-THEN structure. ArchiCAD will check the value of the Show_Insert parameter. As you can see in the parameter list, the Show_Insert parameter is a Boolean type parameter. It can have two states: ON and OFF. Or, in other words: YES or NO. Numerically, this translates to “1” for ON or YES, and “0” for OFF or NO. In formal logic 1 also means TRUE, whereas 0 means FALSE.The above IF-THEN structure is executed when the condition Show_Insert is evaluated as TRUE. This happens when the Show_Insert value is set to ON (or YES or 1). If it is turned OFF (NO or 0), it will be evaluated as FALSE and the commands after the IF-THEN line will not be executed.

23 Select the Show_Insert parameter in the parameter list and set it to “ON” by clicking in the checkbox in its Value field.

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

You can now see that the Insert piece has been generated. However, it now occupies the same place as the other two Tabletop pieces.In reality we would slide the Top pieces sideways to make room for the Insert piece. We will do this in GDL.

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

Page 123: Creating GDL Objects E-Guide

7. Basics of GDL Scripting – Part 2

25 Find the 100: label in the 3D Script and insert the following code between the 100: label and the beginning of the PRISM_ command:ADDX Show_Insert * Insert_Length/2

What we need to do first is to move the Tabletop piece along the x-axis. We need to do it for both pieces, so we do it in the sub-routine. We need to move it by half the width of the Inset piece for both sides.This is a tricky statement. What it does is take the Insert_Length/2 value and multiplies it by the value of Show_Insert (which is either 0 or 1). The result will be either 0 or Insert_Length/2. So, in case the Show_Insert parameter is 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.

26 Insert the following line of code after the PRISM_ command and before the RETURN command:DEL 1

Since we moved the Local Coordinate System within the sub-routine, we need to undo the move.

Hint: It is always a good idea to undo as many coordinate transformations in the sub-routine as were performed. Otherwise, the Local Coordinate System may move to unexpected places. The idea is to return it to the position it was in before the sub-routine was called.

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

Page 124: Creating GDL Objects E-Guide

7. Basics of GDL Scripting – Part 2

27 Check the result in the 3D View.

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.

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

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

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

Page 125: Creating GDL Objects E-Guide

7. Basics of GDL Scripting – Part 2

30 Save the changes made to the Object.

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

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

Page 126: Creating GDL Objects E-Guide

8. Basics of GDL Scripting – Part 3

8. BASICS OF GDL SCRIPTING – PART 3In this chapter you will continue creating the table you started in Chapter 7. There will be some new concepts and commands for you to become familiar with.You will once again work in the Library Part Editor Window. This lesson demonstrates the following basic object-making techniques:• Structuring Scripts for better readability• Using comments in scripts • Functions of buttons available in Script Windows• Using the ADD command in the 3D Script• Using the POLY2_B command in the 2D Script• Using status codes in 2D Script commands• Using the HOTSPOT2 command in the 2D Script• Using commands (e.g., PRISM_ command) and so-called Status

Codes to control the visibility of individual surfaces and edges of Objects in 3D

8.1 OVERVIEW

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.

2 Open the “Extension_Table_H98.gsm” file using the “File > Libraries and Objects > Open Object…” command. You can either continue working in the file you started in Chapter 7 of the Guide, or you can open the file from the location of the “AC Guide GDL Ch 08.pla” file.

3 In the Library Part Editor Window, open the 3D Script Window.AC Guide GDL Ch

08_01.mp4Watch Movie

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

Page 127: Creating GDL Objects E-Guide

8. Basics of GDL Scripting – Part 3

The next thing we are going to talk about is commenting code for future reference.Comments in scripts serve a specific purpose: they give the user a textual description of the code concerning what the various segments of code are actually doing.The idea behind commenting is that you can provide yourself with information within the code that enables you to quickly remember or understand what the code is doing even years after it was originally written.4 In the first line of the 3d Script, above the PEN command,

write the following code:!Setting Table top Pen and Material properties

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.

When creating comments it is advisable to place them above the lines of code they refer to. Then, when one is trying to understand the code, he/she will read the comment and immediately know what the following lines of code are expected to do.Make sure to place as many comments as needed so the code will be easy to understand later, whoever the user may be.5 Insert the following lines of code into the 3D Script so the

beginning of the script will look as follows:!Setting Table top Pen and Material propertiesPEN Pen_TopMATERIAL gs_top_mat

!Move vertically to bottom of Table topADDZ Leg_Height!Call subroutine to generate right half of Table topGOSUB 100!Mirror X axis and then!call subroutine to generate left half of Table topMULX -1GOSUB 100DEL 1

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

Page 128: Creating GDL Objects E-Guide

8. Basics of GDL Scripting – Part 3

Obviously, you do not have to comment every single line of code. But the more you comment, the more easily understandable your code 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 try this.6 Go to the end of the 3D Script and using your mouse, select

the seven lines of code that comprise the PRISM_ command after the 100: subroutine label.

7 At the top of the 3D Script Window you will see five buttons. Click the leftmost one to comment all selected lines.

The comment button will place an exclamation mark character at the beginning of each selected line of code, in effect making them comment lines.8 Activate the 3D View Window.

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

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

Page 129: Creating GDL Objects E-Guide

8. Basics of GDL Scripting – Part 3

Hint: When commenting, make sure to comment out every line belonging to the same command. Otherwise, ArchiCAD will try to execute the uncommented portions and will give you an error message because they are non-interpretable without the other lines 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.

10 Activate the 3D View Window.

As you can see, the program gives an error message. So make sure all lines belonging to the same command are commented.

Hint: sometimes commands come in pairs and they are not located next to each other. For example, if you comment an IF-THEN line then you should also comment the ENDIF line belonging to that IF-THEN command.

11 Click on the “Stop” button to stop the execution of the 3D Script. Go back to the 3D Script Window and put an exclamation character back at the beginning of the PRISM_ command.

12 Activate the 3D View Window.

Now that all lines of the command are either all commented or all uncommented, no error messages are sent by the program.

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

Page 130: Creating GDL Objects E-Guide

8. Basics of GDL Scripting – Part 3

13 Select all seven commented lines and click the uncomment button at the top of the 3D Script Window (second button from the left).

As you can see, the Comment and Uncomment buttons at the top of the 3D Script Window can be used to comment/uncomment large portions of code. The next two buttons at the top are the “Indent” and “Remove Indent” buttons. The purpose of these is to indent selected lines by one TAB position, or undo such indentations from selected lines.Indentation is another useful feature you can use to make code more readable. For example, lets look at the following portion of the 3D Script:IF Show_Insert THEN

PRISM_ 5, Thickness_Top,Insert_Length/2, -Insert_Width/2, 15,Insert_Length/2, Insert_Width/2, 15,-Insert_Length/2, Insert_Width/2, 15,-Insert_Length/2, -Insert_Width/2, 15,Insert_Length/2, -Insert_Width/2, -1

ENDIF

Here, the lines containing the parameters of the PRISM_ command are indented one TAB position from the position of the PRISM_ keyword. It is easy to see that they belong to that keyword.Also, the entire PRISM_ command and all its lines of code containing parameters are indented one TAB position from the positions of the IF and ENDIF commands. This way you can easily see which lines belong within the IF clause without having to search too much for them. This is especially useful when the codes are long and won’t fit the 3D Script Window.14 Select the five indented lines of the PRISM_ command.

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

Page 131: Creating GDL Objects E-Guide

8. Basics of GDL Scripting – Part 3

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

16 With the lines still selected, click the Indent button to restore the previous state.

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.

If the Script is correct, the following message is displayed.

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_InsertIF Show_Insert THEN

PRISM_ 5, Thickness_Top,Insert_Length/2, -Insert_Width/2, 15,Insert_Length/2, Insert_Width/2, 15,-Insert_Length/2, Insert_Width/2, 15,-Insert_Length/2, -Insert_Width/2, 15,Insert_Length/2, -Insert_Width/2, -1

ENDIF

!Undo the transformation at the beginning !before placing the LegsDEL 1END

!Generate the curved Table top half100:!Move it in the X direction if the Insert piece!is set to be shown, so the Insert piece fits in the middleADDX Show_Insert * Insert_Length/2

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

Page 132: Creating GDL Objects E-Guide

8. Basics of GDL Scripting – Part 3

!Generate the curved partPRISM_ 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

DEL 1!Return from the subroutine to the calling lineRETURN

8.2 CREATING THE LEGS

It is now time to create the scripts that will generate the legs for us.1 Open up the “AC Guide GDL Chapter 08” folder in the View

Map of the Navigator palette and activate (by double-clicking) the “8.1 Leg geometry” saved view in the “Chapter 8” folder.

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

AC Guide GDL Ch 08_02.mp4Watch Movie

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

Page 133: Creating GDL Objects E-Guide

8. Basics of GDL Scripting – Part 3

You can see the Local Origin of the Leg Profile in the ArchiCAD View. This is the point to which the Local Coordinate System must be moved before generating the Leg piece.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.

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.

3 Activate (by double-clicking) the “8.3 Leg Geometry-2” 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.

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

Page 134: Creating GDL Objects E-Guide

8. Basics of GDL Scripting – Part 3

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

5 At the end of the 3D Script, write (or paste from here) the following lines of code:!Generate one Leg200:PRISM_ 11, Leg_Height,

0, 0, 15,0, .025, 15+64,-.015, .025, 915,0, 180, 4013,-.03, -.015, 15+64,-.015, -.015, 915,0, 90, 4013,.025, -.03, 15+64,.025, -.015, 915,0, 180, 4013,0, 0, -1

RETURN

We have created a sub-routine at label 200:. There is a comment before the label describing what the sub-routine does.We have a PRISM_ command after the label. It has eleven points in all. The height of the PRISM_ equals the value specified by the Leg_Height parameter.All the status codes you see in this command (15+64, 915, 4013, -1) have been discussed in the previous chapter: you can refer to that chapter in case you need further explanation of these status codes.The sub-routine is finished by the RETURN command, as usual.Now that we have created the subroutine, let us create the code that will call it.6 Find the END command in the 3D Script and enter or paste

the following lines of code after it:!Set leg attributesPEN Pen_LegMATERIAL gs_leg_mat

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

Page 135: Creating GDL Objects E-Guide

8. Basics of GDL Scripting – Part 3

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

should also go after the END command in the code):!Create upper right legGOSUB 200

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.

As you can see the Leg is generated, but not at the correct location. So we need to move the Local Coordinate System to the correct location.9 Find the 200: label toward the end of the 3D Script and place the

following line of code below it, before the PRISM_ command:ADD Leg_Origin_X, Leg_Origin_Y, 0

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

Page 136: Creating GDL Objects E-Guide

8. Basics of GDL Scripting – Part 3

This is a command that is similar to ones we used before (ADDX, ADDY, ADDZ).The benefit of the ADD command is that it does in one step that which is otherwise done in many steps. The ADD command shifts the location of the Local Coordinate System in x, y and z directions in one step. The three parameters it uses are the values by which the Local Coordinate System should be shifted along the x, y and z-axes, respectively.So, the following code:ADDX xADDY yADDZ zCan be substituted by this:ADD x, y, zIn 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).

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

The upper right leg is now in place.However, the leg is in its right place only if there is no Inset piece in the middle. Recall the ADDX command we placed at the 100: label that shifted the position of the Tabletop piece when there is an Insert piece.11 Modify the line you just entered as follows:

ADD Show_Insert * Insert_Length/2 + Leg_Origin_X, Leg_Origin_Y, 0

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

Page 137: Creating GDL Objects E-Guide

8. Basics of GDL Scripting – Part 3

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 piece added.12 Activate the 3D View Window to see the result of the change.

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

14 Place the following command before the RETURN command of the sub-routine:DEL 1

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

Page 138: Creating GDL Objects E-Guide

8. Basics of GDL Scripting – Part 3

Since we shifted the coordinate system in the sub-routine with the ADD command, we need to undo it before returning from the sub-routine.15 Insert the following lines of code before the END command

in the 3D Script:!Create upper left legMULX -1GOSUB 200DEL 1

What we basically do to create the upper left leg is mirror the x-axis of the Local Coordinate System, then call the sub-routine to generate the Leg. We then undo the coordinate transformation.16 Activate the 3D View Window to see the result.

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

Page 139: Creating GDL Objects E-Guide

8. Basics of GDL Scripting – Part 3

17 Insert the following lines of code before the END command in the 3D Script:!Create lower right legMULY -1GOSUB 200DEL 1

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

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

The lower right leg is now generated.19 Right-click into the 3D View Window and select the “3D

Projection Settings” item from the menu that appears.

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

Page 140: Creating GDL Objects E-Guide

8. Basics of GDL Scripting – Part 3

20 Select the “Top View projection” type from among the “Select Projection Type” buttons, and click the “OK” button to accept the change.

We now see the Table from the top.

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

21 Select the “View > 3D View Mode > Wireframe” menu item.

The Table is now shown in Wireframe Mode in the3D View Window, so we can see the Legs. Now you can see why it was useful to have the Local Origin of the whole table at the center of the Table. Now we only need to mirror the axes before calling the sub-routine for the legs to be placed at the correct location.Viewing your 3D Model in Wireframe Mode can be helpful when checking to see whether the parts are generated in the desired position.You can also read off coordinates from the Coordinate Box (you can enable its Palette if it is not visible) to check their positions.22 Go back to the 3D Script Window and insert the following

lines of code before the END command:!Create lower left legMULX -1MULY -1GOSUB 200DEL TOP

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

Page 141: Creating GDL Objects E-Guide

8. Basics of GDL Scripting – Part 3

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.23 Activate the 3D View Window to see the result.

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

The 3D view of our Table is now complete.

8.3 CREATING THE 2D SCRIPT

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.

AC Guide GDL Ch 08_03.mp4Watch Movie

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

Page 142: Creating GDL Objects E-Guide

8. Basics of GDL Scripting – Part 3

2 Insert the following lines into the 2D Script:PEN gs_cont_penFILL gs_fill_type

We are already familiar with the PEN command. The FILL command sets the Fill type to be used in commands used in subsequent commands (where it applies).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 object as much as possible.3 Open the GDL Reference Guide by clicking on the “Help >

ArchiCAD GDL Reference Guide” menu item.

4 Find the description of the POLY2_B command on Page 120 of the Reference Guide. Select the command syntax and copy it to the Clipboard.

5 Paste the command syntax at the end of the 2D Script.POLY2_B n, frame_fill, fill_pen,fill_background_pen,x1, y1, s1, ..., xn, yn, sn

The POLY2_B command creates a filled polygon. Both the individual edges of the polygon and its fill can be set to be displayed 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 pattern.The fill_background_pen parameter defines the pen used to draw the Fill’s background color.The x1, y1, s1, etc., triplets define the x and y-coordinates of the individual points of the fill polygon and their status.The frame_fill parameter is the composite of several values that are added together to produce the final value of the parameter:1: When you want the contour to be drawn, this value should be added for the final value.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”.64: Add this value if you want the fill created by this command to be a “Cover Fill”. It only has an effect when the 32 value is not used.There are some additional values for the frame_fill parameter but we do not need them at this point.

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

Page 143: Creating GDL Objects E-Guide

8. Basics of GDL Scripting – Part 3

6 Go to the Floor Plan, and activate (by double-clicking) the “8.4 2D Script variables” saved view in the “Chapter 8” folder in the View Map of the Navigator.

We are going to use the same parameters and variables for the 2D of the Table that we used for its 3D.We will need to create two cases in 2D as well: one for when there is no Insert piece in the middle, and one for when there is.We will accomplish this with an IF-THEN structure.First, let us create the case when there is an insert piece. 7 Go back to the Library Part Editor Window, activate the 2D

Script and modify the POLY2_B command syntax as follows:POLY2_B 8, 7+64, gs_fill_pen, gs_back_pen,

0, -Top_Width/2, 1,Insert_Length/2 +

Top_Length2,-Top_Width/2, 1,Insert_Length/2 + Top_Length2, 0, 901,0,180, 4001,-Insert_Length/2 - Top_Length2,

Top_Width/2, 1,-Insert_Length/2 - Top_Length2, 0, 901,0,180, 4001,0, -Top_Width/2, -1

The Fill created by this POLY2_B command has eight points. The 7+64 (1+2+4+64) value for the frame_fill parameter means that we want i) the contour to be shown, ii) the fill pattern to be shown as well, iii) the polygon to be closed, and iv) our Fill to be a Cover Fill (64).The Fill’s pattern will be drawn with the pen defined by the gs_fill_pen default parameter, and the Fill’s background will be completed with the gs_back_pen default parameter. Note that we again used default parameters as defined in the Table subtype.In the lines defining the points, the first two parameters are the x and y-coordinates of the given point, while the last is the status value.The values are similar to those of the PRISM_ command. Of the possible values, we will choose the “1” value. Use “1” if you want the edge going from the given point to the next point to be visible, or leave it as “0” if you want it hidden.

Hint: note that while you can use the frame_fill parameter to show or hide the contour of the fill altogether, you can use the status values to show or hide individual edges. Obviously, the status values will work only if frame_fill is set so that the contour is visible.

These status codes can also use special additional status codes like 900 for defining the center of an arc or 4000 for drawing an arc based on a center point, radius and angle.

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

Page 144: Creating GDL Objects E-Guide

8. Basics of GDL Scripting – Part 3

At the second point you can see that the x-coordinate is Insert_Length/2 + Top_Length2, that is, half of the Insert piece is added when there is an Insert piece present.We will now create the IF-THEN structure.8 Place the following lines before and after the POLY2_B

command as follows:IF Show_Insert THENPOLY2_B 8, 7+64, gs_fill_pen, gs_back_pen,

0, -Top_Width/2, 1,Insert_Length/2 +

Top_Length2,-Top_Width/2, 1,Insert_Length/2 + Top_Length2, 0, 901,0,180, 4001,-Insert_Length/2 - Top_Length2,

Top_Width/2, 15,-Insert_Length/2 - Top_Length2, 0, 901,0,180, 4001,0, -Top_Width/2, -1

ELSE

ENDIF

We evaluate the value of the Show_Insert parameter just like in the 3D Script. However, there is a new element in the structure. It is the ELSE keyword.The structure is the following:IF <condition> THEN

<command if true>ELSE

<command if false>ENDIFThe ELSE keyword lets you define what you want the program to do in case the condition is not met. The normal IF-THEN structure is used if you want to perform a certain command when a condition is met. The ELSE variation is used when you want to perform either one of two sets of commands depending on the value of the condition.In our case we want to generate a different geometry for when there is an Insert piece (Show_Insert = 1), and another for when there is no Insert piece.

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

Page 145: Creating GDL Objects E-Guide

8. Basics of GDL Scripting – Part 3

9 Insert the following code segment between the ELSE and ENDIF lines: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

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.

10 Select each of the POLY2_B commands and all the code lines belonging to them and indent them one TAB position.

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

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

Page 146: Creating GDL Objects E-Guide

8. Basics of GDL Scripting – Part 3

11 Activate the 2D Full View Window and check the 2D of the Table.

12 Switch the Show_Insert parameter ON and OFF to see how the 2D changes based on its value. When you are finished, switch the parameter back ON.

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

13 Find the code syntax for the HOTSPOT2 command on Page 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, yIn 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 are five default hotspots generated by ArchiCAD at the four corners of the enclosing rectangle of the Object’s geometry and at the center 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.

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

Page 147: Creating GDL Objects E-Guide

8. Basics of GDL Scripting – Part 3

14 Go back to the 2D Script of the Object and place the following lines of code above the line containing the ELSE keyword:HOTSPOT2 Insert_Length/2 + Top_Length2, 0HOTSPOT2 Insert_Length/2 + Top_Length2, Top_Width/2HOTSPOT2 Insert_Length/2 + Top_Length2, -Top_Width/2HOTSPOT2 -Insert_Length/2 - Top_Length2, 0HOTSPOT2 -Insert_Length/2 - Top_Length2, Top_Width/2HOTSPOT2 -Insert_Length/2 - Top_Length2, -Top_Width/2HOTSPOT2 Insert_Length/2 + Top_Length, 0HOTSPOT2 -Insert_Length/2 - Top_Length, 0

15 Check the 2D Full View Window for the result.

We have placed hotspots at the centers of the curves and at the quarter points of the curves: eight hotspots in all.This gives us hotspots in case there is an Insert piece. Now we need to make the same hotspots for when there is no Insert piece.16 Insert the following lines of code before the ENDIF

command in the 2D Script.HOTSPOT2 Top_Length2, 0HOTSPOT2 Top_Length2, Top_Width/2HOTSPOT2 Top_Length2, -Top_Width/2HOTSPOT2 -Top_Length2, 0HOTSPOT2 -Top_Length2, Top_Width/2HOTSPOT2 -Top_Length2, -Top_Width/2HOTSPOT2 Top_Length, 0HOTSPOT2 -Top_Length, 0

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

Page 148: Creating GDL Objects E-Guide

8. Basics of GDL Scripting – Part 3

17 Switch off the Show_Insert parameter and check the 2D Full View Window for the result.

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, 0HOTSPOT2 0, Top_Width/2HOTSPOT2 0, -Top_Width/2

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

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

Page 149: Creating GDL Objects E-Guide

8. Basics of GDL Scripting – Part 3

19 Activate the 2D Full View Window to see the result.

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

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.

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

Page 150: Creating GDL Objects E-Guide

8. Basics of GDL Scripting – Part 3

3 In the Parameters panel, modify the various parameters related to the object’s Type, Insert Piece and 2D Representation and see how its 2D View is updated.

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

This completes this chapter of the Interactive Training Guide.

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

Page 151: Creating GDL Objects E-Guide

9. Advanced GDL Scripting

9. ADVANCED GDL SCRIPTINGThis chapter presents some more concepts and commands for you to get familiar with.You will again work in the Library Part Editor Window. This lesson demonstrates the following object-making techniques:• Controlling the possible range of values• Hiding parameters in the parameter list using the HIDEPARAMETER command

• Creating Doors in GDL• Using the WALLHOLE command to cut non-rectangular holes in walls • Using Macros in GDL• Using the RECT2 command in the 2D Script• Creating scale-dependent 2D for objects

9.1 OVERVIEW

1 To start the ninth lesson of the ArchiCAD GDL training guide, open the “AC Guide GDL Ch 09.pla” file. Select the “Read elements directly from archive” option.

2 Open up the “AC Guide GDL Chapter 09” folder in the View Map of the Navigator palette and activate (by double-clicking) the “9.1 Door Side View” saved view in the “Chapter 9” folder.

Here you can see the Door we are going to create.The Door is pentagon-shaped. The two upper edges of the pentagon 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.

AC Guide GDL Ch 09_01.mp4Watch Movie

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

Page 152: Creating GDL Objects E-Guide

9. Advanced GDL Scripting

9.2 CREATING THE PARAMETERS

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.

3 Select “General GDL Object > Model Element > Opening > Wall Opening > Door (Wall)” in the hierarchy, and click the “Select” button.

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

AC Guide GDL Ch 09_02.mp4Watch Movie

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

Page 153: Creating GDL Objects E-Guide

9. Advanced GDL Scripting

We are going to use many of the default parameters of the Door subtype and we will also create some of our own.4 Choose the “File > Save as…” command to save the file.

Give it the name “Pentagonal_Door.gsm” in the Save Dialog, and click “OK” to save it to a location of your choice.

5 Go back to the Floor Plan and activate (by double-clicking) the “9.2 Door Variables” saved view in the “Chapter 9” folder of the View Map of the Navigator.

Here you can see the variables and measurements we are going to use for the Door Frame. Here is the list of parameters and variables and what they will be used for:

The first three items are parameters.

Parameter/Variable name

Purpose

A Width of DoorB Height of Doorgs_frame_width Frame thickness of DoorSide_Height Height of vertical portion of frame on sidesSide_Height_Inside

Height of vertical portion of inside of frame on sides

Frame_Y Vertical component of frame width

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

Page 154: Creating GDL Objects E-Guide

9. Advanced GDL Scripting

The last three are variables the values of which we will create formulas for at the beginning of the 3D Script. These are values we will need to use when creating the geometry of the Frame. Since some of them have complicated formulas, it is better to assign their values to new variables and use that variable in the code instead of always entering the formula of the variable.6 Activate (by double-clicking) the “9.3 Glass Variables” saved

view in the “Chapter 9” folder of the View Map of the Navigator.

Here you can see those parameters and variables that are going to affect the Glass inset of the Door Panel.

Panel_Border is a parameter that we will be able to set to any desired value.The other three variables will be calculated from the other dimensions of the Door.7 Go back to the Library Part Editor Window.

We are now going to create the parameters necessary for our Door.The following parameters are to be created:

Parameter/Variable name

Purpose

Panel_Border Width of panel around GlassPanel_Border_Y Vertical component of Panel_BorderGlass_Y Horizontal/Vertical dimension of half the

Glass measured from center of GlassGlass_Center_Y Vertical position of center of Glass

Variable Type Name Value

_Glass Title GlassPanel_Border Length Border of panel around

Glass100

Glass_Thk Length Glass Thickness 10Glass_Pen Pen Glass Pen 6Glass_Mat Material Glass Material 24Handle_Style Integer Handle Style 0Handle_Mat Material Handle Material 44Handle_Acc_Mat Material Handle Accessory Material 40

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

Page 155: Creating GDL Objects E-Guide

9. Advanced GDL Scripting

For the “Handle_Style” parameter, we switch the Bold toggle ON to indicate that this parameter is used to denote a title for a set of parameters (the reason we did not use the more obvious “Title” parameter type is because we want it to be able to take values, something the “Title” parameter type cannot do).For all parameters except “_Glass” and “Handle_Style”, switch the subordinate toggles ON so they will become the subordinate parameters belonging to their respective title parameters.

The “Glass_Thk” parameter defines the thickness of the Glass in the Door Panel. The “Glass_Pen” parameter specifies the View Pen of the Glass in 3D, and the “Glass_Mat” parameter determines the material used on the Glass surface.The “Handle_Style” parameter will specify what kind of handle will be used for the Door. There are two kinds of material used in Handles: the “Handle_Mat” and “Handle_Acc_Mat” parameters specify the materials for these.

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

Page 156: Creating GDL Objects E-Guide

9. Advanced GDL Scripting

8 One by one, drag all the parameters in the list so they will be positioned above the “ac_details” title parameter, while retaining their positions relative to one another.

9 Save the Door object using the “File > Save” menu command.

10 Go back to the Floor Plan and activate (by double-clicking) the “9.4 Door Placement” saved view in the “Chapter 9” folder of the View Map of the Navigator.

11 Select the Door Tool. Make sure the “Pentagonal Door.gsm” object is selected in the Info Box. Place the Door into the Wall in the middle of the Floor Plan screen.

The Door cut out a hole from the Wall in 2D but since there is no 2D Script written for the Door yet, nothing is displayed.The reason we placed the Door into a Wall is because we will need to know the thickness of the Wall later while previewing our Door in the Library Part Editor Window. We will use a variable there that returns the thickness of the Wall the Door is placed into, but for it to work correctly in the Library Editor, at least one Door must be placed into a Wall.

9.3 CREATING THE PARAMETER SCRIPT

1 Go back to the Library Part Editor Window and click on the “Parameter Script Window” button to open the Parameter Script in a separate Window.

2 Type or copy-paste the following lines into the Parameter Script:VALUES "Handle_Style" 1, 2, 3, 4, 5, 6, 7, 8,

9, 10, 11, 12, 13, 14, 15, 0

We are already familiar with the VALUES command of GDL. We will create the possible values for the Handle_Style parameter. You will study why values “0” through “15” are available later in this chapter. When the value of Handle_Style is “0” it means that there is no handle for the Door.

AC Guide GDL Ch 09_03.mp4Watch Movie

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

Page 157: Creating GDL Objects E-Guide

9. Advanced GDL Scripting

3 Type or copy-paste the following lines into the Parameter Script:VALUES "gs_frame_thk", RANGE (, WALL_THICKNESS]

Here we again have a VALUES command, but with some new parameters. The first novelty is the RANGE keyword.The RANGE keyword lets you limit the range a parameter can take. For example, with this line of code we want to limit the thickness of the frame to the thickness of its enclosing Wall, meaning we never want the frame of the Door to be greater than the thickness of the Wall into which it was placed.4 Click the “Help > ArchiCAD GDL Reference Guide” menu

item.

5 Find the VALUES command on Page 183 of the Guide. Copy the RANGE command syntax from the PDF file and paste it at the bottom of the Parameter Script:RANGE left_delimiter [expression1], [expression2]right_delimiter [STEP step_start_value,step_value]

The STEP keyword is an additional option, which we are not going to use now, so we only need the following part of the syntax:RANGE left_delimiter [expression1], [expression2]right_delimiterA RANGE keyword is followed by a maximum of five items: a left delimiter, an optional expression, a comma, another optional expression and a right delimiter.The left_delimiter is either the “[” character, or the “(” character. The former means greater than or equal, the latter means greater than.Expression1 is optional. If it is given, it will be the lower limit for the value the parameter can take. If it is not given, there will be no lower limit. Expression1 can be a value, parameter, variable or numerical expression.Examples:[1 means that the value of the parameter must be 1 or greater(1 means that the value of the parameter must be greater than 1 The comma is always required.Expression2 is also optional. If it is given, it will be the upper limit for the value the parameter can take. If it is not given, there will be no upper limit. Expression2 can also be a value, parameter, variable or numerical expression.The right_delimiter is either the “]” character, or the “)” character. The former means less than or equal, the latter means less than.Examples:5] means that the value of the parameter must be 5 or less5) means that the value of the parameter must be less than 5

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

Page 158: Creating GDL Objects E-Guide

9. Advanced GDL Scripting

Hint: although both expressions are optional, at least one of them should be specified, because otherwise no limit is set, in which case one should not use the RANGE keyword in the first place.

Examples:(8, 15)8 < x < 15[8, 15)8 <= x < 15(8, 15]8 < x <= 15[8, 15]8 <= x <= 15[, 15] x <= 15[, 15) x < 15(8,) 8 < x[8,) 8 <= xThe 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_THICKNESSThis is so because there is no value, parameter, variable or numerical expression between the left delimiter and the comma.The variable WALL_THICKNESS is between the comma and the right delimiter “]”, so gs_frame_thk must be less than or equal to WALL_THICKNESS.

The next question is: what is this WALL_THICKNESS variable?WALL_THICKNESS is a so-called Global GDL Variable. Global Variables are special variables within GDL that hold specific values related to GDL or the Project environment, or related to various elements that interact with the GDL object during its generation.There are variables that provide information about that state of the Project, about Stories, and other general information. There are many Global Variables that give data about the specific instance of the GDL Library Part in which they are used and other ArchiCAD elements with which the GDL Library Part is interacting.

For example, there are Global Variables that provide data about Walls. Door and Window objects can inquire and make use of this data about their enclosing Walls. The WALL_THICKNESS variable always returns the thickness of the Wall into which the Door/Window is placed.With the VALUES command shown above we want to limit the maximum thickness of the Door Frame to the thickness of the Wall into which it is placed.You can find the list of Global Variables on Page 223 of the ArchiCAD GDL Reference Guide.

6 Delete the RANGE command syntax from the Parameter Script.

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

Page 159: Creating GDL Objects E-Guide

9. Advanced GDL Scripting

7 Type or copy-paste the following lines into the Parameter Script:VALUES "gs_leaf_thk", RANGE (, gs_frame_thk]

With this command we specify another range for the gs_leaf_thk parameter: we limit it so than it can take values that are less than or equal to the gs_frame_thk parameter. We do not set a lower limit for it.8 Go back to the parameter list and select the gs_frame_thk

parameter. Click on the right-pointing arrow in its Value column.

You can see the following for possible values:<= 300The reason we placed the Door into a Wall is because we used the thickness of the enclosing Wall to limit the value of the gs_frame_thk parameter.

The WALL_THICKNESS global variable has a non-zero value only when at least one Door is actually placed into a Wall. That is why we had to place a Door. Now we can see the possible range for the gs_frame_thk parameter.Since the value of the Wall is 300 millimeters, the value of the parameter must be less than or equal to 300 millimeters.9 Select the “gs_leaf_thk” parameter. Click on the

right-pointing arrow in its Value column.

As you can see, the following are the possible values:<= 100This is so because the current value of “gs_frame_thk” is 100.10 Select the “gs_frame_thk” parameter and modify its value to

“80”, then again select the “gs_leaf_thk” parameter and click on the right-pointing arrow in its Value column.

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

Page 160: Creating GDL Objects E-Guide

9. Advanced GDL Scripting

You can see the following for possible values:<= 80As you can see, the upper limit for the “gs_leaf_thk” value changed according to the value change made to the “gs_frame_thk” parameter.11 Select the “gs_frame_thk” parameter and change its value

back to 100.

12 Go to the Parameter Script and type or copy-paste the following code at its end:IF Handle_Style = 0 THEN

HIDEPARAMETER "Handle_Mat", "Handle_Acc_Mat"ENDIF

Here we see a new command called HIDEPARAMETER.The HIDEPARAMETER command does a simple execution: it hides the specified parameters in the list of parameters in the Library Part Settings Dialog (in our case, the Door Settings Dialog).This can be useful when we have many parameters. There is limited space available in the Settings Dialog for the display of parameters. Organizing parameters into groups with the Title and Subordinate features is one way of saving space. We covered that earlier.Another method is to simply hide those parameters that are not used. For example, the command shown above hides the Handle_Mat and Handle_Acc_Mat parameters when Handle_Style equals zero. If Handle_Style equals zero, it means that there is no Handle generated for the Door. In such a case we do not need to specify Handle materials, so these parameters can be hidden.13 Save the Door object using the “File > Save” menu

command.

14 Go back to the Floor Plan and click on the Door to select it. Go to its Settings Dialog.

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

Page 161: Creating GDL Objects E-Guide

9. Advanced GDL Scripting

As you can see in the Parameters panel, the value of the “Handle Style” parameter is 0, and there is no right-pointing arrow to the left of the name of the parameter to signify that it has subordinate parameters (“Handle_Mat” and “Handle_Acc_mat”).15 Modify the value of the “Handle Style” parameter from its

value list to any other value.

The right-pointing arrow appeared. If you click it, it will reveal the two subordinate Handle material parameters, and you can set their values.The command we wrote in the Parameter script hides these two values only when the “Handle Style” parameter is set to “0”; otherwise they will be shown.We are now finished with the Parameter Script.16 Leave the Door Settings Dialog by clicking the Cancel

button.

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

Page 162: Creating GDL Objects E-Guide

9. Advanced GDL Scripting

9.4 CREATING THE 3D SCRIPT

1 Go back to the Library Part Editor, and click on the 3D Script View Window to open it in a separate window.

2 Type or copy-paste the following lines into the 3D Script:!Setting used variable valuesFrame_Y = SQR(2) * gs_frame_widthSide_Height = B - A/2Side_Height_Inside = B - Frame_Y - (A/2 - gs_frame_width)

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.

Here you can see the values, parameters and variables that we will need to create the Door Panel with the Glass in it.4 Go back to the Library Part Editor, and type or copy-paste

the following lines into the 3D Script:Panel_Border_Y = SQR(2) * Panel_BorderGlass_Y = A/2 - gs_frame_width - Panel_BorderGlass_Center_Y = B - Frame_Y - Panel_Border_Y - Glass_Y

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

AC Guide GDL Ch 09_04.mp4Watch Movie

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

Page 163: Creating GDL Objects E-Guide

9. Advanced GDL Scripting

5 Go to Page 261 in the ArchiCAD GDL Reference Guide, and check the illustration there.

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

!Setting Frame attributes and generating framePEN gs_frame_penMATERIAL gs_frame_mat

Here we set the PEN and MATERIAL attributes for the Door Frame. Notice that we are using default parameters derived from the subtype.

7 Type or copy-paste the following lines into the 3D Script: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 width is symmetrical along its y-axis. Refer to the illustration on Page 252 of the GDL Reference Guide. The Door/Window

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

Page 164: Creating GDL Objects E-Guide

9. Advanced GDL Scripting

should always be created this way because the hole ArchiCAD cuts for the Door/Window is also generated this way.

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

9 Type or copy-paste the following lines into the 3D Script:!Setting Panel attributes and generating panelPEN gs_leaf_penMATERIAL gs_leaf_mat

We are setting the PEN and MATERIAL attributes for the Door Panel. The Door has separate default parameters for these, so we are using them to keep consistent with other Doors.

10 Type or copy-paste the following lines into the 3D Script:PRISM_ 16, gs_leaf_thk,

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,.2, .1, -1

Here we created the Door Panel. Let us review it in a bit of detail. You may notice that the first six defined points are the same as for the Door Frame, which is understandable since they must be located at

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

Page 165: Creating GDL Objects E-Guide

9. Advanced GDL Scripting

the same points. The sixth point has the status code “-1”, meaning that the polygon is closed: any new points will start defining a hole into the body.The next five points are the points of the panel around the Glass. We 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.

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

12 Type or copy-paste the following lines into the 3D Script:!Setting Glass attributes and generating GlassPEN Glass_PenMATERIAL Glass_Mat

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/2PRISM_ 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

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

Page 166: Creating GDL Objects E-Guide

9. Advanced GDL Scripting

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.

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.

As you can see, a rectangular-shaped hole is cut for the Door into the Wall. We need to modify this with scripting.17 Go back to the Library Part Editor and type or copy-paste the

following lines into the 3D Script:!Cutting shape of Door out of Wall (WALLHOLE)WALLHOLE 6, 1,

A/2 - gs_frame_width, 0, 7,A/2, 0, 7,A/2, Side_Height, 7,0, B, 7,-A/2, Side_Height, 7,-A/2, 0, -1

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

Page 167: Creating GDL Objects E-Guide

9. Advanced GDL Scripting

Here we have a new GDL command. The WALLHOLE command is used to cut a non-rectangular hole into the Wall.For rectangular Walls, ArchiCAD automatically cuts a rectangle shaped hole into the Wall into which the Door/Window is placed. The width of that hole is “A” and its height is “B”. It is cut symmetrically along the y-axis of the Door/Window.In case the Door/Window Frame is non-rectangular, you need to use the WALLHOLE command to manually define the shape of the hole that should be cut into the Wall for the Door/Window. 18 Find the WALLHOLE command syntax on Page 255 of the

ArchiCAD GDL Reference Guide.WALLHOLE n, status,x1, y1, mask1,...xn, yn, maskn[, x, y, z]

The WALLHOLE command is very similar to the PRISM_ command in its structure.The n parameter defines the number of edges of the cut polygon.The status parameter influences the attributes of the cut edges and surfaces. If it is “1”, the PENS and MATERIALS defined for the enclosing Wall will be used. If it is “2”, the PENS and MATERIALS defined and in effect in the 3D script will be applied to those edges and surfaces.The mask values are similar to the values of the PRISM_ command, but there are only “1”, “2”, “4” and “64” values (the three edges plus the method used for drawing contours – as we discussed in Chapter 7).The last three values are optional and define a vector. As a default, the vector of the WALLHOLE cut is perpendicular to the sides of the Wall. This serves our purposes, so we will not use these optional parameters now.

Hint: The WALLHOLE command will not generate any visible shape in the 3D View of the Library Part Editor. You need to save the Door and place it into a Wall before you can see the shape it cuts from the Wall.

19 Save the Door object using the “File > Save” menu command.

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

Page 168: Creating GDL Objects E-Guide

9. Advanced GDL Scripting

20 Go back to the Floor Plan. Select the Door in the Wall and select the “Show Selection/Marquee in 3D” command in the context menu.

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

9.5 CREATING THE MACRO CALL

Macros are complete Library Parts that can have their own scripts and parameters. Macros are used to generate models that are used in many other objects. For example, you may have 10 different types of Doors, but all of them may use a Door Panel. In such a case, it is advisable to write a Macro Object for the Door Panel and reference or “call” the Macro Object from the Door Objects to generate the Door Panel. This is like calling a sub-routine, with the difference that in this case the sub-routine is a completely separate Object file.Another advantage of Macros is the fact that in case you need to modify them, you need to modify the Macro Object only once: all calling Library Parts can then reap its benefits.

ArchiCAD has many macros within its Library. We are now going to use the Macro Object from the ArchiCAD Library that is used to 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.

The Macro object is opened. Above the “New” button you can see that its subtype is Macro.If you take a look at its parameter list, you can see that there are about a dozen parameters. These specify various things about its geometry, materials, shadow casting, etc.

AC Guide GDL Ch 09_05.mp4Watch Movie

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

Page 169: Creating GDL Objects E-Guide

9. Advanced GDL Scripting

2 Select the “gs_handle_typ_m” parameter and click the right-pointing arrow in its Value column to see the available values.

As you can see, there are 16 possible values, the same values defined for the “Handle_Style” parameter of the Door object.We gave these possible values for the “Handle_Style” parameter at the beginning of the Parameter Script. If you open the Parameter Script of this Macro Object you will see that the “gs_handle_typ_m” parameter of the Macro has the same value set.The reason we did this is because we will call the Macro from our Door object and we will transfer values to it. The Macro will generate its 3D based on the values that were transferred from the calling Door object.

3 Activate the 3D View Window to see the 3D model of the Macro.

Note the position of the Local Coordinate System of the Macro object. This is important because when calling the Object we need to move the Local Coordinate System to the position where we want the Macro to be created.We will use three parameters of the Macro in the Door Object. We will transfer the values of these parameters to the Macro when we call it. If there is no value transferred to the Macro for a given parameter then the Macro will use the default value of that parameter.We will use the gs_handle_typ_m, gs_handle_mat and gs_handle_ac_mat parameters. We have corresponding parameters in the Door object that we will be able to specify there and thus transfer their values when calling the Macro.4 Go back to the “Pentagonal_Door.gsm” object and activate

its 3D Script. Type or copy-paste the following code into it:!Put Local Coordinate System in correct place for HandleADD -A/2 + gs_frame_width + .05, .9, gs_leaf_thk

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

Page 170: Creating GDL Objects E-Guide

9. Advanced GDL Scripting

Here we move the Local Coordinate System to its correct position for the Door Handle. Its center will be at a height of .9 meters and 50 millimeters from the Door Frame.5 Type or copy-paste the following code into the 3D Script:

!Call macro to generate Handles on both sidesFOR t=1 TO 2 CALL "da_handletyp" PARAMETERS gs_handle_typ_m = Handle_Style, gs_handle_mat = Handle_Mat, gs_handle_ac_mat = Handle_Acc_Mat MULZ -1 ADDZ gs_leaf_thkNEXT tDEL 5

We do this in a FOR_NEXT loop because we need to call the Macro twice to create the Door Handle on both sides of the Door. The MULZ and ADDZ commands are there to move the Local Coordinate System to its correct position for the Door Handle on the other side of the Door.The Macro call happens with the CALL command. Let us look at this in detail.6 Go to Page 222 of the ArchiCAD GDL Reference Guide file

and find the CALL command.

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

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

Page 171: Creating GDL Objects E-Guide

9. Advanced GDL Scripting

CALL macro_name_string [,] PARAMETERS [name1=value1 , ... namen=valuen][[,]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 commandmacro_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 parametersname1 = value1 this is the name of a parameter within the Macro Object and the numeric expression which assigns a value to it.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.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_Matwill 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.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 CALL command of the calling Library Part.

7 Make sure that the “Handle_Style” parameter of the Door object is set to a non-zero value.

If it is set to “0”, no handle will be generated for the Door.8 Activate the 3D View Window to see the result.

If you Orbit around the Door in 3D you can see that it has Door Handles on both sides.9 Save the Object with the “File > Save” menu command.

With this step we finished creating the 3D for the Object.

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

Page 172: Creating GDL Objects E-Guide

9. Advanced GDL Scripting

9.6 CREATING THE 2D SCRIPT

1 Open the 2D Script of the Door object.

2 Type or copy-paste the following code into the 3D Script:IF GLOB_SCALE > 50 THEN

ELSE

ENDIF

We will create two different versions of the 2D of the Door depending on the Floor Plan scale. We wish to create a more detailed 2D Symbol for the Floor Plan scale in which the Door will be displayed in 1:50 or less (e.g., 1:20, 1:10 etc.).The GLOB_SCALE global variable can be used especially for this purpose.GLOB_SCALE always returns the scale of the current View. In the 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.

3 Type or copy-paste the following code into the 3D Script, replacing the previously placed commands:Inside_Frame_Half = A/2 - gs_frame_width

IF GLOB_SCALE > 50 THENRECT2 Inside_Frame_Half, 0, A/2,

-gs_frame_thkRECT2 -Inside_Frame_Half, 0, -A/2,

-gs_frame_thkLINE2 Inside_Frame_Half, 0,

Inside_Frame_Half, 2 * Inside_Frame_Half

ARC2 Inside_Frame_Half, 0, A - 2 * gs_frame_width, 90, 180

HOTSPOT2 Inside_Frame_Half, A - 2 * gs_frame_widthELSE

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 - gs_leaf_thk

ARC2 Inside_Frame_Half - gs_leaf_thk, 0, 2 * Inside_Frame_Half - gs_leaf_thk, 90, 180

HOTSPOT2 Inside_Frame_Half, A - 2 * gs_frame_width – gs_leaf_thkENDIF

AC Guide GDL Ch 09_06.mp4Watch Movie

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

Page 173: Creating GDL Objects E-Guide

9. Advanced GDL Scripting

In the first line we set a variable called Inside_Frame_Half, which is the distance from the Door center to the inside of the Frame along the x-axis. We will use this value in the subsequent commands.Let us look at the commands placed between the IF and the ELSE commands:The first 2D command is the RECT2 command. This is a new command we use and it is a simple one. It simply creates a rectangle in 2D. The first two parameters define the x and y-coordinates of one of its corners, and the next two parameters define the x and y-coordinates of the corner opposite the first defined corner. The two RECT2 commands create the two rectangles that symbolize the Frame of the Door on the two sides.The LINE2 command symbolizes the Door panel in its 90-degree open position.The ARC2 command symbolizes the 90-degree opening angle of the Door in 2D.The HOTSPOTS2 command placed a hotspot at the end of the Door Panel line so that we will be able to select it by that point.The commands placed between the ELSE and the ENDIF commands are very similar to those between the IF and ELSE commands. There are only two differences: the Door Panel is created with the RECT2 command instead of the LINE2 command, and the hotspot at the end of the Door Panel is at a slightly different location.

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

The Door is displayed at a scale of 1:100. The Door Panel is symbolized by a Line.5 At the lower left corner of the 2D Full View Window, click the

scale button, set the scale to 1:50 in the Dialog that appears and click “OK” to accept this change.

As you can see, the Door Panel is now displayed with a rectangle.

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

Page 174: Creating GDL Objects E-Guide

9. Advanced GDL Scripting

6 Set the scale back to 1:100, and return to the 2D Script.

As you can see, it is relatively easy to create objects whose displays respond to scale changes.7 Type or copy-paste the following code into the 2D Script,

after the ENDIF command:HOTSPOT2 A/2, 0HOTSPOT2 A/2, -gs_frame_thkHOTSPOT2 -A/2, 0HOTSPOT2 -A/2, -gs_frame_thk

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

9 Go back to the Floor Plan and make sure the “9.4 Door Placement” saved View is activated. Select the Door placed in the Wall.

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.

This concludes this Chapter.

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

Page 175: Creating GDL Objects E-Guide

10. Advanced GDL Scripting – continued

10. ADVANCED GDL SCRIPTING – CONTINUEDThis chapter of the Interactive Training Guide will take it lightly and introduce some of the fun parts of GDL.You will again work in the Library Part Editor Window. This lesson demonstrates the following object making techniques:• Creating objects that modify their shape in animations• Using a Global variable in GDL to inquire about the current frame

of the animation• Using the CUTPLANE – CUTEND command pair for cutting the

3D Model

PART 1 – OPENING DOOR

10.1 Overview

1 To start the tenth lesson of the ArchiCAD GDL training guide, open the “AC Guide GDL Ch 10_1.pla” file. Select the “Extract elements to a folder” option. In the Dialog that appears select the default location for the folder and click the “OK” button to execute it.

The reason we extract the folders in this Chapter is because we wish to modify an element. Library Parts located in a PLA file or LCF file cannot be modified and saved back into that PLA/LCF file.2 Open up the “AC Guide GDL Chapter 10_1” folder in the

View Map of the Navigator palette and activate (by double-clicking) the “10.1 Overview” saved view in the “Chapter 10” folder.

The Project we will use for this purpose is an example Project provided by Graphisoft on its web site.The Project is a Pavilion. Its architect is Holger Kreienbrink, who is with Graphisoft Deutschland GmbH. The Pavilion has a simple and elegant structure with full glass walls all around.What we wish to do is create a short animation. We will move from outside the Pavilion, up the steps, and into the glass-enclosed area. Before entering, we will stop in front of the entrance Door. We will program the Door to open during the animation, and when it is fully open, we will move into the inside of the Pavilion.How can we create animations?There are three interacting factors we use for this:

AC Guide GDL Ch 10_1_01.mp4Watch Movie

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

Page 176: Creating GDL Objects E-Guide

10. Advanced GDL Scripting – continued

• ArchiCAD GDL provides a Global variable. By using it one can 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 Door Library Part.

• We’ll set ArchiCAD to rebuild each frame during animation so the modified geometry will be displayed in different frames.

3 You can see the Path of the animation in the Floor Plan. Select the Door the Path will go through.

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

10.2 Creating the parameters

We will not create a completely new object. Instead, we will only make some small additions to some code that will serve our purpose.1 Find the parameter named “gs_open_3D” in the list of

parameters.

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).

AC Guide GDL Ch 10_1_02.mp4Watch Movie

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

Page 177: Creating GDL Objects E-Guide

10. Advanced GDL Scripting – continued

2 Create three new parameters in the parameter list based on the following table:

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

Further parameters can be added to make the animation more sophisticated. For example, there could be two additional parameters 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 this time.3 Switch on the bold toggle of the “Door_Open” parameter.

Also, switch on the subordinate toggles of the other two parameters.

Variable Type Name Value

Door_Open Boolean Door opens in animationBeg_Frame Integer Beginning frame of Door

opening0

End_Frame Integer Ending frame of Door opening

0

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

Page 178: Creating GDL Objects E-Guide

10. Advanced GDL Scripting – continued

4 Move all three parameters above the “Parameters for Listing” parameter such that their position relative to one another remains the same.

5 Open the Parameter Script.

6 Type or copy-paste the following lines of code at the top of the Parameter Script:IF NOT(Door_Open) THEN

HIDEPARAMETER "Beg_Frame", "End_Frame"ENDIF

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

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

Page 179: Creating GDL Objects E-Guide

10. Advanced GDL Scripting – continued

10.3 Creating the 3D Script

1 Open the 3D Script for editing.

2 Type or copy-paste the following lines of code at the top of the Parameter Script:IF Door_Open THEN

IF GLOB_FRAME_NR < Beg_Frame THENgs_open_3D = 0

ELSEgs_open_3D = (GLOB_FRAME_NR - Beg_Frame) * (90 / (End_Frame - Beg_Frame))

ENDIFENDIF

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_NR3 Open the “ArchiCAD GDL Reference Guide” PDF file from

the Help menu.

AC Guide GDL Ch 10_1_03.mp4Watch Movie

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

Page 180: Creating GDL Objects E-Guide

10. Advanced GDL Scripting – continued

4 Find the description of the GLOB_FRAME_NR variable on Page 228 of the GDL Reference Guide.

This Global variable returns the current frame of the animation. This second IF structure does the following: as long as the GLOB_FRAME_NR is lower than the beginning frame number of the Door opening, the Door Leaf stays closed at 0 degrees. This is what the next line of code does.

Hint: we need to specifically set the value of the gs_open_3D parameter to “0”. If it were set to another value (e.g., 45 degrees), it would be at that value to begin. Then at Beg_Frame it would suddenly change to 0 degrees, whereupon it would gradually open.

The ELSE clause of the IF structure defines what happens when the value of GLOB_FRAME_NR is equal to or greater than the value of Beg_Frame.We want the value of gs_open_3D at Beg_Frame to be 0, and we want its value at End_Frame to be 90.The number of frames that pass while the Door opens from 0 degrees to 90 degrees is the value given by (End_Frame - Beg_Frame).From the above we get that the Door must open (90 / (End_Frame - Beg_Frame)) degrees with each passing frame. So (90 / (End_Frame - Beg_Frame)) gives the unit change of the Door’s opening angle per frame.The value (GLOB_FRAME_NR - Beg_Frame) gives the number of frames passed since the Door started opening (how many units of change happened in the opening angle of the Door).

At any given frame the product of (GLOB_FRAME_NR - Beg_Frame) and (90 / (End_Frame - Beg_Frame)) will give the opening angle of the Door.5 Save the changes to the Door and return to the Floor Plan.

10.4 Creating the animation

1 Open the Camera Settings Palette.

AC Guide GDL Ch 10_1_04.mp4Watch Movie

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

Page 181: Creating GDL Objects E-Guide

10. Advanced GDL Scripting – continued

2 Click the “Path” button to view the animation Path settings.

We need to know exactly which frame we will be at when we arrive in front of the entrance Door.As you can see in the lower left area of the Dialog, the animation consists of 101 frames. There are five times twenty frames, with twenty frames between each Camera.The positions of the Cameras are contained in the table below:

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.

3 Close the Path Options Dialog, then close the Camera Settings Palette.

4 Select the entrance Door and go to its Settings Dialog.

Camera Number Located at Frame Number

Camera 1 1Camera 2 21Camera 3 41Camera 4 61Camera 5 81Camera 6 101

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

Page 182: Creating GDL Objects E-Guide

10. Advanced GDL Scripting – continued

5 Switch the “Door opens in animation” parameter “ON” in the parameter list of the Door.

6 Click on the right-pointing arrow that appears to the left of the parameter, and specify “61” and “81” as values for the Beginning and Ending frames of the animations, respectively.

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

Page 183: Creating GDL Objects E-Guide

10. Advanced GDL Scripting – continued

Now the Door will begin to open at Frame 61, just as we arrive at the position of Camera 4, and it will complete its opening movement at Frame 81, just as we start to move into the Pavilion from the position of Camera 5.7 Click “OK” to accept the changes. Set the 3D Engine to

Open GL 3D Engine with the “View > 3D View Mode > Open GL 3D Engine” command.

8 Select the “Document > Creative Imaging > Create Fly-Through” menu command.

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

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 different model for the Door with each passing Frame.

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

Page 184: Creating GDL Objects E-Guide

10. Advanced GDL Scripting – continued

11 Click the “Save” button. In the Dialog that appears specify a name for the video file to be generated and click the “Save” button for the generation to begin.

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

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

Page 185: Creating GDL Objects E-Guide

10. Advanced GDL Scripting – continued

PART 2 – CONSTRUCTION SIMULATION

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

10.5 Bringing in data from Google Earth

We will bring in two images from Google Earth: the image of a map of a portion of a city, and the image of a 3D view of the same portion with a modeled 3D building in it.We will not do these steps ourselves, but will talk you through how we went about them under steps a-f below. At this point you should be able to envision the steps that were taken to achieve this.1 Finding the location

a We searched for “Miami, FL” in Google Earth. The application took us to an aerial view of downtown Miami. We selected a parking lot and decided to put a building in its place. We only panned the desired position, but we did not rotate the View in Google Earth. As a result the view remained in Top View.

b Using the File > Save > Save Image command, we saved the image of the location to a file named Miami.jpg.

c Using the File > External Content > Place External Drawing… menu command in ArchiCAD, we placed the image on the Floor Plan.

AC Guide GDL Ch 10_2_01.mp4Watch Movie

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

Page 186: Creating GDL Objects E-Guide

10. Advanced GDL Scripting – continued

d We needed to scale the Drawing correctly, therefore we went back to Google Earth, and used the Tools > Ruler menu command to draw a line from one corner of one building to another corner of another building. We read off the exact length of this line in centimeters. It measured 23755.9 centimeters (237559 millimeters or 237.559 meters).

e Going back to ArchiCAD, we drew a line over the placed image of the downtown area between the same two points on the map image. We zoomed in as close as was sensible to make it as accurate as possible.

f We selected both the line and the placed Drawing of the image, and using the Resize command, we resized them both graphically. The graphical resize operation’s origin was one end of the line, and it was done such that as a result, the length the line measured 237559 millimeters, just as in Google Earth. With this we managed to enlarge the image to the correct size.

2 Open the “AC Guide GDL Ch 10_2.pla” file. Select the “Read elements directly from archive” option. In the Dialog that appears select the default location for the folder and click the “OK” button to execute.

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

Page 187: Creating GDL Objects E-Guide

10. Advanced GDL Scripting – continued

3 Open up the “AC Guide GDL Chapter 10_2” folder in the View Map of the Navigator palette and activate (by double-clicking) the “10.1 Placed Map Image” saved view in the “Chapter 10” folder.

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.

4 Activate (by double-clicking) the “10.2 Modeled Building Mass” saved view in the “Chapter 10” folder.

At this stage of the Project you can see that the Building was modeled using Slabs and Double-Slanted Walls.We already prepared the 3D Window for the animation for you. To 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.

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

Page 188: Creating GDL Objects E-Guide

10. Advanced GDL Scripting – continued

b We moved around to find an aerial view in which our building site is clearly visible and the building we plan to place will not be obstructed by any other building.

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

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

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

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

Page 189: Creating GDL Objects E-Guide

10. Advanced GDL Scripting – continued

f In the 3D Projection Setting Dialog we switched to Perspective View and tried to find a Camera position in the Dialog that would be close to where the Camera was located in Google Earth. After doing this we activated the 3D Window.

g In the 3D Window we entered Explore mode and moved around our Camera position until we found a View in which our designed building fit correctly into the surroundings shown in the background image.

5 Activate (by double-clicking) the “10.3 Perspective of Building Mass” saved view in the “Chapter 10” folder.

You can see the result in this saved 3D Perspective View. h It is a good idea to save the Camera position, and not only the

View resulting from it. Therefore, we used the View > 3D Navigation Extras > Put a camera into the path menu command to place a Camera at the current position as seen in the 3D Window.

i Since we want to create an animation, we needed at least two Cameras. Therefore we placed another Camera extremely close to the one we had just placed by dragging a copy of that original Camera. We set the in-between frames for these two Cameras to 99. This way we will have a total of 100 Frames in our animation.

6 Go to the Camera Settings Palette, and click the “Path” button. In the Dialog that appears select the “Everything” option from the drop-down list below the “Display Options” field. Click “OK” to close the Dialog.

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

Page 190: Creating GDL Objects E-Guide

10. Advanced GDL Scripting – continued

7 Activate (by double-clicking) the “10.4 Camera positions” saved view in the “Chapter 10” folder.

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

10.6 Creating the Object from the Mass

Now we will start to create our Object. For this purpose we first need to save the 3D mass in GDL.1 Activate (by double-clicking) the “10.5 Mass Top View”

saved view in the “Chapter 10” folder.

The 3D mass of the building is shown in Top View in the 3D Window. We will save it from here.2 Select the “File > Libraries and Objects > Save 3D Model

as…“ menu command.

3 In the File Dialog Box that appears specify a name and location for the new Object file. In our case we’ll save it under the name “SkyScraper_Block.gsm”.

AC Guide GDL Ch 10_2_02.mp4Watch Movie

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

Page 191: Creating GDL Objects E-Guide

10. Advanced GDL Scripting – continued

4 In the next Dialog that appears specify the 3D Model to be saved as an Object. Check the “Remove redundant lines from symbol” checkbox. In the 3D description format field, choose the “Non-editable binary 3D data” radio button.

We chose the non-editable option because we do not want to modify the object. This way our 3D script will be short and clean.5 Select the “Object” tool and enter its Dialog. The

“Skyscraper_Block.gsm” Object is selected. Specify “0” for the Object vertical position. Also, select its lower left selection hotspot then click “OK” to leave the Dialog.

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

Page 192: Creating GDL Objects E-Guide

10. Advanced GDL Scripting – continued

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

Click the lower left corner of the Slabs and Walls mass to place the Object.

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

The Object we saved from the 3D model has now been replaced with the Slabs and Walls mass in the 3D Window.

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

Page 193: Creating GDL Objects E-Guide

10. Advanced GDL Scripting – continued

10.7 Creating the parameters

1 Select the Object and select the “File > Libraries and Objects > Open Object…” menu command to open the Object for editing.

2 Create three new parameters in the parameter list based on the following table:

The “Time_Build” parameter will control whether the animation feature is turned ON or OFF. It must be turned ON for any animation of the Building to occur.The “Beg_Frame” specifies the number of the Frame of the animation at which the Building starts to be built from the ground up.The “End_Frame” specifies the number of the Frame of the animation at which the Building will be built completely to its full height.3 Switch on the bold toggle of the “Time_Build” parameter.

Also switch on the subordinate toggles of the other two parameters.

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.

Variable Type Name Value

Time_Build Boolean Built during animationBeg_Frame Integer Beginning Frame of Building 0End_Frame Integer Ending Frame of Building 0

AC Guide GDL Ch 10_2_03.mp4Watch Movie

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

Page 194: Creating GDL Objects E-Guide

10. Advanced GDL Scripting – continued

10.8 Creating the 3D Script

1 Open the 3D Script for editing.

2 Type or copy-paste the following code into the beginning of the 3D Script:IF Time_Build THEN

IF GLOB_FRAME_NR >= Beg_Frame THENADDZ (GLOB_FRAME_NR - Beg_Frame) * (270 / (End_Frame - Beg_Frame))CUTPLANEDEL 1

ENDIFENDIF

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 height using the ADDZ command. By using this we will relocate the origin of the Local Coordinate System. The Cut Plane defined by the CUTPLANE command will always be on the x-y coordinate plane of the Local Coordinate System.We want the vertical position of the Cut Plane at Beg_Frame to be 0, and we want its value at End_Frame to be 270. We choose 270 because the Skyscraper is 265 meters high and we want to make sure no part of it is cut off when End_Frame is reached in the animation.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.

AC Guide GDL Ch 10_2_04.mp4Watch Movie

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

Page 195: Creating GDL Objects E-Guide

10. Advanced GDL Scripting – continued

Thus, (270 / (End_Frame - Beg_Frame)) gives the unit change of the Cut Plane’s height per frame.The value (GLOB_FRAME_NR - Beg_Frame) gives how many frames passed since the Building started to rise (i.e., how many units of change happened given the height of the Cut Plane). So at any given frame, the product of (GLOB_FRAME_NR – Beg_Frame) and (90 / (End_Frame – Beg_Frame)) will give the position of the Cut Plane.3 On Page 100 of the ArchiCAD 10 GDL Reference Guide find

the description of the CUTPLANE command.

Although the CUTPLANE command can have several parameters, we are now using its simplest form, the syntax of which look as follows:CUTPLANE<any number of gdl commands>CUTENDThis can be considered similar to an IF-THEN structure in which all commands between the IF and ENDIF commands are executed. For the CUTPLANE and CUTEND command pair, the cut operation will be performed on all GDL bodies generated between these two commands, and only on those commands.So, if we want to cut the whole 3D model, we need to place a CUTPLANE command before the command generating the 3D 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 will also need to place a CUTEND command at the end of the 3D Script.One more thing about the CUTPLANE command is that it will always cut that portion of the 3D model that is above the x-y plane, in the z-region of the Local Coordinate System. In our example, the portion of the 3D Model above the Cut Plane will be cut and removed from View. If we mirrored the orientation of the z-axis using a MULZ –1 command, the portion of the 3D Model below the Cut Plane would be cut and removed from view.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))CUTPLANEDEL 1As 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 follow, and those have the previous position of the Local Coordinate System as their origin. So the Coordinate Transformation preceding the CUTPLANE command must be undone immediately after the CUTPLANE command, otherwise it will affect other elements, and they will be generated in an incorrect position in space.4 Type or copy-paste the following code at the very end of the

3D Script:IF Time_Build THEN

IF GLOB_FRAME_NR >= Beg_Frame THENCUTEND

ENDIFENDIF

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

Page 196: Creating GDL Objects E-Guide

10. Advanced GDL Scripting – continued

As you can see, this is a CUTEND command (as mentioned above), but it is in the same double IF-THEN structure as the CUTPLANE command.This is because the CUTPLANE and CUTEND commands come in pairs. If one is executed in the 3D Script and the other is not, ArchiCAD will give an error message. Therefore, the CUTEND command must always be executed under the same conditions as the CUTPLANE command it is paired with.Consider a case where there was only a CUTEND command at the end of the 3D Script, without any conditions.In such a case, if the Time_Build parameter were OFF, the whole IF-THEN structure would not let the CUTPLANE command be executed at the beginning of the Script, but the CUTEND command would be executed at the end. The result would be an error message that there is a CUTEND command without a corresponding CUTPLANE command.5 Save the changes you have made to the Object. Close the

Library Part Editing Window.

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

10.9 Creating the animation

1 Go to the 3D Window, and select the Object. Go to its Settings Dialog.

2 Turn the “Built during animation” parameter “ON”. For the “Beginning Frame of Building” parameter, “0” will be fine. For the “Ending Frame of Building” parameter, set a value of “95”. Close the Dialog with the “OK” button.

AC Guide GDL Ch 10_2_05.mp4Watch Movie

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

Page 197: Creating GDL Objects E-Guide

10. Advanced GDL Scripting – continued

3 Select the “Document > Creative Imaging > Create Fly-Through” menu command. In the Dialog, make sure the “3D Window” is the source window and that “All frames” are selected to be generated.

In the “Result” field, select “QuickTime Movie File” (or another format of your choice).

4 Check the “Rebuild Model for Each Frame” checkbox in the lower left corner of the Dialog.

5 Click the “Save” button. In the Dialog that appears specify a name for the video file to be generated and click the “Save” button for the generation to begin.

This concludes the second Project created in this chapter.

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

Page 198: Creating GDL Objects E-Guide

10. Advanced GDL Scripting – continued

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