Graphisoft ArchiCAD Creating GDL Objects ®
Interactive Training Guide
®
Graphisoft Visit the Graphisoft website at http://www.graphisoft.com for local distributor and product availability information.
Graphisoft® ArchiCAD ® 11 Creating GDL Objects – Interactive Training Guide Copyright © 2008 by Graphisoft, all rights reserved. Reproduction, paraphrasing or translation without express prior written permission is strictly prohibited.
Trademarks Trademarks ArchiCAD®, Virtual Building™, Virtual Trace™ and Virtual Building Solutions™ are trademarks of Graphisoft. All other trademarks are the property of their respective holders.
CONTENTS Preface ________________ ________________________ ________________ _________________ _________________ __________ __ 5
4.4 Editing the GDL Object Object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
What is GDL?. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .5
4.5 Creating Custom Custom Door Panels Panels . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
How to learn GDL? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .5 Getting started with the ArchiCAD Interactive Interactive Training Guide. . . . . . . . . . . 5 Step 1: Download and install ArchiCAD . . . . . . . . . . . . . . . . . . . . . . . . . . .6 Step 2: Create the interactive interactive training environment environment . . . . . . . . . . . . . . . . . . .7 Step 3: How to use Movie Player in ArchiCAD? ArchiCAD? . . . . . . . . . . . . . . . . . . . . .9 Plan_______________ ________ 1. Saving 2D Symbols from the Floor Plan_______________ ________ 11
1.1 Creating Creating the the Symbol Symbol . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
5. Auto Auto Saving Saving Non-rectangular Windows. _________________ ____________________ ___ 63 5.1 Overview. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63 5.2 Modeling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64 5.3 Creating the GDL Object Object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68 5.4 Enhancing the the 2D Symbol . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71 5.5 Adding Material Material Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73 5.6 Make a Preview Picture Picture with Lightworks Lightworks . . . . . . . . . . . . . . . . . . . 75
1.2 Saving the Object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 1.3 Checking the Result . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
6. Basics of GDL Scripting ________________ _________________________ _________________ _________ _ 79
1.4 Final Touches Touches . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
6.1 Overview. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
1.5 Using the 2D Symbol View . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
6.2 Creating Parameters Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
2. Saving 3D models from the fl oorplan as GDL objects___________21 2.1 Overview Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .21 2.2 Modeling. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .22
6.3 Creating the 3D geometry. geometry. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84 6.4 Assigning materials materials . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92 6.5 Creating value value lists for parameters parameters . . . . . . . . . . . . . . . . . . . . . . . . . 94
2.3 Creating the GDL Object. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .25
6.6 Checking the 3D 3D model. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96 6.7 Creating the 2D of the Object. Object. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
2.4 Editing the the GDL Object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .28
6.8 Placing and working working with the Object. . . . . . . . . . . . . . . . . . . . . . . 98
3. Rotating Auto-saved Objects. Adding Material Parameters to Library Parts. ________________ _________________________ _________________ ________________ ________________ ___________35 ___35
7. Basics of GDL Scripting – Part 2 _________________ __________________________ _________ 103
3.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .35 3.2 Modeling. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .36 3.3 Creating the GDL Object. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .38 3.4 Editing the the GDL Object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
7.1 Overview. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103 7.2 Creating the parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104 7.3 Creating the master Script . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .111 7.4 Creating the 3D Script. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114
3.5 Adding Material Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .44
8. Basics of GDL Scripting – Part 3 _________________ __________________________ _________ 126
4. Auto saving rectangular rectangular doors. Creating Custom Door Panels. Panels. ___48
8.1 Overview. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126 8.2 Creating the Legs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132
4.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .48 4.2 Modeling. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .49 4.3 Creating the GDL Object. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .53 Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
8.3 Creating the 2D Script. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141 8.4 Testing Testing the completed completed object . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149
3
Contents
9. Advanced GDL Scripting___________________ Scripting____________________________ ______________ _____ 151 9.1 Overview. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151 9.2 Creating the Parameters Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152 9.3 Creating the Parameter Parameter Script. . . . . . . . . . . . . . . . . . . . . . . . . . . . 156 9.4 Creating the 3D 3D Script. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162 9.5 Creating the macro call . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 168 9.6 Creating the 2D Script . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 172 10. Advanced Advanced GDL Scripting – continued ________________ _____________________ _____ 175
10.1 Overview Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .175 10.2 Creating the parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .176 10.3 Creating the 3D Script. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .179 10.4 Creating the the animation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .180 Part 2 – Construction simulation. . . . . . . . . . . . . . . . . . . . . . . . . . . . .185 10.5 Bringing in data from Google Earth . . . . . . . . . . . . . . . . . . . .185 10.6 Creating the Object from the Mass . . . . . . . . . . . . . . . . . . . . . 190 10.7 Creating the parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .193 10.8 Creating the 3D Script. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .194 10.9 Creating the the animation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .196
Part 1 – Opening Opening Door . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175
4
Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
Preface
PREFACE The following ten Interactive Training Guide (ITG) chapters will cover the most important aspects of GDL object making in ArchiCAD. 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 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. 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 ArchiCAD project, only only a reference to the external Librar y Part is saved with the file. However, users have the option of saving the project a s an archive, which stores the Library Parts in the file as well.
OW TO LEARN GDL? HOW TO 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 Beginners who are not interested interested in advanced advanced GDL GDL scripting scripting can find useful information in the Introduction to Object Making PDF document. Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
• Those who who want want to learn how how to create create more advan advanced ced parametric parametric objects with scripting can buy the GDL Cookbook from David Nicholson Cole. • Finally Finally, it is recommended recommended that that professional professional library library develope developers rs read the GDL Technical Standards document to understand Graphisoft object standards.
WITH THE GETTING STARTED WITH THE A RCHI RCHICAD 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 t he following elements: • a section section of of the PDF PDF Guide Guide with with detai detailed led explanations and screenshots; • narrated movie movie clips clips provi providing ding step-by-step step-by-step instructions, • an ArchiCAD ArchiCAD training training project project file file to complete complete the the exercises.
The PDF guide can be be printed and all the narrated movie clips can be launched from the PDF. However, However, we recommend that you play the movie clips within ArchiCAD, ArchiCAD, while completing the steps using the training project files.
5
Preface
Step 1: Download and install ArchiCAD
upgraded to FULL versions upon purchase of a commercial license.
To best enjoy the unique benefits and simplicity of learning in an interactive environment, we recommend that you install the interactive training guide as well as the latest version of Graphisoft ArchiCAD on your computer. computer. 1 Install Install ArchiCAD ArchiCAD on your your computer computer to complete complete the steps steps of this interactive training guide. 2 If you do not not have ArchiCA ArchiCAD D yet, please please visit visit the following following websites to obtain a free ArchiCAD installer: • If you you are a stude student nt or a teach teacher er,, visit visit https://eduregistration.graphisoft.com/ to https://eduregistration.graphisoft.com/ to register and download a fully functional Education Version of ArchiCAD® for Students and Teachers.
Please note that ArchiCAD is available in several localized languages for both Macintosh and for Windows operating systems – make make sure to choose the language and installer version that best suits you. 3 Start the Graphisoft Graphisoft ArchiCA ArchiCAD D installer installer and follow follow the installation wizard to complete the process.
• If you are a professional architect, visit https://trialregistration.graphisoft.com/ to https://trialregistration.graphisoft.com/ to register and download a fully functional 30-day trial version of ArchiCAD. Projects saved with this TRIAL version can be automatically
6
Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
Preface
In case you have not done so already, please install the interactive training guide on your computer. 4 Start the installe installerr of the interacti interactive ve training training guide 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 lear ning environment.
Step 2: Create the interactive training environment Introduction.mp4 Watch Movie 1 Start ArchiCA ArchiCAD D on your your computer computer by double-cl double-clickin icking g its desktop shortcut.
Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
The ArchiCAD splash screen will appear shortly after you start the program, and the “Start ArchiCAD” dialog will be displayed. 2 Select Select the “Standard “Standard Profile” Profile” for the activ activee Work 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.
7
Preface
4 Select Select the “Read “Read elements elements directly directly from archiv archive” e” option option for Active Library Usage in the “Open Archive Project” dialog. dialog.
If you installed the interactive training guide t o 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 “Prog ram Files” folder on Windows operating systems. 3 Browse the the chapters chapters of this this training training guide guide and open any any of the ArchiCAD Project archive (.PLA) files.
8
ArchiCAD will open the selected archive 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 Activate the the “File > Save Save As…” As…” command, command, and save 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 Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
Preface
selected automatically, so practically all you have to do is to click the “Save” button to proceed.
Step 3: How to use Movie Player in ArchiCAD? Let’s briefly look over the main features and functions of the ArchiCAD Movie Player. Player. 1 Open the Movie Movie Player Player by activati activating ng “Help > ArchiCA ArchiCAD D Movie Player”.
2 The Movie Movie Player Player will open and and the first training training clip clip will be automatically loaded. Feel free to reposition or re-size the movie player on your screen.
This is an important step, since certain exercises will require a Solo Project file to be saved on your local computer. The Movie Player plug-in also requires this step for it to be able to open the necessary training clips automatically. 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 cer tain 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.
Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
3 Click the the Play button button on the player player to start the first first clip. clip. You You can pause the movie at any time, or use the slider to repeat or skip any parts of the clip.
9
Preface
4 Once the movie movie is is over and and you have have completed completed the current 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 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 We hope that you will find this guide useful and will agree with what experienced architects worldwide say: ArchiCAD is easy to lea rn and fun to use. You are always always free to contact Graphisoft and its worldwide partners if you have further questions: www.graphisoft.com .
10
Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
1. SAVING 2D SYMBOLS FROM THE FLOOR PLAN
1. SAVI N G 2D 2D
SYMBOLS F RO M T H E F LOO LO O RPLA RP LAN N
In this first chapter we will save a custom 2D object – a north symbol – from the floor plan and then make some final refinements in the Library Part Editor. The final – optional - step demonstrates an alternative way to create custom 2D objects by copying 2D elements from the floor plan into the 2D sy mbol view window of a Library Part. Although these are all really simple operations, they will highlight some basic concepts of making objects with ArchiCAD. ArchiCAD. All elements of the ArchiCAD floor plan can be saved automatically as 2D symbol objects. You You don’t don’t have to be afraid to open the GDL Object Object Master Window Window. This logical setup dialog allows you to modify your existing objects according to your needs. You 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 S YMBOL AC Guide GDL Ch 01_01.mp4 Watch Movie Let’s start this lesson by completing our custom north symbol on the floor plan. 1 Open the the “AC “AC Guide GDL GDL Ch 01.pla” 01.pla” ArchiCAD ArchiCAD project project file file to start the first lesson of this interactive, hands-on ArchiCAD training guide. Select Select the “Read elements directly from archive” option.
Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
Please review the “Getting started with the ArchiCAD Interactive Training Guide” chapter if you 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 t hat 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 “AC Guide Guide GDL Ch 1” folder folder in the the Navigator 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 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 cust om symbol. These techniques were discussed in greater detail in previous ITG lessons; therefore, these steps a re not described here. In the next step we’ll add some solid fills to the drawing to make it complete.
11
1. SAVING 2D SYMBOLS FROM THE FLOOR PLAN
5 Click OK to to leave the the “Fill Default Default Setting Settings” s” dialog 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 mouse button button to click click in the the middle middle of those those empty areas that you would like to cover with solid fills. You can check the completed symbol on the right side of the screen for reference.
Hint: Whenever you want to create GDL objects on the floor plan to be saved as GDL objects – regardless of whether they are 2D symbols or real 3D elements - we highly recommend that you draw them close to the project origin. Elements placed too far from the origin may result in minor inaccuracies in the GDL code. 3 Activate Activate the “Fill “Fill Tool” Tool” in the “Tool “Tool Box” and click click on the “Fill Tool Settings” button in the “Info Box” to d isplay the “Fill Default Settings” dialog box. 4 Click on the the “Fill Pattern” Pattern” button button and select select the “Solid “Solid Fill” Fill” type from the pop-up dialog. dialog. Set “Pen 1” for all three adjustable pen types (Outline, Cover Fill, Cover Fill Background Pen).
Hint: To avoid avoid segmentation of cur ved polygon edges, make sure s ure that the “Tracing Method” is set to “Best Match” in the “Magic Options > Ma gic Wand Settings… ) Wand Wand Settings” dialog ( Options before you click.
1.2 S AVING THE AVING THE OBJECT u e 01_02.mp4 Watch Movie Let’s save the previously created drawing elements as a GDL object. 1 Open up the the “ArchiCA “ArchiCAD D Guide” Guide” folder in in the Navigat Navigator or and activate (by double-clicking) the “1.2 Create the GDL Object” pre-set view in the “Chapter 1” folder.
12
Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
1. SAVING 2D SYMBOLS FROM THE FLOOR PLAN
2 Click on the the Arrow Tool. Tool. Select Select all the drawing drawing elements elements with with a selection polygon.
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 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 to create the the GDL object object at the specified specified location location.. Hint: Whenever a new GDL object is made in ArchiCAD it is automatically loaded into the actual project. You can double check File > Libraries and this if you open the Library Manager ( File Objects > Library Manager ) ) and review the list of Library Parts under the “Other Objects” categ ory. Naturally, 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.
ESULT 1.3 CHECKING THE R ESULT u e 01_03.mp4 Watch Movie
Hint: Alternatively, Alternatively, you can hold down the shift button and click click the elements for selection one by one. You can also launch the Edit > Select All ) “Select All” command ( Edit ) for the same result. 3 Activate Activate the the “Save Selecti Selection on as...” command command (File > Libraries 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.
Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
Let’s look at the capabilities of the newly created Librar y Part. 1 Open up the “ArchiCA “ArchiCAD D Guide” folder in in the Navigat Navigator or and activate (by double-clicking) the “1.3 Check the Result” pre-set view in the “Chapter 1” folder. 2 Open the the “Object “Object Default Default Settings Settings” ” dialog 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.
13
1. SAVING 2D SYMBOLS FROM THE FLOOR PLAN
Hint: GDL objects can be selected with their hotspots or over the areas of their 2D fills. ArchiCAD places hotspots on the bounding box corners and in the center of a uto-saved objects. Additional hotspots can be found at the corners of fill polygons. 4 Move your cursor cursor over over one of the bounding bounding box hotspot hotspotss until the cursor’s shape changes to a checkmark. Click to open the “Pet Palette”. 5 Click on on the rightmost rightmost button (Stretc (Stretch h mode), move the hotspot and click again to finish the operation.
3 Activate Activate the Arrow Arrow Tool Tool from the Toolbo Toolbox x and select the object by making a selection rectangle around it. The active points (hotspots) of the element become visible.
14
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 diag onal of the bounding box. Alternatively, 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 Select the North North Symbol Symbol again with with the Arrow Arrow Tool Tool and then 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.
Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
1. SAVING 2D SYMBOLS FROM THE FLOOR PLAN
7 Under “Floor Plan and Sect Section” ion” uncheck uncheck the “Enable “Enable Object’s Pens” checkbox and change the “Symbol Line Pens” value to six.
2 Click Click Cance Cancell to return return to the the floor plan. plan. 3 Leaving Leaving the element element selected, selected, activate activate the the “Open Object” Object” command (File > Libraries and Objects > Open Object…). This opens the selected element’s GDL Master Window. Window. 8 Click OK to return return to the floor plan plan and check check the result. result.
1.4 FINAL TOUCHES u e 01_04.mp4 Watch Movie Our current object doesn’t have a preview picture associated with it. That makes it difficult to identify it in the object browser browser should there 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 Select the object object and and open the “Object “Object Selection” Selection” dialog 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. Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
Hint: Each GDL Object has its own Master Window. Window. All controls needed to edit a GDL Object are present in the Mas ter Window. 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 less ons.
15
1. SAVING 2D SYMBOLS FROM THE FLOOR PLAN
4 Click on the the Preview Preview Picture Picture button. button. The Preview picture window opens, opens, even though it is empty at this stage. Now we’ll copy an existing image into it. Hint: The picture that we are g oing 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 Activate the the “File > Open…” command command and select select the “ITG_01_preview.png” “ITG_01_preview.png” file in the “ArchiCAD Training Training Guide” fold er. Make sure that the “All Files” types option is selected.
9 Click on on the “Preview “Preview Picture” Picture” button button and paste paste the content content of the clipboard with the Paste command (Edit > Paste).
10 Close the “Preview Picture” window by clicking on the top top right corner and open the “Comments” window by clicking on the Comments button. 11 Enter the following following text in the comment comment window: My Custom North Symbol Object
6 Select Select the picture picture with the “Edit “Edit > Select Select all…” all…” (Ctrl+A) command. 7 Copy the the content content of the selection selection with the the Copy command command (Edit > Copy).
8 Return to to the GDL GDL Master Master Window Window (Window (Window > ITG North Symbol).
16
12 Close the Comments Comments window. window. 13 Save your your changes to the object with the Save Save command (File > Save) and close the GDL Master Window. 14 Back on the floor plan open the Object Selection Settings Settings dialog then check the preview picture and comments added to the ITG North Symbol Object.
Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
1. SAVING 2D SYMBOLS FROM THE FLOOR PLAN
15 Return to the floor plan with OK. Save Save the project file with Save (File > Save) and close it (File > Close).
SING THE 2D S YMBOL V IEW IEW 1.5 USING THE u e 01_05.mp4 Watch Movie
In this last chapter we’ll explain how you can creat e a symbol object that you can easily modify with just the standard ArchiCAD 2D editing tools. 1 Open up the “ArchiCA “ArchiCAD D Guide” folder in in the Navigat Navigator or and activate (by double-clicking) the “1.4 Use the 2D Symbol View” pre-set view in the “Chapter 1” folder.
The object is now finished, and you can use it in your projects when you need exactly the same symbol. Fur thermore, you have the option of changing its pen color and size as described in Chapter 1.3. However, However, making any modifications in the content of the symbol requires some basic GDL scr ipting knowledge, since the 2D symbol is stored as a series of GDL commands in the object’s 2D Script window. window. You You can check this yourself if you open the object’s object’s GDL Master Window and click on the 2D Script button.
Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
17
1. SAVING 2D SYMBOLS FROM THE FLOOR PLAN
4 Click Click on the the “2D “2D Symbol Symbol” ” button. button. The 2D symbol window opens. opens.
2 Select Select the symbol symbol with the area area selection selection and copy copy it to the clipboard.
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 Paste the content content of the clipboard clipboard with with “Edit > Paste” Paste”.. 6 If the “Pasting “Pasting…” …” dialog dialog opens, select select the “Paste “Paste to Original Original Location” and “Zoom to Pasted Elements” options.
3 Create a new new GDL object object with with “File “File > Libraries Libraries and objects objects > New Object...”. The object’s GDL Master Window Window opens.
18
Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
1. SAVING 2D SYMBOLS FROM THE FLOOR PLAN
7 Click outside outside the the selection selection marquee marquee or hit Enter Enter to place place the copied elements.
9 Click on on the “Details” “Details” button button in the the currently currently open GDL 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.
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 Activate the the Hotspot Hotspot tool and place place a hotspot in in the middle 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 s etting 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 You can do it manually or you can use the Fit size to 2D symbol option from the Details window. We’ll do the latter.
Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
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 “ArchiGuide\ITG Library” f older with “File > Save”. Close the GDL Master window with OK. 11 Back on the floor plan place the newly newly created created object with with the Object Tool and check the result.
19
1. SAVING 2D SYMBOLS FROM THE FLOOR PLAN
Hint: If you want to further edit this object select it on the floor plan and open its GDL Master window with “File > Libraries and objects > Open Object…”. In the opening dialog click on the 2D symbol button and make the necessary adjustments with the standard 2D tools and editing commands, then save the changes. 12 Close the project project with “File “File > Close”.
20
Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
2. Saving 3D models from the floorplan as GDL objects
2. S AVING 3D MODELS FROM THE FROM THE FLOORPLAN AS FLOORPLAN AS GDL OBJECTS The previous chapter explained how you can save 2D symbol objects from the floor plan. In this lesson we’ll g o one step further and make a 3D GDL object using only the s tandard ArchiCAD tools. This interactive training session demonstrates the following basic object-making techniques: • Three-dimensio Three-dimensional nal ArchiCAD ArchiCAD models models can be saved saved automatically automatically as as GDL objects. This process doesn’t require any GDL knowledge. • Any kind kind of ArchiCAD ArchiCAD Tool Tool can be used used to develop develop 3D models models that can be saved as a GDL object
2.1 O VERVIEW
Before we start working let’s have a quick look at the object that we are going to model. 2 Open up the the “AC “AC Guide GDL GDL Chapter Chapter 02” folder folder in the the Navigator and activate (by double-clicking) the “2.1 Overview” pre-set view in the “Chapter 2” folder. The Double Coffee Table known 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
u e 02_01.mp4 Watch Movie 1 Open the the “AC “AC Guide GDL GDL Ch 02.pla” 02.pla” ArchiCAD ArchiCAD project project file file to start the second lesson of this interactive, hands-on ArchiCAD GDL training guide. Select the “Read elements directly from archive” option.
Hint: If you want to check the complete GDL object that we are going to make, open the Object Tool and find the “Coffee_Table_907B_Final” “Coffee_Table_907B_Final” Library Part in the object browser. The object is located in the “Finished Objects” folder.
Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
21
2. Saving 3D models from the floorplan as GDL objects
2.2 MODELING u e 02_02.mp4 Watch Movie 1 Open up the “AC “AC Guide Guide GDL Chapter 02” folder folder in the Navigator and activate (by double-clicking) the “2.2 Modeling Steps” pre-set view in the “Chapter 2” folder.
3 Open the Slab Tool and click on the “Favorite “Favorites” s” button. 4 Select Select “Upper Tablet Tabletop” op” from the list list and click “Apply”. “Apply”.
We 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 Wall Tool. Tool. We’ll We’ll use the top elevation drawing of the table as a construction aid. 2 Activate Activate (by double-cli double-clicking cking)) the “2.3 Model the Tablet Tabletops” ops” pre-set view in the Navigator. We 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.
22
The required Slab parameters are set for modeling the first main frame element.
Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
2. Saving 3D models from the floorplan as GDL objects
5 Click OK on the “Slab Default Setting” Setting” dialog dialog box to return to the floor plan. 6 Zoom in the the bigger bigger circle circle (the (the upper upper tabletop) tabletop) and hold down the Space button on the th e keyboard to activate the Magic Wand function. The cursor’s cursor’s shape changes to a magic wand wand indicating that ArchiCAD will automatically trace the contours of the clicked polygon. 7 Move Move the cursor over over the bigge biggerr circle until the cursor’s cursor’s shape shows that it has found a polygon, then click.
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 cursor’s icon indicates that it has found a polygon and click.
8 Open the Slab Tool again and click on the “Favorites” button. 9 Select Select “Lower “Lower Tabletop” Tabletop” from from the list and click click “Apply”. “Apply”.
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 “2.4 Model the Suspensions” pre-set view in the Navigator. The floor plan shows four hotspots that indicate the center points of the four rectangular suspensions.
Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
23
2. Saving 3D models from the floorplan as GDL objects
17 Click once over over every hotspot to place the four suspensions. 18 Activate (by double-clicking) the “2.5 Model the Legs” pre-set view in the Navigator. The floor plan shows the four lines where the legs need to be placed.
14 Open the Column Tool and click on the “Favorites” “Favorites” button. 15 Select “Tabletop “Tabletop Suspension” from the list and click “Apply”. 19 Open the Wall Tool Tool and click on the “Favorites” button. 20 Select “Table “Table Leg” from the list and click “Apply”.
The required Column setting values are set so that you can create the suspensions. 16 Click “OK” on the Column Default Setting dialog box to return to the floor plan.
24
Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
2. Saving 3D models from the floorplan as GDL objects
The required Wall setting values are set for modeling the four legs. legs. Please note that this special Wall type uses a Custom Profile that we previously defined in the “Profile Manager” dialog.
To To revise the Wall’s profile click on Design > Complex Profiles > Profile Manager… and choose the “Table Leg” profile.
Now we are finished with the modeling.
2.3 CREATING THE GDL OBJECT u e 02_03.mp4 Watch Movie 1 Open up the “AC “AC Guide Guide GDL Chapter 02” folder 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 followed the previous steps precisely you should see this figure:
21 Click “OK” on the Wall Wall Default Setting dialog box to return to the floor plan. 22 Draw straight straight wall segments segments along the four lines. Please note that the Walls’ starting points are indicated by the label arrows. The required Wall Geometry settings are shown below.
Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
25
2. Saving 3D models from the floorplan as GDL objects
2 Activate Activate (by (by double-click double-clicking) ing) the “3.7 “3.7 Check Check 3D” pre-set pre-set view in the Navigator. The 3D window window opens and you can check check the consistency of your 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 Librar y Part. Thus we have to look at the 3D model from a perpendicular top view. 3 Activate Activate (by double-c double-clicki licking) ng) the “2.8 Open Open the Top Top View” pre-set view in the Navigator. This previously defined view automatically sets the required 3D top view. view.
26
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 t he opening dialog the Top view mode is active and the camera a zimuth is set to 270°.
Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
2. Saving 3D models from the floorplan as GDL objects
4 Activate Activate the the “File > Librarie Librariess and Objects Objects > Save 3D 3D Model as…” command. 5 In the opening opening dialog dialog select select a folder where where you you want to save save the new object and enter “Coffee_Table_907B.gsm” “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 We suggest you store it near the currently open ArchiCAD file. 6 The “Save “Save as Library Library Part” dialog dialog opens. Select Select the Object Object type and turn on the “Remove redundant lines from symbol” and the “Editable GDL script” options. Click “Save” to create the object and to close this dialog.
8 Double click click on the the Object Object Tool Tool and make make sure sure that “Coffee_Table_907B.gsm” “Coffee_Table_907B.gsm” is the active object. Click OK to return to the floor plan
Hint: The Editable GDL Script option allows us to make modifications in the object’s scripts later. 7 Open up the the “AC “AC Guide GDL Chapter Chapter 02” folder in in the Navigator and activate (by double-clicking) the “2.9 Place the Object” pre-set view in the “Chapter 2” folder.
The floor plan shows the original model and indicates the point where you can place the object that has just been created.
Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
27
2. Saving 3D models from the floorplan as GDL objects
9 Place the the coffee coffee table table object object on the floor plan with with a click of the mouse where indicated by the label.
2.4 EDITING THE GDL OBJECT u e 02_04.mp4 Watch Movie 1 Open up the “AC “AC Guide Guide GDL Chapter 02” folder folder in the Navigator and activate (by double-clicking) the “2.11 Edit the Object” pre-set view in the “Chapter 2” folder.
10 Activate (by double-clicking) the “2.10 Check 3D” pre-set view in the “Chapter 3” folder.
2 Activate Activate the Arrow tool selection around the object.
and make an area
The GDL model is now complete. In the next section we’ll add a Preview Picture to the Library Part and enhance the object’s 2D symbol.
28
Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
2. Saving 3D models from the floorplan as GDL objects
Note that the object’s 2D symbol doesn’t contain a background fill, 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 have a Preview Picture associated with it, thus it is difficult to identify in the object browser. Let’s Let’s fix these problems with some easy-to-learn techniques. 4 Click “Cancel” “Cancel” to return to the floor floor plan. 5 Keeping Keeping the object selecte selected, d, activate activate the “File “File > Libraries Libraries and Objects > Open Object” command.
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 Let’s start editing the object by enhancing the 2D symbol. 6 Click on on the “2D Symbol” Symbol” button button to open the 2D 2D symbol symbol editing window wind ow..
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 of a Library Part without knowing the GDL language. The curr ent symbol, which was made from the object’s top view, 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. window. 7 Activate Activate the the “Edit > Select Select All” All” command command and then hit the the Delete button on your keyboard. All elements are cleared from the window window.. Now you can start drawing drawing the required new symbol with the 2D ArchiCAD tools or you can copy an existing drawing from the floor plan. We’ll We’ll do the latter. The GDL Master Window opens. opens. Each GDL Object has its own Master Window in ArchiCAD. ArchiCAD. All controls needed to edit a GDL Object are present in the Mast er Window. Window. In this lesson we’ll only Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
29
2. Saving 3D models from the floorplan as GDL objects
8 Activate Activate (by double-cl double-clickin icking) g) the “2.11 “2.11 Edit the Object” Object” pre-set view in the Navigator to return to the f loor plan.
9 Select Select the new 2D 2D symbol with with the Arrow Tool Tool on the top top left corner of the floor plan. Note that this enhanced 2D symbol drawing contains rea l circles, hotspots and a white background fill. 10 Activate the “Edit > Copy” command. command. 11 Click on “Window > Coffee_Table_907B” Coffee_Table_907B” to return to the object’s Master wind ow. ow.
30
12 Click on the “2D Symbol” window to activate activate it and launch the “Edit > Paste” command.
The content of the clipboard (the new symbol) is pasted into the active view. view. If the current zoom of t he 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 “Paste to to Origi Original nal Locatio Location” n” • “Zoom “Zoom to Paste Pasted d Elem Element ents” s” 13 Click outside the selection marquee around the pasted elements to place them into th e 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 ste p 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 Symbol window. window.
Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
2. Saving 3D models from the floorplan as GDL objects
15 Open “View > 3D 3D View Mode > 3D Projection Settings”, choose the top view and set the camera azimuth to 270.
about the 3D GDL coordinate system is that the Global Coordinate System is the equivalent of the 2D symbol’s symbol’s coordinate system in t he 3D environment. The origin of the Global Coordinate System is located in the bottom left cor ner 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” Symbol” window window again. 18 Activate the “Edit > Select Select All” command. 19 Drag the symbol with the mouse so that the bottom left corner of the selected elements’ bounding box moves to the coordinate system’s origin point.
16 Click on the “3D View” button from the object’s object’s GDL Master Window. Window. The object’s top view is displayed. displayed.
Please note that there a re two coordinate system icons in this view. 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 sy stems will be explained in a later chapter. At this stage all you have to know Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
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 t he object’s object’s GDL Master Window and uncheck uncheck the “Hotspots on bounding box” option in
31
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 “Preview Picture” button. The Preview Picture window, window, which is currently empty, opens. 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 t o the Preview Picture window. window. We are going to copy a previously made picture. Hint: The size of t he preview window is 128x128 pixels. In order to avoid the distortion of the Preview Picture use rectangular
32
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 f loor 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.
Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
2. Saving 3D models from the floorplan as GDL objects
24 Click on “Window “Window > Coffee_Table_907B” Coffee_Table_907B” to return to the object’s Master window.
27 Save your changes with “File > Save”. 28 Close the object Master Master Window. Window. 29 Open up the “AC Guide GDL Chapter 02” folder in the Navigator and activate (by double-clicking) the “2.12 Check the Result” pre-set view in the “Chapter 2” folder. 30 Back on the floor plan, select the object with the arrow tool.
25 Click on the “Preview picture” window to activate it and launch the “Edit > Paste” command.
The pasted image is added to the object’s object’s Preview Picture window.
26 Close the Preview Picture window. window.
Note that the area selection is now applicable for the element as the 2D symbol contains background fill. Furthermore, the symbol is made of real circles and there are no hotspots on the bounding box. 31 Click on the Object Tool to open the Library Part’s settings dialog. dialog.
Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
33
2. Saving 3D models from the floorplan as GDL objects
The object is now displayed with its Preview Picture in the object 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
34
“Coffee_Table_907B” “Coffee_Table_907B” object will be available for later use from the folder where you saved it. 33 Close the project with “File>Close”.
Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
3. Rotating Auto-saved Objects. Adding Material Parameters to Library Parts.
3. R OTATING OTATING A UTO UTO-SAVED OBJECTS. A DDING DDING ARAMETERS TO LIBRARY P ARTS . M ATERIAL P ARAMETERS TO In this chapter we will show how you can change the 3D orientation of your automatically saved GDL objects without any GDL scripting. You You will also learn how you can make the object’s 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 viewpoint of the 3D window window (from (from where where the model model is saved saved as a GDL element) defines the 3D orientation of the resulting Library Part. • You can add material material paramet parameters ers to your your objects objects with the use use of the “Find & Replace” command.
3.1 O VERVIEW u e 03_01.mp4 Watch Movie 1 Open the the “AC “AC Guide GDL GDL Ch 03.pla” 03.pla” ArchiCAD ArchiCAD project project file file to start the third lesson of this interactive, hands-on ArchiCAD GDL training guide. Select the “Read elements directly from archive” option.
Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
Before we start working let’s have a quick look at the object that we are going to model. 2 Open up the the “AC “AC Guide GDL GDL Chapter Chapter 03” folder folder in the 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 by Alvar Aalto for the Paimio 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 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 “Fi nished Objects” folder.
35
3. Rotating Auto-saved Objects. Adding Material Parameters to Library Parts.
3.2 MODELING u e 03_02.mp4 Watch Movie 1 Open up the “AC “AC Guide Guide GDL Chapter 03” folder 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 save precious time if you make a plan before you start modeling. We We have chosen this chair for this lesson because it ca n 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 Activate (by (by double-clicki double-clicking) ng) the “3.3 Model Model the Frames” Frames” pre-set view in the Navigator. We We start the modeling modeling process by by creating the main frames. frames. The active 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 “Favori “Favorites” tes” button. 4 Select Select “Main Frame” Frame” from from the list and and click “Apply”. “Apply”. The required Slab parameters are set for modeling the first main frame element. 5 Click “OK” on the “Slab “Slab Default Setting” Setting” dialog dialog box to return to the floor plan. 6 Zoom in the the main main frame’s frame’s external external contour and hold down 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 the cursor over over the the frame’s frame’s external contour contour until until the cursor’s shape shows that it has found a polygon, then click. 8 Select Select the slab with the Arrow and then activate activate the Slab Tool with one click. Hint: If you want to select a n element without leaving the active ArchiCAD tool push the Shift key and click on the element.
36
Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
3. Rotating Auto-saved Objects. Adding Material Parameters to Library Parts.
9 Leave Leave the slab slab selected, selected, zoom on the the frame’s frame’s internal contour contour and click on it with the Magic Wand (Space+click).
The bottom frame is ready. To To create the upper frame we’ll make a copy of the bottom one. 10 Leaving the slab selected 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 activate the “Edit > Move 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 (by double-clicking) the “3.4 Model the Bracings” pre-set view in the Navigator.
Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
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” “Favorites” button. 15 Select “Bracing 01” 01” from the list and click “Apply”. “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 b racing’s contour. Repeat this step over the second bracing.
18 Open the Slab Tool Tool and click on the “Favorites” “Favorites” button. 19 Select “Bracing 02” 02” from the list and click “Apply”. “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 activate the Magic Wand Wand and click once over the third bra cing’s contour. The main frames and the bracings are finished. 22 Activate (by double-clicking) the “3.3 Model the Seating” Seating” pre-set view in the Navigator. The floor plan shows the contour of the seating.
37
3. Rotating Auto-saved Objects. Adding Material Parameters to Library Parts.
23 Open the Slab Tool Tool and click on the “Favorites” button. 24 Select “Seating” from the list list and click “Apply”. The required Slab setting values are set for modeling the seating. 25 Click “OK” on the Slab Default Setting dialog 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.
3.3 CREATING THE GDL OBJECT u e 03_03.mp4 Watch Movie 1 Open up the “AC “AC Guide Guide GDL Chapter 03” folder 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 followed the previous steps you should see this figure:
Now we have finished modeling. Hint: The “Paimio” chair is available with hollowed and solid seating options. In this lesson we modeled the for mer. If you prefer the hollowed version you can model the seating with curved walls and place empty openings in it.
38
2 Activate Activate (by (by double-clic double-clicking) king) the the “3.7 Check Check 3D” pre-set pre-set view in the Navigator.
Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
3. Rotating Auto-saved Objects. Adding Material Parameters to Library Parts.
The 3D window window opens opens and you can check the consistency of your 3D 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 saved Library Part. This concept allows users to easily rotate their custom GDL objects in space without the need for GDL scripting. 3 Activate Activate (by (by double-clicki double-clicking) ng) the “3.8 Open Open the Side View” 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°.
Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
4 Activate Activate the the “File > Libraries Libraries and Objects Objects > Save Save 3D Model as…” command 5 In the opening opening dialog dialog select select a folder where you want want to save 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 We suggest sugg est you store it near the cur rently open ArchiCAD file. 6 The “Save “Save as Library Library Part” dialog dialog opens. Select Select the the Object 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.
39
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 the “AC “AC Guide GDL Chapter Chapter 03” 03” folder in 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 click on the the Object Object Tool Tool and make make sure that “Armchair_Paimio.gsm” is the active object. Click OK to return to the floor plan.
9 Place the the armchair armchair object object on the floor plan plan with a click click of the 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
3. Rotating Auto-saved Objects. Adding Material Parameters to Library Parts.
3.4 EDITING THE GDL OBJECT u e 03_04.mp4 Watch Movie
4 Click Click Cance Cancell to return return to the the floor plan. plan. 5 Keeping the the object select selected ed activate activate the the “File > Librarie Librariess and Objects > Open Object” command.
1 Open up the “AC “AC Guide Guide GDL GDL Chapter 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 Activate the Arrow tool selection around the object.
and make an area
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 ar mchair is available in both colors. Let’s fix these problems with some easy-to-learn techniques. Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
The GDL Master Window opens. Each GDL GDL Object has its own Master Window in ArchiCAD. ArchiCAD. All controls needed to edit a GDL Object are present in the Master Window. 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 Let’s start editing the object by enhancing the 2D symbol.
41
3. Rotating Auto-saved Objects. Adding Material Parameters to Library Parts.
6 Click on on the “2D Symbol” Symbol” button to open the the 2D symbol symbol editing window wind ow..
9 Select Select the new 2D symbol symbol with with the Arrow Tool Tool on the top top left corner of the floor plan.
The 2D Symbol window is very similar to the floor plan window since you can use the s tandard ArchiCAD tools and editing techniques here, with the exception of the 3D e lements (e.g., Walls, 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, view, is not suitable for us since it contains too many lines but no background fills or hotspots. Let’s delete all elements from t he 2D symbol window. window. 7 Activate Activate the the “Edit > Select Select All” All” command command and then hit the the delete button on your keyboard.
Note that this enhanced 2D symbol drawing contains fewer lines and a white background fill. 10 Activate the “Edit > Copy” command.
All elements are cleared from the window 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 Activate (by double-cl double-clickin icking) g) the “3.11 “3.11 Edit the Object” Object” pre-set view in the Navigator to return to the f loor plan.
42
11 Click on on “Window “Window > Armchair_Pai Armchair_Paimio” mio” to to return to the object’s Master window.
12 Click on the 2D Symbol Symbol window to activate activate it and launch the “Edit > Paste” command. The content of the clipboard (the new symbol) is pasted into the active view. view. If the current zoom of t he 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 “Paste to to Origi Original nal Locatio Location” n” • “Zoom “Zoom to Paste Pasted d Elem Element ents” s” Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
3. Rotating Auto-saved Objects. Adding Material Parameters to Library Parts.
13 Click outside the selection marquee around the pasted 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.
15 Close the 2D Symbol Symbol window and click on the “Preview Picture” button.
The Preview Picture window, window, which is currently empty, opens. 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. window. We are going to copy a picture from an external source. Hint: The size of t he preview window is 128x128 pixels. pixels. In order to avoid distortion of the Preview Picture use rectangular images for this purpose. If you want to make rendered imag es 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 th e floor plan. 17 Activate the “File > Open…” command and select the “AaltoArmchair41Two” “AaltoArmchair41Two” file in th e “Chapter 03” folder. Make sure that the “All Files” types option is selected.
These additional hotspots will help you to easily align the armchair with other elements on the floor plan. Hint: You can also place one more hotspot in the middle of t he front of the seating. This point can be used to align the chair with a table.
Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
43
3. Rotating Auto-saved Objects. Adding Material Parameters to Library Parts.
The pasted image is added to the object preview picture window. window. 21 Close the Preview Preview Picture window. window. 22 Save your changes with “File > Save”.
3.5 A DDING DDING M ATERIAL P ARAMETERS ARAMETERS u e 03_05.mp4 Watch Movie Before we can make the frame and the seating materials parametric we have to add two new parameters parameters to the object’s parameter list. 1 Click Click on the “New” “New” button but ton to create create a new parameter.
2 Select Select the Variab Variable le field of the new paramete parameterr with the mouse and rewrite the default variable name to “frame_material”. 18 Activate the “Edit > Copy” command. command. 19 Click on “Window “Window > Armchair_Paimio” Armchair_Paimio” to return to the object’s Master wind ow. ow. 20 Click on the “Preview Picture” window to activate it and launch the “Edit > Paste” command.
This is the variable name that we are going to use in the GDL script. Please note that the variable name will not be shown in the “Object setting” dialog. 3 Select Select the Type Type field and and in the opening opening palette palette select select the Material parameter type.
This option will allow you to select from the materials defined in the currently open ArchiCAD file.
44
Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
3. Rotating Auto-saved Objects. Adding Material Parameters to Library Parts.
4 Select Select the Name Name field field and enter enter “Frame “Frame Material” Material”.. This parameter description will be displayed in the Object Settings dialog. 5 Click on on the pop-up button button near the the Value Value field field and select select “WD-Pine Horizontal” from the list. Alternatively, Alternatively, you can enter 15 in the “Value” “Value” field.
This will be used as the default value of the new parameter. 6 Click on on the “New” “New” button to create create an addition additional al parameter parameter.. 7 Set the followi following ng paramete parameterr values: values: • Variabl ariable: e: seatin seating_m g_mate ateria riall • Type: ype: Mate Materi rial al • Name Name:: Seati Seating ng Mate Materi rial al • Value: alue: 18 (Paint (Paint-01 -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 Click on the the “3D Scri Script” pt” butt button. on. Don’t Don’t be frightened by the commands and numbers that you see in the script. You don’t 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-P “Wd-Pine ine Horizo Horizonta ntal” l” • “Pai “Pain nt-01 t-01””
Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
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-Pin "Wd-Pinee Horizon Horizontal" tal" --> frame_mater frame_material ial • "Paint "Paint-01 -01"" --> seatin seating_m g_mater aterial ial Please note that text type parameter values are stored between quotation marks ("") in t he GDL script. You don’t 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 Activate the “Edit “Edit > Find & Replace…” Replace…” command. command.
45
3. Rotating Auto-saved Objects. Adding Material Parameters to Library Parts.
10 Enter "Wd-Pine Horizontal" in the upper field of the dialog dialog and “frame_material” in the bottom one.
16 Open the 3D View again again and check the result result of the parameter changes.
Hint: You can copy these texts straight from the 3D script and t he parameter’s “Variable name” field. 11 Click on “Replace “Replace All” All” button. button. 12 Activate again the “Edit > Find 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 Let’s test the result of our changes. 14 Click on the “3D View” button to see the object in the 3D window. You You can orbit in this window if you activate the “View > Orbit” command. 15 Close the 3D window and change the Values Values of the two material parameters. For instance you can set the “Paint-05” material for the seating.
46
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 st eps. In that case you have to check the 3D script and the two parameters. The parameter variable names in the 3D script and on t he 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. Window.
Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
3. Rotating Auto-saved Objects. Adding Material Parameters to Library Parts.
19 Back on the floor plan, select the object object with the arrow tool.
Note that the object is displayed with its Preview Picture in the object browser. The parameter list contains the new materia l 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, 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. below. These images can also be used as Preview Pictures for Library Parts.
Note that the area s election 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 d ialog..
22 Close the project with “File > Close”.
Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
47
4. Auto saving rectangular doors. Creating Custom Door Panels.
4. A UTO UTO SAVING RECTANGULAR DOORS RECTANGULAR DOORS. CREATING CUSTOM DOOR P ANELS. This chapter is dedicated to making custom rectangular doors in ArchiCAD. ArchiCAD. We’ll introduce introduce two ways you can create such objects without GDL scripting. The first method can be used if you have have to model the entire door object from scratch. T he second one allows you to apply custom door panels to standard ArchiCAD library door objects. This lesson covers t he following topics: • Rules Rules for for creatin creatingg doors doors in ArchiC ArchiCAD AD • Modeling Modeling rectangu rectangular lar doors doors on the the floor floor plan plan • Using custom custom door door panels panels with standard standard ArchiCAD ArchiCAD library library doors doors
4.1 O VERVIEW
Before we start working let’s have a quick look at the door that we intend to model. 2 Open up the the “AC “AC Guide GDL Chapter Chapter 04” folder folder in the 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.
u e 04_01.mp4 Watch Movie 1 Open the ‘AC Guide Guide GDL GDL Ch 04.pla’ 04.pla’ ArchiCAD ArchiCAD project project file file to start the fourth lesson of this interactive, hands-on ArchiCAD GDL training guide. Select the “Read elements directly from archive” option.
Hint: If you prefer you can create more complex door leafs using the techniques described below. below.
48
Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
4. Auto saving rectangular doors. Creating Custom Door Panels.
4.2 MODELING u e 04_02.mp4 Watch Movie 1 Open up the “AC “AC Guide Guide GDL GDL Chapter Chapter 02” folder in the Navigator and activate (by double-clicking) the “4.2 Modeling Steps” pre-set view in the “Chapter 4” folder.
elements in the x-y plane. See the illustrations at the bottom of this project view. 2 Activate Activate (by (by double-clic double-clicking) king) the the “4.3 Model Model the Door Frame” pre-set view in the Navigator. We We start modeling modeling with the the door frame. The active active view 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 “Favori “Favorites” tes” button 4 Select Select “Door Frame” Frame” from from the list list and click click “Apply” “Apply”..
We 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, way, doors/windows can be easily modeled with Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
49
4. Auto saving rectangular doors. Creating Custom Door Panels.
The required Slab parameters are set so that we can model the door frame element. 5 Click “OK” on the “Slab Default Sett Setting” ing” dialog box to return to the floor plan. 6 Move the cursor cursor over over the door door frame’s frame’s polygon polygon and hold hold down the Space button on the keyboard to activate the Magic Wand function. The cursor’s shape changes to a magic wand, wand, indicating that ArchiCAD will automatically trace the contours of the clicked element. 7 Clic Click k with with tthe he mou mouse se..
9 Open the Slab Tool and click on the “Favorite “Favorites” s” button. 10 Select “Door Panel” Panel” from the list and click “Apply”. “Apply”.
Let’s continue the modeling with the door leaf. 8 Activate Activate (by (by double-clic double-clicking) king) the the “4.4 Model Model the Door Panel” pre-set view in the Navigator. The floor plan shows the 2D outlines of the door leaf.
The required Slab parameter values are set so that you can create the door leaf. 11 Click “OK” on the “Slab “Slab Default Setting” Setting” dialog dialog box to return to the floor plan.
50
Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
4. Auto saving rectangular doors. Creating Custom Door Panels.
12 Activate the Magic Wand 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 slab with a click of the mouse. 14 Make sure that the Slab Tool Tool is still active. active. 15 Activate the Magic Wand and click click on the glazing’s contour. contour. Deselect the slab.
Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
The hole for the glazing is cut from the slab. 16 Open the Slab Tool again and click on the “Favorites” “Favorites” button. bu tton. 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.
51
4. Auto saving rectangular doors. Creating Custom Door Panels.
19 Activate (by (by double-clicking) the “4.5 Model the Window Window Grilles” pre-set view in the Navigator.
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 Wand on the exterior contour, then select the slab and click again with the Magic Wand on the interior contour to create the hole in the slab.
The floor plan shows the contours of the Prairie style window grilles. 20 Open the Slab Tool and click on the “Favorites” “Favorites” button. 21 Select “Window Grille” Grille” from the list and click “Apply”. “Apply”. We We are now finished with the door modeling, so let’s let’s save the GDL door object.
52
Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
4. Auto saving rectangular doors. Creating Custom Door Panels.
4.3 CREATING THE GDL OBJECT u e 04_03.mp4 Watch Movie 1 Open up the “AC “AC Guide Guide GDL GDL Chapter Chapter 04” folder in the Navigator and activate (by double-clicking) the “4.6 Select the model” pre-set view in the “Chapter 4” folder.
3 Activate Activate (by (by double-clicki double-clicking) ng) the “4.7 Save Save the Door” pre-set pre-set view in the Navigator. The 3D window opens and you can revise the 3D model before before you save it as a GDL object.
The floor plan shows the complete model. If you’ve you’ve followed the previous steps precisely you should s ee the figure as above. 2 Activate Activate the the Arrow Tool Tool and select select all the door door model elements with a rectangular selection.
Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
This view set shows the model from a generic axonometric view. view. Unlike in the case of a generic auto-saved GDL object, the 3D viewpoint doesn’t have 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.
53
4. Auto saving rectangular doors. Creating Custom Door Panels.
4 Activate Activate the the “File > Librarie Librariess and Objects Objects > Save 3D Model Model as…” command. 5 In the opening opening dialog dialog select select a folder in which which you you want to save the new object and enter “Door_Prairie_Style.gsm” in the “Save As:” field.
7 Open up the the “AC “AC Guide GDL Chapter Chapter 04” folder folder in the 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.
Hint: Make sure to save the object into a folder where you will be able to find it later. We We suggest sugges t you store it near the currently open ArchiCAD file. 6 The “Save “Save as Library Library Part” dialog dialog opens. Select Select the Door type and turn on the “Remove redundant lines from symbol” and the “Editable GDL script” options. Click “Save” to create the object and to close this dialog. 8 Double click click on the Door Tool Tool and make make sure that that “Door_Prairie_Style” is the active object. Enter 150 for “Reveal/Depth”. 9 Enter 150 150 for “Revea “Reveal/Depth l/Depth”. ”. Click Click “OK” to return to the floor plan.
Hint: The Editable GDL Script option allows us to make modifications in the object’s scripts at any time.
54
Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
4. Auto saving rectangular doors. Creating Custom Door Panels.
The rectangular hole was automatically created in the wall. The 3D model is now finished, but the 2D symbol is far from complete. It contains too many lines and t he opening line is not shown. Let’s fix these problems.
4.4 EDITING THE GDL OBJECT AC Guide GDL Ch 04_04.mp4 Watch Movie
10 Place the Door object on the floor plan with two mouse mouse clicks where indicated by the label. The first click defines the location of the door in the wall and the second one determines the opening direction of the leaf.
11 Activate (by double-clicking) the “4.9 Check 3D” pre-set view in the “Chapter 4” folder.
1 Activate Activate the Arrow tool and select select the door. door. 2 Keeping the the object object selected, selected, activa activate te the “File “File > Libraries Libraries and Objects > Open Object” command.
The GDL Master Window opens. 3 Click on the 2D Symbol Symbol button button to open open the 2D symbol symbol editing window wind ow..
Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
55
4. Auto saving rectangular doors. Creating Custom Door Panels.
All unnecessary lines are cleared from the door. 5 Complete Complete the 2D 2D symbol using the the “Line” “Line” and the “Circle “Circle” ” Tools Tools as shown below.
The current symbol, which was derived from the 3D model, is not suitable for us since it contains too many line segments but no opening line. 4 Activate Activate the the Arrow Tool Tool and select select all lines between between the door door frames as shown on this picture.
56
6 7 8 9
Close Close the 2D Symbol Symbol window window.. Save your changes changes with “File > Save”. Save”. Close Close the GDL GDL Maste Masterr Window Window.. Back on the the floor plan, check the the result result of your your last changes changes..
Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
4. Auto saving rectangular doors. Creating Custom Door Panels.
Our custom door is now complete, although - compared to t he standard door objects of the ArchiCAD library - its capabilities are limited. Let’s just list a few of these missing features: • The size and and material material of door door components components (e.g., (e.g., frame) frame) are not not parametric. • No optional optional door door accessories accessories (e.g. (e.g.,, trim, sill, sill, header, header, shutter, shutter, handle) are available. • The floor floor plan plan symbol symbol is not not scale scale sensitive sensitive.. • The door leaf leaf can’t can’t be opened opened with with editable editable hotspots hotspots in 2D 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 P ANELS
ArchiCAD “Library/Custom Object Macros” folder and they are loaded by default from the ArchiCAD star tup file. • Elements Elements of the custom custom object object macro macro folder folder can’t can’t be loaded 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 Activate the “File “File > Libraries Libraries and Objects Objects > Library Library Manager...” command 2 Click on on the “Local “Local LAN” tab tab page and on the left left side 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.
u e 04_05.mp4 Watch Movie The ArchiCAD feature that we are going to use to make the door panel is called “Custom Component Saving”. Before we start this lesson let’s summarize the basic facts that you ought to know about this technology: • Custom Components Components were were introduce introduced d in the ArchiC ArchiCAD AD 10 version, consequently this feature is not available in previous ArchiCAD releases. • Custom Components Components can can be used used with only those those Library Library Parts that were developed to support this feature. • All rectangul rectangular ar doors doors from the the standard standard ArchiCAD ArchiCAD 10 10 library library version support custom door panels. • The “Custom “Custom Compo Component” nent” add-on add-on has to to be loaded loaded with ArchiCAD (loaded by default in standard AC) before you start to use this function. • The custom custom object object macros macros have have to be be loaded loaded from the Library Library Manager. These required Library Parts can be found in the
Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
57
4. Auto saving rectangular doors. Creating Custom Door Panels.
3 Select Select the folder folder and click click on the “Add” “Add” button. button. Click Click “Done” to load the required library.
4 Open up the the “AC “AC Guide GDL Chapter Chapter 04” 04” folder in in the Navigator and activate (by double-clicking) the “4.10 Save a Custom Door Panel” pre-set view in the “Chapter 4” folder.
58
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.
Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
4. Auto saving rectangular doors. Creating Custom Door Panels.
Please also note that the bottom of the door panel 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 Activate the the Arrow Tool Tool and select select the door door leaf model model with the area selection on the floor plan.
6 Activate Activate the the “File > Librarie Librariess and Objects Objects > Save Custom Custom Component” command.
7 Select Select the “Custom “Custom Door Door Panel” Panel” Type Type from the the opening opening dialog.
Hint: Custom Components also allow you to creat e and use custom window panels and kitchen cabinet doors (“Custom Object Component”) with the corresponding ArchiCAD Library Parts. 8 Save the the custom custom object as “Prair “Prairie ie Style Style Panel.gsm” 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 informs you about how you can use your custom panel.
9 Click Click “OK” “OK” to return return to the the floor floor plan. plan. Before we can apply the new custom panel t o a door we have to reload it with the Library Manager. Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
59
4. Auto saving rectangular doors. Creating Custom Door Panels.
10 Activate the “File > Libraries Libraries and Objects > Library Manager...” command. 11 Click on the the “Reload” “Reload” button. button. 12 Open up the “AC “AC Guide GDL Chapter 04” folder in the the Navigator and activate (by double-clicking) the “4.11 Use a Custom Door Panel” pre-set view in the “Chapter 4” folder.
15 Open the “Internal Door Settings” tab page and select the “Door Panel” from the pop-up menu.
16 Browse through the available available panel styles and select “Custom Panel” at the end of the list.
The floor plan shows a standard single door from the ArchiCAD library. Currently a simple flush door panel is selected for it. 13 Activate the Arrow Tool and select select the door.
14 Open the Door Tool Tool to see the object’s parameters.
60
Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
4. Auto saving rectangular doors. Creating Custom Door Panels.
17 Locate the “Custom Panel Name” Name” parameter on the active tab page and select “ Prairie Style Panel”.
20 Activate the Arrow Tool Tool and select the door.
18 Click “OK” “OK” to return to the floor plan. 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. opening. Furthermore, Further more, all the parametric features of ArchiCAD doors are at your disposal, such as the optional trim, s ill and handle elements. Finally, Finally, you can open the door leaf with editable hotspots as described in the next steps.
Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
21 Click on the magenta hotspot located at the door handle. 22 Select the first item in the Pet Palette (“Move (“Move Node”) and open the door by moving the mouse. Now let’s let’s change the door opening angle on the floor plan as well. 23 Close the 3D window window to return to the floor plan. 24 Activate the Arrow Tool 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”) (“Stretch”) and modify the door opening angle by moving the mouse.
61
4. Auto saving rectangular doors. Creating Custom Door Panels.
We We have reached the end of the fourth lesson. In this training guide chapter we have learned how to create custom r ectangular doors. The next lesson will demonstrate how you can make custom shape openings (doors or windows) without GDL scripting. 27 Close the project with “File > Close”.
62
Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
5. Auto Saving Non-rectangular W indows.
5. A UTO UTO S AVING NON-RECTANGULAR WINDOWS. This chapter is dedicated to making making custom non-rectangular non-rectangular windows in ArchiCAD. ArchiCAD. We’ll introduce how you can model such objects without GDL scripting and how you can enhance them with with some simple techniques. This lesson covers the following new topics: • Rules Rules for for creating creating windows windows in in ArchiC ArchiCAD AD • Modeling Modeling non-rec non-rectangul tangular ar windows windows on on the floor floor plan • Creating Creating Preview Preview Pictures Pictures with the the Lightworks Lightworks renderin renderingg engine
2 Open up the the “AC “AC Guide GDL GDL Chapter Chapter 05” folder folder in the the Navigator and activate (by double-clicking) the “5.1 Overview” pre-set view in the “Chapter 5” folder.
5.1 O VERVIEW u e 05_01.mp4 Watch Movie 1 Open the the “AC “AC Guide GDL GDL Ch 05.pla” 05.pla” ArchiCAD ArchiCAD project project file file to start the fifth lesson of this interactive, hands-on ArchiCAD GDL training guide. Select the “Read elements directly from archive” option.
The circular window shown on the floor plan is a typical example of Decorated Style g othic rose windows. The window is unglazed and divided by profiled stone tracer ies. Hint: If you want to check the complete window object, open the Window Tool Tool and locate the “Gothic_Rose_Window_Final” “Gothic_Rose_Window_Final” Library Part in the Library Part browser. The window is located in the “Finished Objects” folder.
Before we start working, let’s have a quick look at the gothic rose window that is the subject of this lesson. Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
63
5. Auto Saving Non-rectangular Windows.
5.2 MODELING u e 05_02.mp4 Watch Movie
We 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.
1 Open up the “AC “AC Guide Guide GDL Chapter 05” folder folder in the Navigator and activate (by double-clicking) the “5.2 Modeling Steps” pre-set view in the “Chapter 5” folder.
3 Open the Slab Tool and click on the “Favorite “Favorites” s” button. 4 Select Select “Window “Window Mullion” Mullion” from the list list and click “Apply”. “Apply”.
We 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, 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. windows. Hint: The rules r ules 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 Activate (by double-c double-clicki licking) ng) the “5.3 Model Model the Mullions” Mullions” pre-set view in the Navigator.
64
The required Slab parameters are set so that we can start modeling the mullions.
Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
5. Auto Saving Non-rectangular W indows.
5 Click “OK” on the Slab Default Setting Setting dialog dialog box to return to the floor plan. 6 Move Move the cursor over over the the exterior exterior circle circle and hold down 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 Click with with the the mouse. mouse.
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. profiles.
8 Select Select the slab slab and activate activate the the Slab Tool Tool again. 9 Hold down down the Shift Shift key and click click on the contours contours of the internal polygons with the Magic Wand.
11 Open the Slab Tool and click on the “Favorites” “Favorites” button. 12 Select the “Mullion Profile” option from the list list and click “Apply”.
The required holes are added to the slab. Now let’s let’s model the profile of the mullions with t he Slab Tool.
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
5. Auto Saving Non-rectangular Windows.
13 Click “OK” on the Slab Default Setting dialog box to return to the floor plan. 14 Activate the Magic Wand (by pressing the Space button) and click on the external circle.
The holes are cut from the slab. So far, the modeling steps were the same as in Chapter 4, in which we made a rectangular door. However, However, if you saved this model now as a GDL window object, you would get the following result: Hint: You can regulate the segmentation of curved elements made with the Magic Wand in the “Magic Wand” Wand” settings. You 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 slab with a click of the mouse. 16 Make sure that the Slab Tool Tool is still active. active. 17 Activate the Magic Wand (with the Space key) and click on the contours of the internal polygons.
66
As a rule, ArchiCAD ArchiCAD always cuts a rectangular opening 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 t he model. In the next Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
5. Auto Saving Non-rectangular W indows.
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 Sometimes the wall wall opening opening size has has to be different different from from the size size of the window contours (e.g., when an oversize window is required). • You may also also want to create create custom-sh custom-shape ape empty empty wall openin openings gs without any window or door 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. opening. 19 Open the Slab Tool again and click on the “Favorites” “Favorites” button. bu tton.
Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
20 Select “Wall “Wall Opening” from the list and click “Apply”. “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 WALLHOLE is the name of a GDL command with which you can cut custom openings in a wall. We’ll We’ll use this command in Chapter 9 to create a non-rectangular door with GDL scripting. WALLNICHE WALLNICHE is another useful keyword keyword that you can enter in the ID field of a 3D polygon type element. This special code a llows 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.
67
5. Auto Saving Non-rectangular Windows.
23 Activate the Magic Wand Wand (hold down the Space key) and click on the circle.
Now we are finished with the modeling part so, let’s let’s save the GDL window object.
The floor plan shows the complete model. If you’ve followed followed the previous steps precisely, you should see the same figure as above. 2 Activate Activate the the Arrow Tool Tool and select select all the rose rose window model model elements with a rectangular selection.
5.3 CREATING THE GDL OBJECT u e 05_03.mp4 Watch Movie 1 Open up the “AC “AC Guide Guide GDL Chapter 05” folder folder in the Navigator and activate (by double-clicking) the “5.6 Select the Model” pre-set view in the “Chapter 5” folder.
68
Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
5. Auto Saving Non-rectangular W indows.
3 Activate Activate (by (by double-clic double-clicking) king) the the “5.7 Save Save the Rose Rose Window” pre-set view in the Navigator.
5 In the opening opening dialog dialog select select a folder folder in which which you you want to to save the new object and enter “Gothic_Rose_Window “Gothic_Rose_Window.gsm” .gsm” in the “Save As:” field.
The 3D window opens and you can revise the 3D model before before you save it as a GDL object. Hint: Make sure to save the object into a folder where you will be able to find it later. We We suggest sugg est you store it near the cur rently open ArchiCAD file. 6 The “Save “Save as Library Part” Part” dialog dialog opens. Select Select the Window Window type and turn on the “Remove redundant lines from symbol” and the “Editable GDL script” options. Click “Save” to create the object and to close this dialog.
This view set shows the model from a generic axonometric view. view. Unlike the case of general auto saved GDL objects, the 3D viewpoint doesn’t have have any affect on the resulting GDL window. 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 Activate the the “File > Librarie Librariess and Objects Objects > Save 3D 3D Model as…” command.
Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
Hint: The “Editable GDL Script” option allows us to make modifications (e.g., add material parameters) in t he object’s object’s scripts at any time. 7 Open up the the “AC “AC Guide GDL GDL Chapter Chapter 05” folder folder in the 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.
69
5. Auto Saving Non-rectangular Windows.
9 Place the the window window in the wall wall with two two clicks clicks of the the mouse where indicated by the label. The first click defines the location of the window in the wall, while while the second click determines the exterior side of it. The second click should be made at the bottom side of the wall.
8 Double click click on the the Window Window Tool Tool and make make sure sure that “Gothic_Rosw_Window.gsm” “Gothic_Rosw_Window .gsm” is the a ctive object. Click OK to return to the floor plan.
10 Activate (by double-clicking) the “5.9 Check 3D” pre-set view in the “Chapter 5” folder.
70
Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
5. Auto Saving Non-rectangular W indows.
Note that the circular hole is automatically created in the wall and the black slab is excluded from the model. T he 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 S YMBOL AC Guide GDL Ch 05_04.mp4 Watch Movie
3 Keeping the the window window selected, selected, activate activate the the “File > Librarie Librariess and Objects > Open Object” command.
The GDL Master Window opens.
1 Open up the “AC “AC Guide Guide GDL GDL Chapter Chapter 05” folder in the Navigator and activate (by double-clicking) the “5.10 Edit the Window Object” pre-set view in the “Chapter 5” folder.
4 Click on on the “2D Symbol” Symbol” button button to open the 2D 2D symbol symbol editing window wind ow..
2 Activate Activate the Arrow tool
and select select the window. window.
Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
71
5. Auto Saving Non-rectangular Windows.
The current symbol, which was derived from the 3D model, is not suitable for us as it contains too many line segments. 5 Activate Activate the the Arrow Tool Tool and select select all lines lines with the area area selection.
6 Delete the the selected selected elements elements by hitting hitting the “Delete” “Delete” key. key.
The 2D symbol window is cleared. 7 Click on the floor plan area to return to the floor plan. 8 Select Select the previously previously drawn drawn enhanced enhanced 2D window window symbol symbol at the bottom of the floor plan with the Arrow Tool.
9 Put the select selected ed elements elements on the the clipboard clipboard with with “Edit > Copy”.
72
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. view. If the current zoom of t he 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 “Paste to to Origi Original nal Locatio Location” n” • “Zoom “Zoom to Paste Pasted d Elem Element ents” s” 12 Click outside the selection marquee (which is is around the pasted elements) to place them into the current view. 13 Save your your changes with “File > Save”. Now let’s continue enhancing our rose window object by making the mullion material parametric.
Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
5. Auto Saving Non-rectangular W indows.
DDING M ATERIAL P ARAMETERS 5.5 A DDING u e 05_05.mp4 Watch Movie 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 window object objects. s. At At this stage stage we we want want to use use only only the Frame Material Material parameter for the traceries, so let’s hide the list’s unnecessary parameters. 1 Hide each each parameter parameter on the the list with the Hide Paramet Parameter er icon, except for “A”, “B”, “gs_window_material” and “gs_frame_mat”.
Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
We’ll 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 s cript. 2 Click Click on the the 3D Scri Script pt butto button. n. The 3D script window allows 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 t he material names with the variable name of the material parameter: • "Stn-Marble "Stn-Marble White" --> gs_frame_mat gs_frame_material erial
73
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 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 au tomatically. tomatically. 3 Activate Activate the the “Edit > Find & Replace Replace…” …” command. command.
7 Close the the 3D window window and and set “Stn-Marbl “Stn-Marblee Pink” or number “6” for the Frame Material parameter.
8 Open the the 3D View View again again and check check the the result result of the the parameter changes.
4 Enter "Stn-Mar "Stn-Marble ble White" White" in the upper upper field field of the the dialog dialog and “gs_frame_material” in the bottom field. Hint: You can copy these texts straight from the 3D script and t he parameter’s Variable name field. 5 Click Click on the “Re “Replac placee All” butto button. n. Now the 3D script is referring to the frame parameter for material definitions. Let’s Let’s test the results of our changes. 6 Click on on the 3D View View button button to see see the object object in the the 3D window. You You can orbit in this window if you activate the “View > Orbit” command. Hint: If the material parameter has no affect on the 3D model or if you get an er ror message when opening the 3D view, 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 changes with “File > Save”. Save”.
The rose window is displayed with wood wood material, which is the current value of the Frame Material parameter.
74
Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
5. Auto Saving Non-rectangular W indows.
AKE A PREVIEW PICTURE WITH ICTURE WITH 5.6 M AKE A LIGHTWORKS u e 05_06.mp4 Watch Movie 1 Click Click on the “Previ “Preview ew Pictu Picture” re” button button..
The Preview Picture window opens. It is currently empty. 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 Pictu re window. 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 size of the Library Parts’ Parts’ Preview Preview window window is always always 128x128 128x128 pixels. • If you you want to use use rendered rendered images as as Preview Pictures, Pictures, make make sure that the 3D window is rectangular • In order order to avoid avoid any loss loss in Preview Preview Picture Picture quailty, quailty, set the photorendering window size to 128x128 pixels. 2 Activate Activate (by (by double-clicki double-clicking) ng) the “5.11 “5.11 Make a Preview Preview Picture” pre-set view in the Navigator to return to the floor plan. Do not close the GDL Master Window at this time.
Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
Note that the floor plan already contains two special light objects (SkyObject, SunObject) that are essential when making high quality images with t he LightWorks LightWorks rendering engine. 3 Select Select the rose rose window window in the wall wall and open open its “Window “Window Settings” dialog d ialog.. 4 Set the frame frame material material paramete parameterr to “Stn-Marble “Stn-Marble White”. White”. 5 Click “OK” to to return to the floor plan plan and desele deselect ct the window. 6 Open the 3D Window Window (“View (“View > Elements Elements in 3D View View > Show All in 3D”).
75
5. Auto Saving Non-rectangular Windows.
7 Activate Activate the the “View > 3D View View Mode > 3D Window Window Setting Settings” s” command. 8 Turn off the “Keep “Keep Proportions” Proportions” option option and and set the the window window size to 600x600 pixels.
Let’s adjust the photo rendering parameters to get a nice rendered image. 11 Activate the “Document > Creative Imaging Imaging > Photorendering Settings” command. 12 Modify the rendering parameters as shown on the picture.
9 Click “OK” to to make the 3D window window rectangular rectangular.. 10 Using the “Orbit” or the “Explore” functions, set your your preferred camera position fo r the Preview Picture.
76
Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
5. Auto Saving Non-rectangular W indows.
• Shadow Shadow Resolut Resolution ion --> By lamp lamp settings settings • Background Background --> --> Sky and Ground Ground color color is black Hint: You may play with these parameters and find the sett ings you think are best. 13 Close the “PhotoRendering Settings” dialog with “OK”. 14 Start the photo rendering rendering process with 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. window. 15 Select the picture with “Edit > Select Select all”.
• • • • •
Engine Engine --> LightWorks LightWorks Rendering Rendering Engine Engine Meth Method od --> --> Bes Bestt Effe Effect ctss --> All All turne turned d on Shado Shadow w casting casting --> --> By lamp lamp setti settings ngs Light Light source sourcess --> Only Only Lamp Lampss is activ activee
Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
16 Copy the content of the marquee onto the clipboard with “Edit > Copy”. 17 Return to the GDL Master Master window with with “Window > Gothic_Rose_Window”. 18 Click on the “Preview “Preview Picture” Picture” button. 19 Paste the content content of the clipboard into into the Preview Picture Picture window with “Edit > Paste”.
77
5. Auto Saving Non-rectangular Windows.
23 Open the “Window Settings” Settings” dialog. dialog. Note that the object is now displayed with its Preview Picture in t he Library Part browser. The parameter list contains only the frame material parameter. If you change the parameter the selected window’s window’s mullion material will be updated.
20 Close the Preview Picture window and save the changes with “File > Save”. 21 Close the GDL Master Master Window Window to return to the floor plan. 22 Back on the floor plan, select the rose window that is placed in the wall.
78
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”.
Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
6. Basics of GDL Scripting
6. B ASICS OF GDL SCRIPTING In this chapter you will start using GDL commands. The object that we’ll use as an example is a simple circular tabletop with a round leg. You You will work work in the Library Part Editor Window and learn about the various elements of this environment: • The Obje Object ct Hierar Hierarch chyy (Subtyp (Subtypes) es) • ZZYZ ZZYZX X Para Parame mete terr • The Global Global Coordina Coordinate te System and the the Local Coordinate Coordinate System System • 3D Script Script and 3D 3D View, View, plus 2D Script Script and 2D 2D Full View View windows windows • Param Parameter eter Script Script Window Window • 3D hot hotsp spot otss of Obj Objec ects ts This lesson demonstrates the following basic object-making techniques: • Using Using basic basic 3D shape shape generatin generatingg command commandss • Using paramet parameters ers in GDL GDL commands commands to make objects objects parametric parametric • Manipulatin Manipulatingg the Local Coordi Coordinate nate System System (moving, (moving, mirroring), mirroring), undoing coordinate transformations • Using Using comm command andss to set set mater material ialss • Checking Checking the the created created model model in 3D for for correctness correctness
6.1 O VERVIEW u e 06_01.mp4 Watch Movie 1 To start the sixth lesson lesson of this interact interactiv ive, e, hands-on hands-on ArchiCAD GDL training guide, open “AC Guide GDL Ch 06.pla”. Select the “Read elements directly fr om archive” option.
Let’s have have a look at t he object that we are g oing to model. 2 Open up the the “AC “AC Guide GDL GDL Chapter Chapter 06” folder folder in the the View Map of the Navigator pa lette 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 s tands may be chrome, white or black lacquered. The leg is made of birch. Its top material may be birch veneer, linoleum or laminate. For more information please visit the manufacturer’s website: www.artek.fi
Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
79
6. Basics of GDL Scripting
As you can see, the object has six default parameters. These parameters come from the GDL Subtype upon which the object is based. Every GDL Object has a Subtype upon which it is based. Subtypes are different kinds of GDL Objects with different kinds of basic behavior and different sets of parameters. They can be considered to be like templates. When creating a GDL Object, the Subtype which it is based upon is important. 4 Click the the “Select “Select Subtype… Subtype…” ” button in in the Library Library Part Editor Window to bring up the “Subtype Hierarchy” dialog.
Hint: If you want to check the complete GDL object that we are going to make, open the Object Tool and locate the “Pedestal_Table_P90_Final” “Pedestal_Table_P90_Final” Library Part in the object browser. The object is located in the “Finished Objects” folder. 3 Choose the “File “File > Libraries Libraries and and Objects Objects > New Object… Object…” ” menu command.
.
80
Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
6. Basics of GDL Scripting
Subtypes are arra nged 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 hierarc hierarchy hy select select “General “General GDL GDL Object Object > Model Element > Opening > Roof Opening > Skylight”, and click the “Select” button.
At this point there are many more parameters available. Among other things these control how the object behaves and how it is represented in 2D. 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 re gular Model object would not behave this way. way. This is why it is important to select the proper Subtype for your Object. At the top of the Editor Window Window, above the “New” button, the name of the Subtype is displayed for quick reference. 6 Click the the “Select “Select Subtype…” Subtype…” button button again. In In the hierarchy hierarchy select the “General GDL Object > Model Element” Subtype, and click the “Select” button to return to the Editor Window. Because we are now creating a general 3D element, this is the best Subtype for the task. The default parameter list of the Object has changed.
Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
81
6. Basics of GDL Scripting
ARAMETERS 6.2 CREATING P ARAMETERS u e 06_02.mp4 Watch Movie We We will now create the necessary parameters that we are going to use in our Object. 1 Go back to to the Floor Floor Plan of ArchiCAD, ArchiCAD, and activ activate ate (by double-clicking) the “6.2 Creating Parameters” saved view in the “Chapter 6” fold er of the Navigator.
ZZYZX: the Height of the Table • ZZYZX: Hint: It is good practice to create descriptive variable names so that later you can eas ily 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 You can find a list of these on Page 265 of the AC GDL Reference Guide. 2 Let us start start creating creating these paramete parameters. rs. Select Select the “Window “Window > Untitled-1” menu item. “Untitled-1” is currently the name of the GDL Library Part we started creating.
3 Using the the same procedure procedure you learned learned in previous previous chapters chapters of this tutorial, create the following variables and set them to the values contained in the table below. below. Variable Variable Radius_Top
Thickness_Top The Floor Plan Window shows which which dimensions and attributes of the Object we want to make parametric. These include: Radius_Top: The radius of the circular tabletop • Radius_Top: Thickness_Top: The thickness of the circular tabletop • Thickness_Top: • Radius_Leg: Radius_Leg: The radius of the circular leg of the table Material_Top: The material assigned to the table top • Material_Top: Material_Leg: The material assigned to the leg of the table • Material_Leg: • Material_Bottom: The material assigned to the pedestal on which the table stands (also the material of the conical shape below the table top)
82
Radius_Leg Material_Top Material_Leg
Type Length
Name Radi adius of tabletop Len Length gth Thic Thickkness ness of tabletop Leng Length th Radi Radius us of tabl tablee leg Mate Materi rial al Mate Materia riall of of tabletop Material Mate aterial of of le leg
Material_Bottom Mate Materi rial al Mate Materia riall of of bottom element
Value
375 40 30 15 (Wd-Pine Horizontal) 15 (W (Wd-Pine Horizontal) 13 (Mtl-Chrome)
Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
6. Basics of GDL Scripting
Hint: As you created thes e 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 Modify the default default Name Name and Value Value fields fields of the the ZZYZX default parameter. For “Name” enter “Height of table”, and for “Value” enter “710”.
Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
We 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 a nd 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 could create and use another parameter to control the height of the Object, but it would not make the Object ver tically stretchable and you would have to go to the Sett ings Dialog to modify it.
83
6. Basics of GDL Scripting
6.3 CREATING THE 3D GEOMETRY u e 06_03.mp4 Watch Movie 1 Click the the “3D View” View” button button to display display the 3D View View of the Editor.
You You can see a “G,L” string next to the origin of the coordinate 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 Editor Window Window,, click the button button to the right right of the “3D “3D Script” button to open the 3D Script in a separate window.
The 3D View currently does not display 3D 3D elements. There will also be a message saying that there are no 3D elements. You 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. vector. This lets you easily recognize the exact orientation of the axes. The two buttons produce different behaviors. behaviors. If you click the “3D Script” button, the 3D Script will be displayed in the Editor Window
84
Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
6. Basics of GDL Scripting
in place of the parameter list. If you click the button to its right, it will open in a separate window.
3 Click the “Help “Help > ArchiCAD ArchiCAD GDL Refere Reference nce Guide” Guide” menu menu item. 5 In the PDF PDF file select select the line containing containing the syntax of the command and copy (CTRL+C) it to the Clipboard.
The “AC “AC GDL Reference 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 values in the command, thereby eliminating possible error messages resulting from incorrect syntax. 4 Go to Page Page 33 in the AC GDL GDL Reference Reference Guide Guide and find find the description of the CONE command there. Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
6 Go back to to the ArchiCAD ArchiCAD window and and click in the 3D 3D Script Script Window of the Object. Paste (CTRL+V) the GDL code into the 3D Script Window. Window. CONE h, r1, r2, alpha1, alpha2
85
6. Basics of GDL Scripting
The syntax of a GDL command is as follows: CONE in this case) • First First comes comes the the name name of the the keywo keyword rd ( CONE • A “SPAC “SPACE” E” charac character ter must must follo follow w it • Then comes comes the list list of paramete parameters rs of the the GDL command 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. 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 t ip, 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 Modify the the GDL code code as as follow follows: s: CONE .06, .25, Radius_Leg, 90, 90
The Cone will will be .06 .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 als o possible to specify them in imperial units (e.g., 1/2" or 1'-3 1/2" ). Further, when specifying values with a leading zero, zero, it is not necessary to type in the leading zero. So 0.06 and .06 are equally correct.
86
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 the following following command command in the the next line line of the 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 t he Local Coordinate System. 9 Activ Activate ate the 3D View View..
You 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. Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
6. Basics of GDL Scripting
10 In the GDL Reference Guide, find 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 will create a cylindrical 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 the code to the following: following: CYLIND .05, Radius_Leg
13 Enter the following command in in the next line of the 3D Script: ADDZ .05
We 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 progre ss 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-. ZZYZX-Thickness_Top-.04-.05-.06 05-.06
The next element we need to create is the leg portion of the Table. 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 ZZYZX ): the thickness of the following from the height of the table ( ZZYZX Thickness_Top ), the height of the upper reversed the table top ( Thickness_Top 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 as sign values to new variables. This is what we did in the line of code above.
This way the Radius_Leg parameter will be used to specify the radius of this element.
Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
87
6. Basics of GDL Scripting
15 Enter the following command in the next line 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 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 necessar y.
88
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. downward. The x and y-axes point in the original directions.
Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training 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 syst em, a cone will now be generated downward, which was our purpose with this step. 18 Enter the following command command in the next line of the 3D 3D Script: CONE .04, .15, Radius_Leg, 0, 0
ArchiCAD will display an error message saying that you have a Parameter error.
Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
Error messages a re 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 messag e 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 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. T his is why in Step 16 we moved the Local Height_Leg ) plus the Coordinate System by the value of the leg ( Height_Leg height of the upper cone (.04).
89
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 DEL ) System axes. The parameter ( 1 ) following the command name 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.
90
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.
Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
6. Basics of GDL Scripting
When the DEL command is followed by the TOP parameter, it instructs ArchiCAD to delete (undo) all coordinate transformations. This will result in the Local Coordinate System origin returning to its position coinciding with the Global Coordinate System origin. 23 Activate the 3D View to see the whole model.
With this last command, we finished creating the 3D model of the Table. 22 Enter the following command in the next line of the 3D Script: DEL TOP As you can see, the entire model is complete. complete. Move Move around the model using the ArchiCAD’s Orbit feature (hold down the SHIFT key and the middle mouse key simultaneously, simultaneously, and move around with the mouse). You will also see that the Global and Local Coordinate Systems are coincident.
Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
91
6. Basics of GDL Scripting
SSIGNING MATERIALS 6.4 A SSIGNING u e 06_04.mp4 Watch Movie
2 Find the first first line defining defining the the bottom cone cone (CONE (CONE .06, .25, .25, Radius_Leg, 90, 90) and paste the material code in front of it so it will look like this: [SET] MATERIAL index CONE .06, .25, Radius_Leg, 90, 90
When you viewed the 3D model of the Table, Table, you saw that the every element of the model was of the same material. This is because we have not yet assigned materials t o the various elements within the model. 1 Find the the “MATERIA “MATERIAL” L” command command in the GDL Referen Reference ce Guide (Page 156) and copy its syntax code to the Clipboard. SET] MATERIAL name_string SET] 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: 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. Horizontal. An example of an index number is 15. 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.
92
3 Modify the command command to the the following following:: MATERIAL Material_Bottom Material_Bottom CONE .06, .25, Radius_Leg, 90, 90
We 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. Material_Bottom.
Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
6. Basics of GDL Scripting
4 Activate Activate the 3D View to see the result. result.
We We should not generate the entire table using using the material specified by Material_Bottom. Material_Bottom. As such, whenever we want an element t o be generated using a different material, we need to insert a new MATERIAL command just before its code. 5 Insert the other other MATERIAL MATERIAL definit definitions. ions. Place Place three more more material commands in their respective places so the code reads as follows: MATERIAL Material_Leg Material_Leg CYLIND Height_Leg, Radius_Leg
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, Material_Bottom, and the tabletop will use Material_Top. Material_Top. 6 Activate Activate the 3D View to to see the the result. result.
MATERIAL Material_Bottom Material_Bottom CONE .04, .15, Radius_Leg, 90, 90 MATERIAL Material_Top Material_Top CYLIND Thickness_Top, Radius_Top
Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
93
6. Basics of GDL Scripting
Orbit around the model to see it from below. below. Note how each of the elements are shaded differently for different materials. 7 In the parameter parameter list, list, select select the Material_ Material_Bottom Bottom paramet parameter er 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.
6.5 CREATING VALUE LISTS FOR PARAMETERS u e 06_05.mp4 Watch Movie In GDL it is possible to define a list of values for any parameter from which the user may choose. This is useful if you wish to create standard sizes for cata logs. For, For, example, in the case of a door, you could create value lists for its width and height parameters. 1 Open the Parameter Parameter Script Script by by clicking clicking on its its button button in the Editor Window. Window.
8 Activate Activate the 3D 3D View to see see the result.
This is the Script Window in which you define these value lists. 2 In the GDL GDL Reference Reference Guide, Guide, find find the VALUES VALUES command command (Page 185) and copy it to the Clipboard. VALUES "fillparam_name" "fillparam_name" [[,] [[,] FILLTYPES_MASK FILLTYPES_MASK fill_types,] [,]value_definition1 [, value_definition2, value_definition2, ...]
Orbit around to see which elements changed their materials. 9 Set the Material_Bott Material_Bottom om parameter parameter back back to Mtl-Chrom Mtl-Chrome. e. This concludes setting the materials.
94
Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
6. Basics of GDL Scripting
3 Go to the Paramet Parameter er Script Script of the Object Object and paste paste the code into it.
5 Close the Paramet Parameter er Script Script and select select the Radius_T Radius_Top op parameter in the parameter list.
The portions of the command in parentheses parentheses are optional, so we will not go into those right now. now. If you clean these from the command, the following remains: VALUES "fillparam_name" "fillparam_name" value_definition1 value_definition1 [, value_definition2, value_definition2, ...] You will 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 the right-pointi right-pointing ng arrow in the “Value” “Value” field field of the Radius_Top parameter and select 375 from the value list.
The fillparam_name parameter is the name of the parameter to which these possible values will be assigned. There must be at least one value definition parameter, but there can be as many as you wish. 4 Modify Modify the the comma command nd as follo follows: ws: Values "Radius_Top" "Radius_Top" .300, .300, .375
This means that a value list consisting of two possible values of “.3” Radius_Top. and “.375” will be applied to the parameter Radius_Top. Again, metric values in scripts are always in meters. Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
As you can see, a value list appears, and there are two two possible values: 300” and “375 “300” “375”. ”. Hint: The format that defines which values are displayed in the Library Part Editor Window is c ontrolled 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 “375”” (millimeters) displayed and not “.375 “.375”” (meters).
95
6. Basics of GDL Scripting
HECKING THE 3D MODEL 6.6 CHECKING THE u e 06_06.mp4 Watch Movie
Orbit around the model to see that the individual parts join correctly. 3 Set several several other other parameters parameters to see if if the model model is still correct.
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 geometr y to see if it is scripted properly. 1 Activ Activate ate the the 3D View View of the the Object. Object.
4 Set the modified modified parameters parameters back to their their defaults. defaults. The following table shows what the defaults should be:
2 Go back to the the Editor Window Window,, and modify modify the value value of the “ZZYZX” parameter to 1.000 (1000 mm), then activate the 3D View to see the result.
96
Variable A B ZZYZX Radius_Top Thickness_Top Radius_Leg Material_Top Material_Leg Material_Bottom
Value 1000 1000 710 375 40 30 15 (Wd-Pine Horizontal) 15 (Wd-Pine Horizontal) 13 (Mtl-Chrome)
Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
6. Basics of GDL Scripting
OF THE OBJECT 6.7 CREATING THE 2D OF THE u e 06_07.mp4 Watch Movie We We will now create a simple 2D Representation of the Object. 1 Find the the “CIRCLE2 “CIRCLE2” ” command command in the the GDL Reference 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. 2D. x and y specify the coordinates for the center of the circle, while r defines its radius. 2 Open the 2D Script Script by clicki clicking ng its button button in the the Editor Editor Window. Window.
Basically, the 2D View of t he object is a Top View. 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 cor respond 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 Activate the the 2D Full View View by clicking clicking on its its button in the the Editor Window to see the result.
3 Paste Paste the command command syntax syntax code code into the the 2D Script. Script.
4 Modify Modify the command command to the following: following: CIRCLE2 0, 0, Radius_Top
Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
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.
97
6. Basics of GDL Scripting
LACING AND WORKING WORKING WITH WITH THE THE 6.8 PLACING AND OBJECT AC Guide GDL Ch 06_08.mp4 Watch Movie
3 Close the the Editor Editor Window Window and go back to the Floor Plan. Plan. Activate (with a double-click) the “6.3 Working Working with the Object” saved View. View. 4 Select Select the Object Tool Tool in the Tool Tool Bar. Bar. In the Info Box, click click on the Object Tool icon to open its Settings Dialog. Dialog.
We We will now save the Object, then place and manipulate the finished Object. 1 While While still still in the the Libr Library ary Part Part Editor Window, select the “File > Save As…” menu command. 2 In the the upcomin upcoming g Dialog Dialog,, find find an appropriate folder for your Object. In the File Name field, enter “Pedestal_Table_P90”. “Pedestal_Table_P90”. Click the “Save” button to save it.
The Dialog opens up with the Object you just saved and selected. In the Parameters list you can see all the parameters you created. Above the Parameter list, you can see the width, depth and height parameters (from top to bottom). We used the height parameter in
98
Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
6. Basics of GDL Scripting
the Object so you can expect it to react should we adjust this parameter. As you can see, the default parameters we set in the Editor Window are now displayed for the parameters. In the upper right corner is the Preview Window of the Object. It currently displays the 2D View of the Object. As you can see, the the program has automatically created five five hotspots hotspots at the center and the cor ners of the bounding box for easy placement. 5 In the Previe Preview w Window, Window, click the middle middle hotspot. hotspot.
Notice that the Object was placed by the selected hotspot. This is handy if you want to align your Object to some other element by one of its hotspots. 7 Select Select the Object Object by clicki clicking ng on one of of its hotspots hotspots or drawing an Area Selection rectangle around it. Click the right mouse button. In the appearing context menu, select the “Show Selection/Marquee in 3D” command. There will be a rectangular box around the selected hotspot. When you place the Object later, it will be placed in such a way that its selected hotspot will be located at the position you clicked. 6 Click “OK” “OK” to close close the Dialog Dialog.. Click somewhere somewhere in in the middle of the screen to place the Object.
Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
99
6. Basics of GDL Scripting
and this is why we used it. We wanted the model of the Object to align with this parameter. 9 Click the the upper middle 3D hotspot. hotspot. In the the appearing appearing Pet Pet Palette, select the Stretch Height command.
8 Select Select the Object Object in the 3D Window Window..
10 Move your your cursor around to see how the 3D bounding box of the Object stretches along with your movements. It provides a visual feedback of how large the Object will be after the stretch.
Notice that in 3D there are five hotspots at its base plane, and another five hotspots above the previous five, at a fixed distance above them. That distance is defined by the “ZZYZX” parameter,
100
Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
6. Basics of GDL Scripting
shortcut key will place it in the most obvious field. Since we are vertically stretching an Object, the height is the obvious choice for the input.
11 On the keyboard, enter the following: “600”. “600”. Now press the “ENTER” key.
The new value will be applied to the Object as seen in its 3D model and 3D hotspots. As you can see, the model a nd the 3D hotspots continue to be aligned with each other. If you did not use t he “ZZYZX” parameter, stretching the height would modify the position of the upper upper 3D hotspots, but not the geometry of the Object.
With this you entered the new height into the Tracker. Tracker. Although you usually need to press shortcuts keys (such a s “R”, “X” or “A”) “A”) to activate a field in the Tracker, starting to enter a value without a Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
101
6. Basics of GDL Scripting
This concludes this chapter. 12 Save the the project and close close it.
102
Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
7. Basics of GDL Scripting – Part 2
7. B ASICS OF GDL SCRIPTING – P ART 2 In this chapter you will continue exploring various GDL commands and concepts. You You will model part of another, slightly more complex table. You You will again work in the Library Part Editor Window. Window. This lesson demonstrates the following basic object making techniques: • Using IF-THEN IF-THEN commands to implement the creation of model pieces based on user-defined conditions • Using subrouti subroutines nes to create create parts of of the model model that that occur multipl multiplee times PRISM_ command) and so-called “Status • Usin Usingg com comma mand ndss ( PRISM_ Codes” to control the visibility of individual surfaces and edges of Objects in 3D • Using additio additional nal special special “Status “Status Codes” Codes” for creating creating curved curved objects objects
Let’s have have a look at t he object that we are going to model. 2 Open up the the “AC “AC Guide GDL GDL Chapter Chapter 07” folder folder in the the View View Map of the Navigator pa lette and activate (by double-clicking) the “7.1 Overview H98” saved view in the “Chapter 7” folder.
7.1 O VERVIEW u e 07_01.mp4 Watch Movie 1 To start the seventh seventh lesson lesson of this interact interactiv ive, e, hands-on hands-on ArchiCAD GDL training guide, open the “AC Guide GDL Ch 07.pla” file. Select the “Read elements directly from archive” option.
Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
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 manufacturer’s website: www.artek.fi There is another type of this table, which is slightly shorter in length and width. If you activate (by double-clicking) the “7.2 Overview H99” saved view in the “Chapter 7” folder, you can see its dimensions.
103
7. Basics of GDL Scripting – Part 2
Hint: If you want to check the complete GDL object that we are going to make, open the Object Tool and locate the “Extension_Table_H98_Final” “Extension_Table_H98_Final” Library Part in the object browser. The object is located in the “Finished Objects” folder.
7.2 CREATING THE PARAMETERS u e 07_02.mp4 Watch Movie
Since we are now creating a Table, we need to modify the Subtype t o fit our desired Object type. 2 Choose the the “File “File > Save Save as…” command command to save save the file. file. Give it the name “Extension_Table_H98.gsm” “Extension_Table_H98.gsm” in the Save Dialog, and click “OK” to save it to a location of your choice.
1 Choose the “File “File > Libraries Libraries and and Objects Objects > New Object… Object…” ” menu command. As you can see, the default Subtype of any new object is “Model Element”.
104
Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
7. Basics of GDL Scripting – Part 2
3 Click the “Select “Select Subtype Subtype…” …” button button in the Library Library Part Part Editor Window to bring up u p the Subtype Hierarchy Dialog.
4 In the hierarch hierarchyy select select “General “General GDL GDL Object Object > Model Element > Furnishing Fur nishing > Table”, and click the “Select” button.
The default parameter list of the Object has changed to “Table”.
Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
105
7. Basics of GDL Scripting – Part 2
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 We are going to use several of these parameters and we will also create some new ones. 5 Go back to the the Floor Plan and activ activate ate (by double-cli double-clicking cking)) 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 (CTRL-ALT-click [Windows] / CMD-OPT-click 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 the kind we will create for this object. 6 Go back to to the Editor Editor Window Window and create create several several new parameters based on the following table: Variable Variable Type Table_Type Text Show_Insert Boolean Title _3D_representation Title _3D_representation Thickness_Top Leng Length th Pen_Top Pen
Pen_Leg
106
Pen
Name Type Type of table Show Inser t piece 3D Representation Thick Thickne ness ss of table table top top View pen of table top in 3D View pen of legs in 3D
Value H98 Off
50 4 4
Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
7. Basics of GDL Scripting – Part 2
When the number of parameters increases, it becomes necessary subdivide the parameters into categories that make them organized and easier to use. The Editor Window has several options that help you do that. 7 Select Select the “Table_ “Table_Type Type” ” variable variable and click click on the two-pointed arrow in the left end of its row. Drag the parameter by this arrow to the position below the para meter “AC_show2DHotspotsIn3D”. With the use of the two-pointed arrows you you can move any parameter in the list of parameters to any desired location.
Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
107
7. Basics of GDL Scripting – Part 2
8 Drag the “Show_I “Show_Insert” nsert” parameter parameter to to the position position below below the parameter “Table_Type”. “Table_Type”.
9 One by one, one, drag the other other four created created paramet parameters ers to the position below the parameter “gs_back_pen” such that their order remains the same.
We 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) 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 Type button of the “_3D_representation” parameter and look over the types of parameters that are available.
108
Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
7. Basics of GDL Scripting – Part 2
The following table shows the parameter Types Types and their uses: Type Leng Length th
Angle Real Number Inte Integer ger
Usage used used for for phys physica icall dim dimen ensi sion onss of of ele eleme ment nts, s, such such as the the length of an edge or the height of an element used for angle values, e.g., e.g., the value by which an element is rotated used for any kind of number used in your s cripts
used used for for who whole le numb number er type type of of vari variab able les, s, such such as as the the number of pieces in a structure, or the number of times an operation should be repeated Bool Boolea ean n used used for for Yes Yes/N /Noo-ty type pe of of cond condit itio ions ns,, like like toggl togglin ingg an element on/off Text used for any type of text strings used in your scripts Mater Materia iall used used for for ass assign ignin ingg mat mater erial ialss to to ele eleme ment ntss in in GDL GDL Line Line type type used used for for assi assign gnin ingg line line type typess to GDL GDL elem elemen ents ts Fill pattern used for assigning assigning fill fill types to GDL GDL elemen elements ts Pen Pen color color used for assigni assigning ng pen pen colo color/i r/inde ndexx numb numbers ers to to GDL GDL elements Separato Separatorr used to sepa separate rate parame parameters ters from from each each other other in in the the parameter list Title used to create a bolded title line under which you can group parameters
• 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 tog gle on, this parameter will not accept parameter values from the default settings during a parameter transfer (CTRL-ALT-click (CTRL-ALT-click [Win] / CMD-OPT-click [Mac]). 11 Select the “Thickness_Top” “Thickness_Top” parameter in the list and click on its Subordinate button.
So the Title Parameter Type is used for g rouping. 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 d irectly set its value.
Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
109
7. Basics of GDL Scripting – Part 2
12 Repeat this operation with the “Pen_T “Pen_Top” op” and “Pen_Leg” parameters.
15 In the Parameters Parameters panel of the Dialog, Dialog, click on the right-pointing arrow to the left of the “3D Representation” text in the parameter list.
13 Save the Object and go back to to the Floor Plan View. View. 14 Select the Object Tool Tool from the Toolbox and open its Settings Dialog. Dialog. The settings of the “Extension_Table_H98.gsm” “Extension_Table_H98.gsm” file will be visible.
Here you can see the effect of the Subordinate toggle. Since you switched the Subordinate toggle to ON for all three parameters, they are now shown as set of sub-parameters of the parameter immediately preceding them. This is how you can neatly organize your parameters into logical groups.
110
Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
7. Basics of GDL Scripting – Part 2
16 Close the Setting Dialog and go back to the Editor Window. Window. Open the Parameter Script and type in (or copy-paste from this document) the following code: VALUES "Table_Type" "Table_Type" "H98", "H98", "H99"
7.3 CREATING THE MASTER SCRIPT u e 07_03.mp4 Watch Movie 1 Click on the “Master “Master Script Script Window” Window” button to to open the Master Script in a separate Window. Window.
With this command we have set the two possible 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” “Table_Type” parameter and click the right-pointing arrow at the right of its Value field to make sure the two possible values are now available. The purpose of the Master Script is the following: it is a script that is executed before every other type of script. Thus, whatever you write in the Master Script will be executed before the 2D Script, the 3D Script, the Parameter Script, etc. In everyday use this works the following way: when you click the “3D View” button, ArchiCAD knows that it first needs to execute commands found in the Master Script. This is then followed by commands it finds in the 3D S cript. 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 You should not place any command or variable definition used specifically for one Script in the Master Script; the Master Script should contain only things used by several other Scripts. The Master Script can save you Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
111
7. Basics of GDL Scripting – Part 2
time and space because you will only need to script commands you use in many scripts once (in the Master Script). We We will now use the Master Script to define variables we 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 or paste the followin following g code into into the Master Master Script: Script: IF Table_Type = "H98" THEN Top_Length = .95 Top_Width = 1.2 Top_Length2 = Top_Length - Top_Width/2 Insert_Length = .6 Leg_Origin_X = .63 ENDIF
3 Click the the “Help > ArchiCAD ArchiCAD GDL Refere Reference nce Guide” Guide” menu menu item to open the GDL Manual. Find the IF command on Page 216.
112
Here we are using the IF-THEN pair of commands. The general working method is as follows: follows: If
THEN ENDIF To use the command, 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”. “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 s hown above above will set five different variables to various “H98”. values when the value of the Table_Type parameter is “H98”. These are all values we use when the “H98” type Table is generated.
Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
7. Basics of GDL Scripting – Part 2
4 Go back to the the Floor Plan and activ activate ate (by double-cl double-clicki icking) ng) the “7.4 Master Script variables” saved view in the “Chapter 7” folder of the Navigator.
Using the two IF-THEN structures, we have set all the necessary variables for both types of the Table Table that are specific to the Table Type. Type. 6 Staying Staying in the Master Master Script, Script, copy-pa copy-paste ste the following following code code to the end of the Master Script code: Top_Length2 = Top_Length - Top_Width/2 Insert_Width = Top_Width Leg_Height = ZZYZX - Thickness_Top Thickness_Top Leg_Origin_Y = .295
Here you can find the dimensions for which the parameters shown above are used. These dimensions and variables will be needed when generating the tabletop and the table legs. As you can see, of the eight variables, four were defined defined in the IF-THEN structure. The other four will be defined later (with an explanation to follow). 5 Go back to to the Editor Editor Window Window,, open its its Master Master Script Script Window again, and copy-paste the following code after the end of the existing code: If Table_Type = "H99" THEN Top_Length = .825 Top_Width = 1.05 Insert_Length Insert_Length = .45 Leg_Origin_X = .555 ENDIF Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
113
7. Basics of GDL Scripting – Part 2
These four lines of code are not in an IF-THEN structure. The reason for this is that these two values are the same for both the H98 and the H99 types, so we did not include them in the two IF-THEN structures. Instead, we placed them at the end of the script so they are always executed no matter what the value of the Table_Type parameter. Hint: As you can see in the Master Script, the Top_Length2 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 t o define another variable. This ensures they have the correct, expected value when they are used. As you know, 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 of Top_Length2 would always be zero, because the values of those other t wo variables would be zero at that time.
7.4 CREATING THE 3D SCRIPT u e 07_04.mp4 Watch Movie
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 We will use the gs_top_mat default parameter to specify the material of the Tabletop. Tabletop. We’ll We’ll move the Local Origin up to the bottom of the Tabletop Tabletop with the ADDZ command. As you can see, we used t he Leg_Height variable as the parameter for the ADDZ command, and it will carry the correct value, since it was already set in the Mas ter Script (which is executed before the 3D Script). 3 Find the description description of the the PRISM_ PRISM_ command command on Page Page 34 of the GDL Reference Manual.
1 Click the the “3D Script Script Window” button to to open the 3D Script Script in a separa te Window.
2 Copy-paste Copy-paste the following following lines of code code into the the 3D Script Script Window: PEN Pen_Top MATERIAL gs_top_mat gs_top_mat ADDZ Leg_Height Leg_Height
114
4 Copy the code syntax syntax of the command command and and paste it below 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 Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
7. Basics of GDL Scripting – Part 2
the PRISM_ command is that: a), it can have holes in it, and b), any 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 sta tus code which defines defines the visibility of 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 PRISM_. given point and the next point of the PRISM_. 5 Go back to the Floor Floor Plan and (by (by double-click double-clicking) ing) activa activate te 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.
Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
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 PRISM_. 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 value of the top horizontal 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 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_. 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+0+4+8=13). 1: bottom horizontal edge visible 0: vertical edge invisible 4: top horizontal edge visible 8: side surface visible Thus, if this point is at the coordinate 0,0 in the PRISM_ definition, its line would be: 0, 0, 13, Each point will have a line like this in the PRISM_ command to PRISM_. define the whole PRISM_. 6 Modify the the PRISM_ PRISM_ command command in the 3D Script Script to the following: PRISM_ 6, Thickness_Top, 0, -Top_Width/2, 15, Top_Length2,-Top_Width/2 Top_Length2,-Top_Width/2, , 15+64, Top_Length2, 0, 915, 0,180, 4013, 0, Top_Width/2, 15, 0, -Top_Width/2, -1
115
7. Basics of GDL Scripting – Part 2
8 Go back to the Floor Floor Plan and activ activate ate (by double-cl double-clickin icking) g) the “7.6 Table Top Top piece” saved view in the “Chapter 7” folder of the Navigator.
7 Activate Activate the the “3D View” View” Window Window to see see the result. result.
This PRISM_ command will create the Tabletop for us. PRISM_, and the height As you can see, we defined six points points for the PRISM_, 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.
116
You can see the six points that need to be defined. You 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 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 (1+2+4+8). be 15 (1+2+4+8). Hint: Generally, all edges and the side sur face are visible, so the value of the status code is “15”. In case the the status code is different, 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 of each edge and the side surface. ArchiCAD will automatically add up the values to calculate the status code. Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
7. Basics of GDL Scripting – Part 2
You 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 Top_Length2,-Top_Width/2, , 15+64, The status code is now 15+64 now 15+64 instead of 15 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 point is set to be visible. 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 par t 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 Page 36 in the GDL Refere Reference nce Guide, Guide, and find find the two two shapes shown there.
Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
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. 3D. The next line - which defines the third point of the PRISM_ - has another new feature: Top_Length2, 0, 915, 915, not 15. 15. As you can see, the status code is 915, 10 Go to Page 145 in 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 geometr y, 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 las t 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 y-coordinates of the center, and the third value gives the status code. In this case the status code is 915. So you define the edges and really 900+15 really 900+15,, which results in 915.
117
7. Basics of GDL Scripting – Part 2
900, just as you added the value 64 side as usual, then add the value 900, in the previous line of code. The next step is to define the actual arc or cur ve. The next line of code does it: 0,180, 4013, 11 Go to Page 147 of the GDL GDL Reference Reference Manual Manual for a description of the Arc using center point and angle Status Code.
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 t he 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, Thickness_Top, 0, -Top_Width/2, 15, Top_Length2,-Top_Width/2, Top_Length2,-Top_Width/2, 15+64, Top_Length2, 0, 915, 0,180, 4013, 0, Top_Width/2, 15, 0, -Top_Width/2, -1
The 4000 status code draws a curved segment which is a true arc, 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. 1+0+4+8, (Notice that the value is now 4013 now 4013.. “13 “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 edg e is needed since they join smoothly.) smoothly.) The next two points offer nothing new. new. The last point’s status code is worth reviewing. reviewing. 0, -Top_Width/2, -1 The status code is -1. -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. -1.
12 Open the 3D View of the Editor Window again to see the result.
118
Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
7. Basics of GDL Scripting – Part 2
13 In the 3D View, View, use the Orbit feature to turn the shape around. See that the correct contour is always visible.
14 Modify the third line line of the PRISM_ PRISM_ command as follows (take out the “64” part): Top_Length2,-Top_Width/2 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 portion of the Tabletop. Tabletop. This is why we need the 64 status code. 16 Modify the third line of the PRISM_ PRISM_ command back to its original state (put the “64” part back in): Top_Length2,-Top_Width/2 Top_Length2,-Top_Width/2, , 15+64,
At this stage the Tabletop is made up of two parts (refer to View 7.3 Object Parameters ). These are mirrored images of each other. We can script both separately, or we can use so-called “sub-routines” to save programming effort. A sub-routine is a portion of GDL that contains code that needs to be executed more than once. In such a case it is advisable to put this Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
119
7. Basics of GDL Scripting – Part 2
code into a sub-routine and call this sub-routine several times to perform the same ta sk repeatedly. A subroutine has three parts: 1. A label 2. The actual code of the sub-routine 3. A RETURN command We We will make a sub-routine out of this PRISM_ command. 17 Modify your your code as follows: follows: 100: PRISM_ 6, Thickness_Top, Thickness_Top, 0, -Top_Width/2, 15, Top_Length2,-Top_Width/2, 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 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: “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. GOSUB. The command used for calling a sub-routine is called GOSUB.
120
Its syntax is the following (refer to Page 213 of the GDL Reference Guide): GOSUB label Example: 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 t he GOSUB command. 18 In the 3D Script Window, Window, place the following lines of code after the ADDZ line: GOSUB 100 END
100”. 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 str uctured such that sub-routines are usually placed at the e nd of the script and they are always preceded by an END command. Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
7. Basics of GDL Scripting – Part 2
19 Activate the 3D View. 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 100 MULX -1 GOSUB 100 DEL 1 END
Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
We 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 Syst em, 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 ti me. 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 t he middle. 22 Copy and paste the following code before the END statement in the 3D Script: IF Show_Insert THEN PRISM_ 5, Thickness_Top, Thickness_Top, Insert_Length/2, Insert_Length/2, -Insert_Width/2, -Insert_Width/2, 15, Insert_Length/2, Insert_Width/2, 15, -Insert_Length/2, -Insert_Length/2, Insert_Width/2, Insert_Width/2, 15, -Insert_Length/2, -Insert_Length/2, -Insert_Width/2, -Insert_Width/2, 15, Insert_Length/2, -Insert_Width/2, -1 ENDIF
121
7. Basics of GDL Scripting – Part 2
23 Select the Show_Insert parameter in the parameter list and set it to “ON” by clicking in the checkbox in its Value field.
24 Activate the 3D View Window to see the result.
Here we encounter another IF-THEN structure. ArchiCAD will check the value of the Show_Insert parameter. As you can see in the parameter list, the Show_Insert parameter is a Boolean type parameter. It can have two states: ON and OFF. Or, in other words: YES or NO. NO. Numerically, this translates to “1” for ON or YES, 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.
122
You You can now see that the Insert piece has been generated. However, it now occupies the same place a s 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.
Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
7. Basics of GDL Scripting – Part 2
25 Find the 100: label in the the 3D Script and insert the following code between the 100: label and the beginning of the PRISM_ command: ADDX Show_Insert Show_Insert * Insert_Length/2 Insert_Length/2
26 Insert the following line of code after the PRISM_ command and before the RETURN command: DEL 1
What we need to do first is to move the Tabletop piece piece along the x-axis. We We need to do it for both pieces, so we do it in the sub-routine. We We need to move move it by half the width of the Inset 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. Insert_Length/2. So, in case the Show_Insert parameter is OFF, OFF, the distance it needs to be moved is zero. If it is ON, the Insert_Length/2. So this one line of code provides distance is Insert_Length/2. our solution.
Since we moved the Local Coordinate System within the sub-routine, we need to undo the move. 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
7. Basics of GDL Scripting – Part 2
27 Check the result in the 3D View. View.
29 Insert the following code after the IF-THEN command command and before the END command in the 3D Script: DEL 1
The Insert piece is now correctly in the middle and the two top pieces do not overlap it. 28 Turn the Show_Insert checkbox ON and OFF and check the the results in the 3D View Window. Also, change the Table_Type Table_Type parameter and check all combinations of these two parameters in the 3D View Window.
This step will return the Local Coordinate System to the s ame position as the Global Coordinate System, just like before we start creating the legs of the table.
124
Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
7. Basics of GDL Scripting – Part 2
30 Save the changes made to the Object. This concludes this chapter. In the next chapter we will continue continue building our Table object, and learn even more about the programming environment and various commands.
Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
125
8. Basics of GDL Scripting – Part 3
8. B ASICS OF GDL SCRIPTING – P ART 3 In this chapter you will continue creating the table you started in Chapter 7. There will be some new concepts and commands for you to become familiar with. You will will once again work in the Library Part Editor Window. Window. This lesson demonstrates the following basic object-making techniques: • Structuri Structuring ng Scripts Scripts for for better better readabil readability ity • Using Using comm comment entss in in scrip scripts ts • Functions Functions of buttons buttons available available in Script Script Window Windowss • Using th the ADD command in the 3D Script • Using th the POLY2_B command in the 2D Script • Using Using status status codes codes in 2D Script Script comma commands nds • Using th the HOTSPOT2 command in the 2D Script • Using Using com comma mand ndss (e.g (e.g., ., PRISM_ command) and so-called Status Codes to control the visibility of individual surfaces and edges of Objects in 3D
8.1 O VERVIEW u e 08_01.mp4 Watch Movie
2 Open the “Extensio “Extension_T n_Table_ able_H98.g H98.gsm” sm” file using using the “File “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 Library Part Editor Editor Window Window,, open the 3D Script Script Window.
1 To start the eighth eighth lesson of this interacti interactive, ve, hands-on hands-on ArchiCAD GDL training guide, open the “AC Guide GDL Ch 08.pla” file. Select the “Read elements directly from archive” option.
126
Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
8. Basics of GDL Scripting – Part 3
The next thing we are going to talk about is commenting code for 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 r emember or understand what the code is doing even years after it was originally written. 4 In the first first line of the the 3d Script, Script, above above the PEN command, command, write the following code: !Setting Table top Pen and Material properties
When creating comments it is advisable to place them above the lines of code they refer to. Then, when one is tr ying 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 the following following lines lines of code code into the the 3D Script Script so the beginning of the script will look as follows: !Setting Table top Pen and Material properties PEN Pen_Top MATERIAL gs_top_mat gs_top_mat !Move vertically to bottom of Table top ADDZ Leg_Height Leg_Height !Call subroutine to generate right half of Table top GOSUB 100 !Mirror X axis and then !call subroutine to generate left half of Table top MULX -1 GOSUB 100 DEL 1
As you can see, the line starts with the exclamation mark (“! (“!”) character. This is the sign for comments in GDL Scripts. Whenever a line starts with the exclamation mark character, ArchiCAD will consider it a comment line. Comment lines are skipped by the program when executing the script. The comment we entered refers to the next two lines of code. Later, when you or someone else is reading the code, he/she will be able to quickly understand which portion of the 3D geometry those lines are related to.
Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
127
8. Basics of GDL Scripting – Part 3
Obviously, 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. heavily. Other users will not know as much about the code as you. In this ca se, commenting can help them understand how your code is structured. We 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 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 Script and using using your your mouse, mouse, select select the seven lines of code that comprise the PRISM_ command after the 100: subroutine label.
7 At the top of the the 3D Script Script Window Window you will will see five five buttons. 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 Activate the 3D View View Window. Window.
As you can now see, only the insert piece of the Tabletop Tabletop is generated in 3D, 3D, because we commented out the lines of code responsible for the generation of the cur ved Tabletop pieces. pieces.
128
Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
8. Basics of GDL Scripting – Part 3
Hint: When commenting, make sure to comment out ever y line belonging to the same command. Otherwise, ArchiCAD will try to execute the uncommented portions and will give you an er ror message because they are non-interpretable without the other lines of code belonging to the same command. 9 Uncomment Uncomment the first first line of of the seven seven lines of code code you you commented by removing the exclamation point character from the beginning.
11 Click on the “Stop” button to stop the execution execution of the 3D Script. Go back to the 3D Script Window and put an exclamation character back at the b eginning of the PRISM_ command.
12 Activate the 3D View Window. Window.
10 Activate the 3D View Window. 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. Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
Now that all lines of the command are either all commented or all uncommented, no error messages are sent by the program.
129
8. Basics of GDL Scripting – Part 3
13 Select all seven seven commented lines and click the uncomment uncomment button at the top of the 3D Script Window (second button from the left).
As you can see, the Comment and Uncomment 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 “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, Thickness_Top, Insert_Length/2, -Insert_Width/2, 15, Insert_Length/2, Insert_Length/2, Insert_Width/2, Insert_Width/2, 15, -Insert_Length/2, -Insert_Length/2, Insert_Width/2, Insert_Width/2, 15, -Insert_Length/2, -Insert_Length/2, -Insert_Width/2, -Insert_Width/2, 15, Insert_Length/2, -Insert_Width/2, -1 ENDIF
130
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.
Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
8. Basics of GDL Scripting – Part 3
15 Click on the “Remove “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 click the Indent button to restore the previous state.
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 into the 3D Script Script so it becomes fully commented: !Generate Insert piece of Table top !depending on the value of Show_Insert IF Show_Insert THEN PRISM_ 5, Thickness_Top, Thickness_Top, Insert_Length/2, Insert_Length/2, -Insert_Width/2, -Insert_Width/2, 15, Insert_Length/2, Insert_Length/2, Insert_Width/2, Insert_Width/2, 15, -Insert_Length/2, -Insert_Length/2, Insert_Width/2, Insert_Width/2, 15, -Insert_Length/2, -Insert_Length/2, -Insert_Width/2, -Insert_Width/2, 15, Insert_Length/2, -Insert_Width/2, -1 ENDIF !Undo the transformation at the beginning !before placing the Legs DEL 1 END !Generate the curved Table top half 100: !Move it in the X direction if the Insert piece !is set to be shown, so the Insert Inser t piece fits in the middle ADDX Show_Insert Show_Insert * Insert_Length/2 Insert_Length/2
The last button at the top of the Script Window is the “Check Script” button. When pressed, it will check the Script in its current state and report if it has found any problems.
Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
131
8. Basics of GDL Scripting – Part 3
!Generate the curved part PRISM_ 6, Thickness_Top, 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 line RETURN
8.2 CREATING THE LEGS u e 08_02.mp4 Watch Movie It is now time to create the scripts that will generate the legs for us. 1 Open up the the “AC “AC Guide GDL GDL Chapter Chapter 08” folder 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 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 we will create them the same way we generated the cur ved Tabletop pieces. pieces. We’ll create a sub-routine at the end of the 3D Script that will generate the geometry. We’ll We’ll manipulate the coordinate system with MUL X and MUL Y commands and call the sub-routine to generate the part.
132
Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
8. Basics of GDL Scripting – Part 3
You You can see the Local Origin of the Leg Profile in the ArchiCAD View. View. This is the point to which the the Local Coordinate Coordinate System must be moved before generating the Leg piece. 2 Activate Activate (by (by double-clicki double-clicking) ng) the “8.2 Leg Leg Origin Location” Location” saved view in the “Chapter 8” folder in the View Map of the Navigator.
3 Activate Activate (by (by double-clic double-clicking) king) the the “8.3 Leg Geomet Geometry-2” ry-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. We We have two variables 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. Leg_Origin_Y.
Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
133
8. Basics of GDL Scripting – Part 3
4 Go to the Editor Editor Window Window of the Table Table object object and open open the 3D Script Window.
5 At the end end of the 3D 3D Script, Script, write write (or paste paste from here) the the following lines of code: !Generate one Leg 200: 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
134
We We have created a sub-routine at label 200:. 200:. There is a comment before the label describing what the sub-routine does. We 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. 15+64, 915, All the status codes you see in this command ( 15+64, 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 command in the the 3D Script Script and enter or paste the following lines of code after it: !Set leg attributes PEN Pen_Leg MATERIAL gs_leg_mat gs_leg_mat
Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
8. Basics of GDL Scripting – Part 3
This is how we call the subroutine located at label label 200 to create a leg for the first time. 8 Activate Activate the 3D View View Window Window.
Here we set the attributes (view pen and material) for the legs we are about to generate. 7 After the the previous previous lines lines of code, enter enter the following following (this (this should also go after the END command in the code): !Create upper right leg GOSUB 200
Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
As you can see the Leg is generated, but not at the cor rect location. So we need to move the Local Coordinate System to the correct location. 9 Find the 200: label label toward the end of the 3D Script Script and place the following line of code below it, before the PRISM_ command: ADD Leg_Origin_X, Leg_Origin_X, Leg_Origin_Y, Leg_Origin_Y, 0
135
8. Basics of GDL Scripting – Part 3
10 Activate the the 3D View Window to see the result of the change.
This is a command that is similar to ones we used before ( ADDX, ADDX, ADDY, ADDY, ADDZ ). The benefit of the ADD command is that it does in one step that which is otherwise 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 s hifted along the x, y and z-axes, respectively. So, the following code: ADDX x ADDY y ADDZ z Can be substituted by this: ADD x, y, z In this case, the command shifts the Local Coordinate System to the location of the Leg piece (as seen in the “8.2 Leg Origin Location” saved View).
136
The upper right leg is now in place. However, 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 the line you just entered entered as follows: follows: ADD Show_Insert Show_Insert * Insert_Length/2 Insert_Length/2 + Leg_Origin_X, Leg_Origin_X, Leg_Origin_Y, Leg_Origin_Y, 0
Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
8. Basics of GDL Scripting – Part 3
13 Turn the Show_Insert parameter ON and OFF, OFF, and activate the 3D View each time to see how it affects the position of the Leg. After you are finished, turn the Show_Insert parameter back ON.
The Local Coordinate System for the the Leg is shifted in the x-direction by Leg_Origin_X 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.
Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
14 Place the following command before the RETURN command of the sub-routine: DEL 1
137
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 t he sub-routine. 15 Insert the following lines of code before the END command in the 3D Script: !Create upper left leg MULX -1 GOSUB 200 DEL 1
138
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 We then undo the coordinate transfor mation. 16 Activate the 3D View Window to see the result.
Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
8. Basics of GDL Scripting – Part 3
17 Insert the following lines of code before the END command in the 3D Script: !Create lower right leg MULY -1 GOSUB 200 DEL 1
18 Activate the 3D View Window to see the result.
The lower right leg is now generated. 19 Right-click into the 3D View View Window and select the “3D Projection Settings” item from the menu that appears.
Here we mirrored not along the x, but along the y-axis before calling the sub-routine.
Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
139
8. Basics of GDL Scripting – Part 3
20 Select the “Top “Top View projection” type from among the “Select Projection Type” buttons, and click the “OK” bu tton to accept the change.
We We now see the Table from the top. top.
21 Select the “View > 3D View View Mode > Wireframe” menu item.
The Table is now shown shown in Wireframe Mode in the3D View Window 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 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 Window and insert the following lines of code before the END command: !Create lower left leg MULX -1 MULY -1 GOSUB 200 DEL TOP
We We will now check to see whether the lower lower right leg is placed in the correct position.
140
Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
8. Basics of GDL Scripting – Part 3
24 Set the 3D View back to Dimetric Dimetric Axonometry and Hidden Line View.
For the lower left leg, we need to mirror along both the x and the y-axes for the Local Coordinate Axes to be in the right position. 23 Activate the 3D View Window to see the result.
The 3D view of our Table is now complete. complete.
8.3 CREATING THE 2D SCRIPT u e 08_03.mp4 Watch Movie Now we’ll start creating the 2D Script for the Table. 1 Open the 2D 2D Script Script in a separate separate Window Window by clicking clicking on its its button in the Editor Window. Window.
Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
141
8. Basics of GDL Scripting – Part 3
2 Insert the the following following lines into the the 2D Script: Script: PEN gs_cont_pen FILL gs_fill_type
We 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 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 Referenc Referencee Guide by clicking clicking on the the “Help > ArchiCAD GDL Reference Guide” menu item. 4 Find the description description of the the POLY2_B POLY2_B command command on on Page 120 120 of the Reference Guide. Select the command syntax and copy it to the Clipboard.
5 Paste Paste the command command syntax syntax at the the end of the the 2D Script. Script. POLY2_B n, frame_fill, fill_pen, fill_background_pen, x1, y1, s1, ..., xn, yn, sn
142
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 t o 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, s1, etc., triplets define the x and y-coordinates of the individual points of the fill polygon and their s tatus. 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, t he 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.
Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
8. Basics of GDL Scripting – Part 3
6 Go to the Floor Floor Plan, and activa activate te (by double-cli double-clicking cking)) the “8.4 2D Script variables” saved view in the “Chapter 8” folder in the View Map of the Navigator.
We We are going to use the same parameters and variables for the 2D of the Table that we used for its 3D. We 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 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 the Library Part Part Editor Window Window,, activate activate the the 2D Script and modify the POLY2_B command syntax as follows: POLY2_B 8, 7+64, gs_fill_pen, gs_fill_pen, gs_back_pen, 0, -Top_Width/2, 1, Insert_Length/2 Insert_Length/2 + Top_Length2,-Top_Width/2 Top_Length2,-Top_Width/2, , 1, Insert_Length/2 Insert_Length/2 + Top_Length2, 0, 901, 0,180, 4001, -Insert_Length/2 -Insert_Length/2 - Top_Length2, Top_Width/2, Top_Width/2, 1, -Insert_Length/2 -Insert_Length/2 - Top_Length2, 0, 901, 0,180, 4001, 0, -Top_Width/2, -1
Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
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 t o be closed, and iv) our Fill t o be a 64 ). Cover Fill ( 64 The Fill’s pattern will be drawn with the pen defined by 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 “1” value. Use “1 “1” if you want the edge going from t he 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 altog ether, you can use the status values to show or hide individual edges. Obviously, Obviously, the status values will work only if frame_fill 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.
143
8. Basics of GDL Scripting – Part 3
At the second point you can see that the x-coordinate is Insert_Length/2 + Top_Length2, Top_Length2, that is, half of the Insert piece is added when there is an Insert piece present. We We will now create the IF-THEN structure. 8 Place the the following following lines lines before before and after after the POLY2 POLY2_B _B command as follows: IF Show_Insert THEN POLY2_B 8, 7+64, 7+64, gs_fill_pen, gs_fill_pen, gs_back_pen, 0, -Top_Width/2, 1, Insert_Length/2 Insert_Length/2 + Top_Length2,-Top_Width/2, Top_Length2,-Top_Width/2, 1, Insert_Length/2 Insert_Length/2 + Top_Length2, 0, 901, 0,180, 4001, -Insert_Length/2 -Insert_Length/2 - Top_Length2, Top_Width/2, 15, -Insert_Length/2 -Insert_Length/2 - Top_Length2, 0, 901, 0,180, 4001, 0, -Top_Width/2, -1 ELSE
We 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 THEN ELSE ENDIF The 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 Show_Insert = 1 ), and another for when is an Insert piece ( Show_Insert there is no Insert piece.
ENDIF
144
Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
8. Basics of GDL Scripting – Part 3
9 Insert the the following following code code segment segment between between the the ELSE and and ENDIF lines: POLY2_B 8, 7+64, gs_fill_pen, gs_back_pen, 0, -Top_Width/2, 1, Top_Length2,-Top_Width/2, Top_Length2,-Top_Width/2, 1, Top_Length2, 0, 901, 0,180, 4001, -Top_Length2, -Top_Length2, Top_Width/2, Top_Width/2, 1, -Top_Length2, -Top_Length2, 0, 901, 0,180, 4001, 0, -Top_Width/2, -1
10 Select each of the POLY2_B commands and all the code code lines belonging to them and a nd 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.
The only difference between this and the other POLY2_B command is that the x-coordinates are not shifted by the Insert_Length/2 value in the appropriate places.
Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
145
8. Basics of GDL Scripting – Part 3
11 Activate the 2D Full View View Window and check the 2D of the Table. 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.
13 Find the code syntax for the HOTSPOT2 HOTSPOT2 command on Page Page 117 of the GDL Reference Guide. HOTSPOT2 x, y [, unID [, paramReference, paramReference, flags][, displayParam]] displayParam]]
As you can see, all parameters except for the first two are in parentheses, meaning they are optional. We will not deal with those. HOTSPOT2 x, y In its simplest form the HOTSPOT2 command is used to generate a Hotspot into the 2D of the Object. If there are no Hotspots generated for an Object in its Script, there are five default hotspots generated by ArchiCAD at the four corners of the enclosing rectangle of the Object’s 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 We will place Hotspots at several special points of the Table’s Table’s 2D, 2D, so we can select with these positions or later snap the Object with these positions.
We We will now place Hotspots on the 2D of the Table. Table.
146
Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
8. Basics of GDL Scripting – Part 3
14 Go back to the 2D Script of the Object and place the the following lines of code above the line containing the ELSE keyword: HOTSPOT2 Insert_Length/2 Insert_Length/2 + Top_Length2, 0 HOTSPOT2 Insert_Length/2 + Top_Length2, Top_Width/2 HOTSPOT2 Insert_Length/2 + Top_Length2, -Top_Width/2 HOTSPOT2 -Insert_Length/2 -Insert_Length/2 - Top_Length2, 0 HOTSPOT2 -Insert_Length/2 - Top_Length2, Top_Width/2 HOTSPOT2 -Insert_Length/2 - Top_Length2, -Top_Width/2 HOTSPOT2 Insert_Length/2 Insert_Length/2 + Top_Length, 0 HOTSPOT2 -Insert_Length/2 -Insert_Length/2 - Top_Length, 0
15 Check the 2D Full View Window Window for the result.
We 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 following lines of code before the ENDIF ENDIF command in the 2D Script. HOTSPOT2 Top_Length2, 0 HOTSPOT2 Top_Length2, Top_Width/2 HOTSPOT2 Top_Length2, -Top_Width/2 HOTSPOT2 -Top_Length2, 0 HOTSPOT2 -Top_Length2, Top_Width/2 HOTSPOT2 -Top_Length2, -Top_Width/2 -Top_Width/2 HOTSPOT2 Top_Length, 0 HOTSPOT2 -Top_Length, 0
Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
147
8. Basics of GDL Scripting – Part 3
Just as in the case of the Master Script, there are cer tain hotspots we want to define that are located at the same place regardless of the value of the Show_Insert parameter. We We place these after the whole IF-THEN structure to ensure they will always be executed. 18 Insert the following lines of code after the ENDIF command in the 2D Script. HOTSPOT2 0, 0 HOTSPOT2 0, Top_Width/2 HOTSPOT2 0, -Top_Width/2
17 Switch off the Show_Insert parameter and check the 2D Full View Window for the result.
With this we create three additional hotspots at the middle, the top middle and the bottom middle of the Table.
148
Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
8. Basics of GDL Scripting – Part 3
19 Activate the 2D Full View Window to see the result.
8.4 TESTING THE COMPLETED OBJECT 1 Go back to the Floor Plan Plan Window Window of your your Project. Project. 2 Activate Activate the the Object Tool Tool and go into its Settings Settings Dialog Dialog.. The “Extension_Table_H98.gsm” “Extension_Table_H98.gsm” Object will be shown.
With this step we are finished with the geometry. As an additional additional optional step, you you can take your 2D Script, and based on what you learned about the 3D Script, place comments in it. You You can use the “Indent” and “Remove Indent” features and by placing empty lines you can organize the look of the 2D Script for better readability. 20 Save the completed Object.
Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
149
8. Basics of GDL Scripting – Part 3
3 In the Paramet Parameters ers panel, modify modify the the various various parameters parameters related to the object’s Type, Insert Piece and 2D Representation and see how its 2D View is updated.
4 Switch Switch the Previe Preview w Window Window to show show a shaded 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 Training Guide.
150
Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
9. Advanced GDL Scripting
9. A DVANCED DVANCED GDL SCRIPTING This chapter presents some more concepts and and commands for you to get familiar with. You You will again work in the Library Part Editor Window. Window. This lesson demonstrates the following object-making techniques: • Controllin Controllingg the the possible possible range of values values • Hiding Hiding parameters parameters in the the parameter parameter list using using the HIDEPARAMETER command • Crea Creati ting ng Doo Doors rs in in GDL GDL • Using the WALLHOLE command to cut non-rectangular holes in walls • Usin Usingg Mac Macro ross in in GDL GDL • Using th the RECT2 command in the 2D Script • Creating Creating scale-depende scale-dependent nt 2D for objects objects
2 Open up the the “AC “AC Guide GDL GDL Chapter Chapter 09” folder folder in the the View View Map of the Navigator pa lette and activate (by double-clicking) the “9.1 Door Side View” saved view in the “Chapter 9” folder.
9.1 O VERVIEW u e 09_01.mp4 Watch Movie 1 To start the ninth lesson lesson of the the ArchiCAD ArchiCAD GDL traini training ng guide, open the “AC Guide GDL Ch 09.pla” file. Select the “Read elements directly from archive” option.
Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
Here you can see the Door we are going to create. The Door is pentagon-shaped. The two 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 bottom of the Door for ventilation purposes. The Door will have a Handle on both sides. 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. Window.
151
9. Advanced GDL Scripting
ARAMETERS 9.2 CREATING THE P ARAMETERS u e 09_02.mp4 Watch Movie
3 Select Select “General “General GDL Object > Model Element Element > Opening Opening > Wall Opening > Door (Wall)” in the hierarchy hierarchy, and click the “Select” button.
1 Choose the “File “File > Libraries Libraries and and Objects Objects > New Object… Object…” ” menu command. 2 Click the the “Select “Select Subtype… Subtype…” ” button in in the Library Library Part Editor Window to bring up the Subtype Hierarchy Dialog.
The default parameter list of the Object has changed to that of a Door.
152
Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
9. Advanced GDL Scripting
We 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 “File > Save Save as…” command command to to save the file. 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 the Floor Plan and activ activate ate (by double-cl double-clicki icking) ng) the “9.2 Door Variables” saved view in the “Chapter 9” f older of the View Map of the Navigator.
Here you can see the variables and measurements we are g oing to use for the Door Frame. Here is the list of parameters and variables and what they will be used for: Parameter/Variable name A B gs_frame_width Side_Height Side_Height_In side Frame_Y
Purpose
Width of Door Height of Door Frame thickness of Door Height of vertical portion of frame on sides Height of vertical portion of inside of frame on sides Vertical component component of frame width
The first three items are parameters.
Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
153
9. Advanced GDL Scripting
The last three are variables the values of which we will create 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 Activate (by double-clic double-clicking) king) the “9.3 Glass Glass Variable Variables” s” 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. Parameter/Variable Purpose name Panel_Border Width of panel around Glass Panel_Border_Y Vertical component component of Panel_Border Glass_Y Horizontal/Vertical Horizontal/Vertical dimension of half the Glass measured from center of Glass Glass_Center_Y Vertical position of center of Glass
Panel_Border is a parameter that we will be able to set to any desired value. The other three variables will be calculated from the other dimensions of the Door. 7 Go back to the Library Part Part Editor Editor Window Window.. We We are now going to create the parameters necessar y for our Door. The following parameters are to be created: Variable Variable _Glass Panel_Border
Type Name Title Glass Leng Length th Bord Border er of pan panel el arou around nd Glass Glass_Thk Length Glass Thickness Pen Glass Pen Glass_Pen Glass_Mat Material Glass Material Handle_Style Integer Handle Style Handle_Mat Material Handle Material Handle_Acc_Mat Mater Materia iall Hand Handle le Acces Accesso sory ry Mater Materia iall
154
Value
100 10 6 24 0 44 40
Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training 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.
Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
The “Glass_Thk” parameter defines the thickness 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 t wo kinds of material used in Handles: the “Handle_Mat” and “Handle_Acc_Mat” parameters specify the materials for these.
155
9. Advanced GDL Scripting
8 One by one, one, drag all the the parameters parameters in the list so they they will will be positioned above the “ac_details” title parameter, while retaining their positions relative to one an other.
The Door cut out a hole from the Wall Wall in 2D but since there is no 2D Script written for the Door yet, nothing is displayed. The reason we placed the Door Door into a Wall Wall is because we will need need to know the thickness of the Wall later while previewing our Door in the Library Part Editor Window. Window. We will use a variable there that ret urns 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 P ARAMETER SCRIPT u e 09_03.mp4 Watch Movie 1 Go back to the Library Library Part Editor Editor Window Window and and click click on the the “Parameter Script Window” button to open the Parameter Script in a separate Window.
9 Save the Door object using the the “File “File > Save” Save” menu menu command. 10 Go back to the Floor Plan and activate activate (by double-clicking) the “9.4 Door Placement” saved view in the “Chapter 9” folder of the V iew Map of the Navigator.
11 Select the Door Tool. Tool. Make sure the “Pentagonal Door.gsm” Door.gsm” object is selected in the Info Box. Place the Door into the Wall in the middle of the Floor Plan screen.
156
2 Type or or copy-paste copy-paste the followin following g lines into into the Paramet Parameter er Script: VALUES "Handle_Style" "Handle_Style" 1, 2, 3, 4, 5, 6, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 0
We We are already familiar with with the VALUES command of GDL. We will create the possible values for the Handle_Style parameter. You will study why values “0 “0” through “15 “15”” are available later in this chapter. When the value of Handle_Style of Handle_Style is “0 “0” it means that there is no handle for the Door.
Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
9. Advanced GDL Scripting
3 Type or or copy-paste copy-paste the the following following lines into into the Paramet Parameter er Script: VALUES "gs_frame_thk", "gs_frame_thk", RANGE RANGE (, WALL_THICKNESS] 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 t hickness 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 Wall into which it was placed. 4 Click the “Help “Help > ArchiCAD ArchiCAD GDL Referen Reference ce Guide” Guide” menu menu item.
5 Find the VALUES VALUES command command on Page Page 183 of the the Guide. Guide. Copy the RANGE command syntax from the PDF file and paste it at the bottom of the Parameter Script: RANGE left_delimiter left_delimiter [expression1], [expression1], [expression2] right_delimiter [STEP step_start_value, step_value]
Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
The STEP keyword is an additional option, which we are not going to use now, now, so we only need the following part of the syntax: RANGE left_delimiter left_delimiter [expression1], [expression1], [expression2] right_delimiter A 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 g iven, 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, t he latter means less than. Examples: 5] means that the value of the parameter must be 5 or less 5) means that the value of the parameter must be less than 5
157
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 <= x The RANGE expression can take the place of the list of values in the VALUES command. Going back to the original expression written in the Paramater S cript: VALUES "gs_frame_thk", "gs_frame_thk", RANGE RANGE (, WALL_THICKNESS] WALL_THICKNESS] The command means that: gs_frame_thk <= WALL_THICKNESS WALL_THICKNESS This is so because there is no value, parameter, variable or numerical expression between the left delimiter and the comma. The variable WALL_THICKNESS is between the comma and the right delimiter “] “]”, so gs_frame_thk must be less than or equal WALL_THICKNESS. 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 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.
158
For example, there are Global Variables that provide data a bout Walls. Walls. Door and Window objects can inquire and make use of t his data about their enclosing Walls. The WALL_THICKNESS variable always returns the thickness of the Wall Wall into which the Door/Window 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 t he Wall into which it is placed. You can find find the list of Global Variables on Page Page 223 of the ArchiCAD GDL Reference Guide. Guide.
6 Delete the RANGE RANGE command command syntax syntax from the Paramete Parameterr Script.
Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
9. Advanced GDL Scripting
7 Type or copy-paste the following following lines into the Parameter Parameter Script: Script: VALUES "gs_leaf_thk", "gs_leaf_thk", RANGE RANGE (, gs_frame_thk] 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 the parameter parameter list and and select select the gs_frame_t gs_frame_thk hk parameter. Click on the right-pointing arrow in its Value Value column.
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 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 Select the “gs_leaf “gs_leaf_thk” _thk” paramet parameter. er. Click on on the right-pointing arrow in its Value column.
As you can see, the following are the possible values: <= 100 This is so because the current value of “gs_frame_thk” is 100. 10 Select the “gs_frame_thk” parameter and modify its value to “80”, then again select the “gs_leaf_thk” parameter and click on the right-pointing arrow in its Value column.
You You can see the following for possible values: <= 300 The reason we placed the Door into a Wall Wall is because we used the thickness of the enclosing Wall to limit the value of the gs_frame_thk parameter.
Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
159
9. Advanced GDL Scripting
You can see the following following for possible values: <= 80 As 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.
HIDEPARAMETER. 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 t he display of parameters. Organizing parameters into groups with the Title and Subordinate features is one way of saving space. We covered that ea rlier. Another method is to simply hide those 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 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 the “File > Save” menu menu command. 14 Go back to the Floor Plan and click on the Door to select it. it. Go to its Settings Dialog.
12 Go to the Parameter Parameter Script and type type or copy-paste the following code at its end: IF Handle_Style = 0 THEN HIDEPARAMETER "Handle_Mat", "Handle_Acc_Mat" "Handle_Acc_Mat" ENDIF
160
Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
9. Advanced GDL Scripting
As you can see in the Parameters panel, the value of the “Handle 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 value of the “Handle Style” parameter from its its value list to any other value.
Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
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 We are now finished with the Parameter Script. 16 Leave the Door Settings Dialog Dialog by clicking the Cancel button.
161
9. Advanced GDL Scripting
9.4 CREATING THE 3D SCRIPT u e 09_04.mp4 Watch Movie 1 Go back to the Library Part Part Editor, Editor, and and click click on the the 3D Script View Window to open it in a separate window.
2 Type or or copy-paste copy-paste the followin following g lines into into the 3D Script: Script: !Setting used variable values Frame_Y = SQR(2) * gs_frame_width gs_frame_width Side_Height = B - A/2 Side_Height_Inside Side_Height_Inside = B - Frame_Y - (A/2 gs_frame_width)
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 to the Library Library Part Editor Editor,, and type or copy-paste copy-paste the following lines into the 3D Script: Panel_Border_Y Panel_Border_Y = SQR(2) * Panel_Border Glass_Y = A/2 - gs_frame_width - Panel_Border Glass_Center_Y Glass_Center_Y = B - Frame_Y - Panel_Border_Y Glass_Y
Here we start defining the variables we need for the creation of the Door Frame. You can refer to t he “9.2 Door Variables” saved view to see what dimensions these variables refer to. 3 Go to the Floor Plan Plan and activate activate the the “9.3 Glass Glass Variabl Variables” es” saved view in the “Chapter 9” folder of the View Map of the Navigator. With this we are defining the values of the variables needed for the Glass. Now we can start creat ing the Door.
162
Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
9. Advanced GDL Scripting
5 Go to Page Page 261 in the ArchiC ArchiCAD AD GDL Reference Reference Guide, and and check the illustration there.
7 Type or copy-p copy-paste aste the followin following g lines into into the 3D Script: Script: PRISM_ 11, gs_frame_thk, A/2 - gs_fra gs_frame_wi me_width, dth, 0, 15, 15, A/2, 0, 15, 15, A/2, Side_Hei Side_Height, ght, 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, gs_frame_width, Side_Height_Inside, 15, 0, B - Frame_Y, 15, A/2 - gs_fra gs_frame_wi me_width, dth, Side_Hei Side_Height_ ght_Insid Inside, e, 15, 15, A/2 - gs_fra gs_frame_wi me_width, dth, 0, -1 -1
The illustration shows how you need to create your Doors/Windows in GDL. The main point is that you need to write your GDL as if the Door/Window was placed into a Wall 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, way, what you see as a Top View of a Door/Window 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 or copy-paste copy-paste the followi following ng lines into into the 3D Script: Script: !Setting Frame attributes and generating frame PEN gs_frame_pen MATERIAL gs_frame_mat gs_frame_mat
Here we set the PEN and MATERIAL attributes for the Door Frame. Notice that we are using default para meters derived from the subtype. Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
This will generate the Door Frame for us. You You can refer to the “9.2 Door Variables” saved View to check the coordinates of each point of the PRISM_. PRISM_. Hint: Note that we used the default parameters gs_frame_thk gs_frame_width, plus we used the variables and gs_frame_width, Side_Height, 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
163
9. Advanced GDL Scripting
should always be created this way because the hole ArchiCAD cuts for the Door/Window is also generated this way. way. 8 Activate Activate the the 3D View View Window Window to see see the result. result.
9 Type or or copy-paste copy-paste the followin following g lines into into the 3D Script: Script: !Setting Panel attributes and generating panel PEN gs_leaf_pen MATERIAL gs_leaf_mat gs_leaf_mat
We 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.
164
10 Type or copy-paste the following lines into the 3D Script: PRISM_ 16, gs_leaf_thk, A/2 - gs_fra gs_frame_ me_widt width, h, 0, 0, 15, 15, A/2 - gs_fra gs_frame_ me_widt width, h, Side_ Side_Hei Height_ ght_Insi Inside, de, 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_fra gs_frame_ me_widt width, h, 0, 0, -1, -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 You may notice notice that the first six defined defined points are the same as for the Door Frame, which is understandable since they must be located at Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
9. Advanced GDL Scripting
the same points. The sixth point has the status code “-1 “-1”, ”, meaning that the polygon is closed: any new points will start defining a hole hole into the body. The next five points points are the points of the panel around the Glass. We 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 saved View to check check the coordinates of these points of the PRISM_. PRISM_. The status code of the last point of the hole’s definition is again a “-1”, -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 Window to see the result. Orbit around it to see the holes in the Door Panel.
12 Type or copy-paste the following lines into the 3D Script: !Setting Glass attributes and generating Glass PEN Glass_Pen MATERIAL Glass_Mat 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 gs_leaf_thk/2 - Glass_Thk/2 Glass_Thk/2 PRISM_ 5, Glass_Thk, Glass_Y, Glass_Center_Y, 15, 0, Glass_Center_Y + Glass_Y, 15, -Glass_Y, Glass_Center_Y, 15, 0, Glass_Center_Y - Glass_Y, 15, Glass_Y, Glass_Center_Y, -1 DEL 1 We We now are ready with both both the Frame and and the Panel. Panel. We We still need to generate the Glass.
Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
165
9. Advanced GDL Scripting
If the glass is too transparent for you to see the Glass very well in OpenGL, you can set the “Transparency in Shading” field of the 3D Window Settings Dialog to OFF. OFF. 15 Save the Door object using the the “File > Save” menu menu command. 16 Go back to the Floor Plan. Select the Door in the Wall and right-click (Windows) / CTRL-click (Mac) to bring up the context menu. In the context menu, select the “Show Selection > Marquee” in 3D command.
The ADDZ command moves the Local Coordinate System along the z-axis so that the Glass will be generated in its proper position. The PRISM_ command generates the Glass body. 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 the 3D View Window to see the result. As you can see, a rectangular-shaped hole is cut for for the Door into the Wall. Wall. We need to modify modify this with scripting. 17 Go back to the Library Part Editor and type or copy-paste 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, gs_frame_width, 0, 7, A/2, 0, 7, A/2, Side_Height, Side_Height, 7, 0, B, 7, -A/2, Side_Height, 7, -A/2, 0, -1
166
Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
9. Advanced GDL Scripting
Here we have a new GDL command. The WALLHOLE command is used to cut a non-rectangular hole into the Wall. For rectangular Walls, 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 “A” and its height is “B “B”. It is cut symmetrically along the y-axis of the Door/Window. 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. Door/Window. 18 Find the WALLHOLE command syntax on Page 255 255 of the ArchiCAD GDL Reference Guide. WALLHOLE n, status, x1, y1, mask1, ... xn, yn, maskn [, x, y, z]
Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
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 att ributes of the cut edges and surfaces. If it is “1 “1”, the PENS and MATERIALS defined for the enclosing Wall will be used. If it is “2 “ 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 “1”, “2 “2”, “4 “4” and “64 “64”” values (the three edges plus the method used for drawing contours – as we discussed in Chapter 7). The last three values are optional optional and define a vector. 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 Librar y 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 the “File > Save” menu menu command.
167
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.
ArchiCAD has many macros within its Library. We We are now going to use the Macro Object from the ArchiCAD Library that is used to create Door Handles. The name of the Macr o Object is da_handletyp.gsm. 1 Open the the object object “da_handlety “da_handletyp.gsm p.gsm” ” using the “File “File > Libraries and Objects > Open Object” command. The file is located in the same folder as the “AC Guide GDL Ch 09.pla” file.
You can see now now that a hole with a correct shape is cut into the Wall for the Door.
9.5 CREATING THE MACRO CALL u e 09_05.mp4 Watch Movie 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 g enerate the Door Panel. This is like calling a sub-routine, with the difference that in this case the sub-routine is a completely separate Object file. Another advantage of Macros is the fact that in case you need to modify them, you need to modify the Macro Object only once: all calling Library Parts can then reap its benefits.
168
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 a bout its geometry, materials, shadow casting, etc.
Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
9. Advanced GDL Scripting
2 Select Select the “gs_handle “gs_handle_typ_ _typ_m” m” parameter parameter and click 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 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.
Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
3 Activate Activate the 3D View View Window Window to see the 3D model model of the 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 We will use three parameters of the Macro in the Door Object. We We will transfer the values values of these parameters 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 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 the “Pentagonal_Do “Pentagonal_Door. or.gsm” gsm” object object and activate activate its 3D Script. Type or copy-paste the fo llowing code into it: !Put Local Coordinate System in correct place for Handle ADD -A/2 + gs_frame_width gs_frame_width + .05, .9, gs_leaf_thk gs_leaf_thk
169
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 or copy-paste copy-paste the followin following g code into into the 3D Script: Script: !Call macro to generate Handles on both sides FOR t=1 TO 2 CALL "da_handletyp" "da_handletyp" PARAMETERS gs_handle_typ_m = Handle_Style, gs_handle_mat gs_handle_mat = Handle_Mat, gs_handle_ac_mat gs_handle_ac_mat = Handle_Acc_Mat Handle_Acc_Mat MULZ -1 ADDZ gs_leaf_thk NEXT t DEL 5
We 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 happens with the CALL command. Let us look at this in detail. 6 Go to Page 222 222 of the ArchiCA ArchiCAD D GDL Reference Reference Guide Guide file 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
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 command macro_name_string this is the name of the Macro Object. It must not have a file extension, and should be put between quotation marks. (Example: “da_handletyp” ) PARAMETERS this is the keyword that shows that a list of parameters within the macro object follows; values will be assigned to these parameters name1 = value1 this is the name of a parameter within the Macro Object and the numeric expression which assigns a value to it. If 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" "da_handletyp" PARAMETERS gs_handle_typ_m = Handle_Style, Handle_Style, gs_handle_mat = Handle_Mat, gs_handle_ac_mat gs_handle_ac_mat = Handle_Acc_Mat Handle_Acc_Mat da_handletype. It will will call the Macro Object called da_handletype. It will set values for three parameters within the Macro Object. The gs_handle_typ_m parameter of the Macro Object will take the value of the Handle_Style parameter of the calling Library Part ( Pentagonal_Door.gsm in this case). The gs_handle_mat parameter of the Macro Object will take the value of the Handle_Mat parameter of the Pentagonal_Door.gsm Library Part. The gs_handle_ac_mat parameter of the Macro Object will take the value of the Handle_Acc_Mat parameter of the Pentagonal_Door.gsm Library Part. After the Macro Object’s 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 sure that the the “Handle_St “Handle_Style” yle” paramete parameterr of the Door 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 Activate the 3D View View Window Window to see see the result. result.
If you Orbit around the Door in 3D you can see that it has Door Handles on both sides. 9 Save the Object Object with the “File “File > Save” Save” menu menu command. command. With this step we finished creating the 3D for the Object.
Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
171
9. Advanced GDL Scripting
9.6 CREATING THE 2D SCRIPT AC Guide GDL Ch 09_06.mp4 Watch Movie 1 Open Open the 2D 2D Script Script of the the Door Door object object..
2 Type or or copy-paste copy-paste the followin following g code into into the 3D Script: Script: IF GLOB_SCALE > 50 THEN ELSE ENDIF
We We will create two different versions of the 2D of the Door 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 Sca le. 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 F loor Plan Window and create different 2Ds based on the given value.
172
3 Type or or copy-paste copy-paste the followin following g code into into the 3D Script, Script, replacing the previously placed commands: Inside_Frame_Half = A/2 - gs_frame_width IF GLOB_SCALE > 50 THEN RECT2 Inside_Frame_Half, Inside_Frame_Half, 0, A/2, -gs_frame_thk RECT2 -Inside_Frame_Half, 0, -A/2, -gs_frame_thk LINE2 Inside_Frame_Half, 0, Inside_Frame_Half, 2 * Inside_Frame_Half ARC2 Inside_Frame_Half, Inside_Frame_Half, 0, 0, A - 2 * gs_frame_width, 90, 180 HOTSPOT2 Inside_Frame_Half, A - 2 * gs_frame_width ELSE RECT2 Inside_Frame_Half, 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 Inside_Frame_Half – gs_leaf_thk, 2 * Inside_Frame_Half gs_leaf_thk ARC2 Inside_Frame_H Inside_Frame_Half alf - gs_leaf_thk, gs_leaf_thk, 0, 2 * Inside_Frame_Half Inside_Frame_Half - gs_leaf_thk, 90, 180 HOTSPOT2 Inside_Frame_Half, A - 2 * gs_frame_width gs_frame_width – gs_leaf_thk ENDIF
Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
9. Advanced GDL Scripting
4 Click the the “2D Full Full View” View” button button to see the the 2D of the the Door. Door.
Inside_Frame_Half,, 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 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. 2D. The first two parameters define the x and y-coordinates of one of its corners, and the next t wo 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-deg ree 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.
The Door is displayed at a scale of 1:100. The Door Panel is symbolized by a Line. 5 At the lower lower left left corner of the the 2D Full View View Window Window, click the 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
9. Advanced GDL Scripting
6 Set the scale back back to 1:100, 1:100, and return to the 2D Script. Script. As you can see, it is relatively easy to create objects whose displays respond to scale changes. 7 Type or or copy-paste copy-paste the followin following g code into into the 2D Script, Script, after the ENDIF command: HOTSPOT2 A/2, 0 HOTSPOT2 A/2, -gs_frame_thk HOTSPOT2 -A/2, 0 HOTSPOT2 -A/2, -gs_frame_thk
9 Go back to to the Floor Plan Plan and make make sure the “9.4 “9.4 Door Placement” saved View is activated. Select the Door placed in the Wall.
You 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 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 Wall edges in 2D. 10 Modify various settings settings of the Door in its its Settings Dialog and the Info Box and check its 2D and 3D to make sure everything is correctly scripted. With these hotspot definitions we create four hotspots at the four corners of the Door Frame so we will be able to select the Door using these points. We 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 Door Object Object using using “File “File > Save” Save”..
This concludes this Chapter.
174
Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
10. Advanced GDL Scripting – continued
10. A DVANCED DVANCED GDL SCRIPTING – CONTINUED This chapter of the Interactive Training Training Guide will take it lightly and introduce some of the fun parts of GDL. You You will again work in the Library Part Editor Window. Window. This lesson demonstrates the following object making techniques: • Creating Creating objects objects that modify modify their shape shape in animations animations • Using a Global Global variabl variablee in GDL to inquire inquire about about the current current frame frame of the animation • Using th the CUTPLANE – CUTEND command pair for cutting the 3D Model
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 the “AC “AC Guide GDL GDL Chapter Chapter 10_1” 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.
P ART 1 – OPENING DOOR 10.1 Overview u e 10_1_01.mp4 Watch Movie 1 To start the tenth lesson lesson of the the ArchiCAD ArchiCAD GDL trainin training g 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 f older and click the “OK” button to execute it.
Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
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 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 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 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:
175
10. Advanced GDL Scripting – continued
• ArchiCAD ArchiCAD GDL GDL provides provides a Global Global variabl variable. e. By using using it one one can find the exact frame number of a r unning animation in any Script. • Based on such such a variable variable we we change the the 3D opening opening angle angle of the Door Library Part. • We’ll set ArchiCAD ArchiCAD to rebuild rebuild each each frame during during animatio animation n so the modified geometry will be displayed in different frames. 3 You can see the the Path of the the animation animation in the Floor Floor Plan. Select the Door the Path will go through.
10.2 Creating the parameters u e 10_1_02.mp4 Watch Movie We 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 the parameter parameter named named “gs_open “gs_open_3D” _3D” in in the list list of parameters.
4 Use the “File “File > Librari Libraries es and Objects Objects > Open Object” Object” menu menu command to open the Door for editing.
This parameter defines the opening angle of of the Door Panel Panel in 3D. 3D. It can range from 0 degrees (completely closed) to 180 degrees (completely open to the side).
176
Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
10. Advanced GDL Scripting – continued
2 Create three new new parameters parameters in the the parameter parameter list list based based on the following table: Variable Variable Door_Open Beg_Frame
End_Frame
Type Name Boolean Boolean Door Door opens opens in anima animatio tion n Integ Integer er Begi Beginn nnin ingg fram framee of Door Door opening Inte Integer ger Endi Ending ng fram framee of of Doo Doorr opening
Value
0 0
Further parameters can be added to make the animation more sophisticated. For example, there could be two additional parameters defining the starting opening angle a nd the ending opening angle of the Door leafs. For the sake of simplicity we will not include these at this time. 3 Switch Switch on the bold toggle toggle of of the “Door_Open” “Door_Open” parameter parameter.. Also, switch on the subordinate toggles of the other two parameters.
The “Door_Open “Door_Open”” parameter will control whether the animation feature is turned ON or OFF. OFF. It must be tur ned ON for any animation of the Door to occur. “Beg_Frame” Beg_Frame” specifies the number of the Frame of the animation at which the Door begins to open from its 0 degree closed st ate. “End_Frame” “End_Frame” specifies the number of the Frame of the animation at which the Door reaches its final opened stat e. We We will open the Door leaf to only 90 degrees in this example.
Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
177
10. Advanced GDL Scripting – continued
4 Move all three three parameters parameters above above the “Paramete “Parameters rs for Listing” parameter such that their position relative to one another remains the same.
6 Type or or copy-paste copy-paste the followin following g lines of code code at the top of the Parameter Script: IF NOT(Door_Open) THEN HIDEPARAMETER HIDEPARAMETER "Beg_Frame", "End_Frame" ENDIF
5 Open Open the Param Paramete eterr Script Script..
This familiar code piece will hide the two latter parameters when the first one is not enabled, as in that case they are not relevant and so should not be shown.
178
Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
10. Advanced GDL Scripting – continued
10.3 Creating the 3D Script u e 10_1_03.mp4 Watch Movie 1 Open Open the 3D 3D Script Script for for editi editing ng..
The first line makes sure that the operations are executed only when the Door_Open parameter is tur ned ON. In the next line we can see the GDL Global variable we use in this example: GLOB_FRAME_NR 3 Open the “ArchiC “ArchiCAD AD GDL Referenc Referencee Guide” PDF PDF file from from the Help menu.
2 Type or or copy-paste copy-paste the the following following lines of code code at the top top of the Parameter Script: IF Door_Open THEN IF GLOB_FRAME_NR < Beg_Frame THEN gs_open_3D = 0 ELSE gs_open_3D = (GLOB_FRAME_NR (GLOB_FRAME_NR - Beg_Frame) * (90 / (End_Frame - Beg_Frame)) ENDIF ENDIF
Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
179
10. Advanced GDL Scripting – continued
4 Find the descrip description tion of the GLOB_FR GLOB_FRAME_N AME_NR R variable variable on Page 228 of the GDL Reference Guide.
At any given frame the product of (GLOB_FRAME_NR of (GLOB_FRAME_NR Beg_Frame) and (90 / (End_Frame - Beg_Frame)) will give the opening angle of the Door. Door. 5 Save the changes changes to the the Door and and return to the Floor Plan. Plan.
10.4 Creating the animation 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, deg rees, 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. Beg_Frame. We We want the value of gs_open_3D 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 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 t he Door).
180
u e 10_1_04.mp4 Watch Movie 1 Open Open the Camera Camera Setti Settings ngs Palet Palette. te.
Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
10. Advanced GDL Scripting – continued
2 Click the the “Path” “Path” button to view view the animation animation Path Path settings. settings.
We We need to know exactly which frame we 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: Camera Number Camera 1 Camera 2 Camera 3 Camera 4 Camera 5 Camera 6
3 Close the the Path Path Options Options Dialog, Dialog, then then close the the Camera Camera Settings Palette.
4 Select Select the entrance entrance Door and go go to its Settings Settings Dialog Dialog..
Located at Frame Number 1 21 41 61 81 1 01
If you look at the Path in the Fl oor Plan, you will see that C amera 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. pavilion. The Door needs to open between Frames 61 and 81.
Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
181
10. Advanced GDL Scripting – continued
5 Switch Switch the “Door “Door opens in animation” animation” paramete parameterr “ON” in in the parameter list of the Door.
182
6 Click on on the right-poi right-pointing nting arrow arrow that appears appears to the left of the parameter, and specify “61” and “81” as values for the Beginning and Ending frames of the animations, respectively.
Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
10. Advanced GDL Scripting – continued
Now the Door will begin to open at Frame 61, just as we ar rive 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 accept the the changes. changes. Set the the 3D Engine Engine to Open GL 3D Engine with the “View > 3D View Mode > Open GL 3D Engine” command.
10 Also make sure you check the “Rebuild Model for Each Frame” checkbox in the lower left cor ner of the Dialog. This step is cr ucial. When the program enters the 3D Window, 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, object, and generate a different model for the Door with each passing Frame.
8 Select Select the “Docume “Document nt > Creative Creative Imaging Imaging > Create Create Fly-Through” menu command. 9 Select Select “QuickTime “QuickTime Movie Movie File” File” (or another another format of your your choice) in the Result field. Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
183
10. Advanced GDL Scripting – continued
11 Click the “Save” “Save” button. In the Dialog that appears specify a name for the video file to be generated and click the “Save” button for the generation to begin.
You can see the current Frame being generated on the Title bar as the animation is generated. Watch Frame 61, where the Door leaf will start to open. This concludes the first Project created in this chapter.
184
Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
10. Advanced GDL Scripting – continued
P ART 2 – CONSTRUCTION SIMULATION In the second part we will again use the “object animation” capabilities that can be built in GDL. We We will take a portion of a city in Google Earth, create a Model of a building and create a “constr uction simulation” animation in which the building will be built from the g round up in its planned environment with 3D buildings around it.
10.5 Bringing in data from Google Earth u e 10_2_01.mp4 Watch Movie We 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 We will not not do these steps ourselves, ourselves, but will will talk you you through how we we went about them under steps a-f below a-f below.. At this point you should be able to envision the steps that were taken to achieve this. 1 Findi Finding ng the the loc locat atio ion n a We searched searched for “Miami, “Miami, FL” FL” in Google Google Earth. The applicatio application n took us to an aerial view of downtown Miami. We 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. View.
Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
b Usin Usingg the the File > Save > Save Image command, we saved the image of the location to a file named Miami.jpg.
c Usin sing the File > External Content > Place External Drawing… menu command in ArchiCAD, we placed the imag e on the Floor Plan.
185
10. Advanced GDL Scripting – continued
e Going back back to ArchiCAD ArchiCAD,, we drew a line over over the placed placed image image of the downtown area between the same two points on the map image. We zoomed in as close as was sensible to make it as accurate as possible.
d We needed to scale the Drawing Drawing correctly correctly,, therefore therefore we went back back Tools > Ruler menu command to to Google Earth, and used the Tools draw a line from one corner of one building to another corner of another building. We We read off the exact length of this line in centimeters. It measured 23755.9 centimeters (237559 millimeters or 237.559 meters).
186
f We selected selected both the the line and the the placed placed Drawing Drawing of the image, image, and using the Resize command, we resized them both g raphically. raphically. The graphical resize operation’s operation’s origin was one 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 “AC Guide GDL GDL Ch 10_2.pla” 10_2.pla” file. file. Select Select the “Read “Read elements directly from archive” option. In the Dialog that appears select the default location for the f older and click the “OK” button to execute.
Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
10. Advanced GDL Scripting – continued
4 Activate Activate (by (by double-clicki double-clicking) ng) the “10.2 “10.2 Modeled Modeled Building Mass” saved view in the “Cha pter 10” folder.
3 Open up the the “AC “AC Guide GDL Chapter Chapter 10_2” 10_2” folder 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.
At this stage of the Project you can see that the the Building was was modeled using Slabs and Double-Slanted Walls. Walls. We We already prepared the 3D Window for the animation for you. To To do this we took the following steps: a We went back back to Google Google Earth and and switched switched on the Layer Layer called called 3D Buildings. The application at this point displayed all 3D-modeled building available for Miami.
Here you can see the result of steps a-f above. a-f above. Note the blue Line that was drawn and check to make make sure its length is indeed 237559 millimeters. Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
187
10. Advanced GDL Scripting – continued
b We moved 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 Usin sing the File > Save > Save Image command we saved the image of the location to a file named Miami_background.jpg. e We then then wen wentt to the the View > 3D View Mode > 3D Window Settings Dialog, and chose Internal 3D Engine for the 3D Engine. (We (We want to use the 3D Window as the source of the animation.) Also, in the Background field, we chose the As In PhotoRendering radio button. d We wen wentt to to the 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. Window.
188
Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
10. Advanced GDL Scripting – continued
g In the the 3D Wind Window ow we we entere entered d 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 Activate (by (by double-clicki double-clicking) ng) the “10.3 “10.3 Perspectiv Perspectivee of Building Mass” saved view in the “Chapter 10” folder.
f In the 3D Projection Setting Dialog we switched to Perspective View and tried to find a Camera position in the Dialog that would be close to where the Camera was located in Google Earth. After doing this we activated the 3D Window.
Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
You You can see the result in this saved 3D Perspective View. View. h It is a good idea to to save the the Camera position position,, and not only 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 Wi ndow.. i Since we we want want to create create an animation, animation, we we needed needed at least least two 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 Camera Settings Settings Palett Palette, e, and click click the “Path” “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.
189
10. Advanced GDL Scripting – continued
10.6 Creating the Object from the Mass u e 10_2_02.mp4 Watch Movie Now we will start to create our Object. For this purpose we first need to save the 3D mass in GDL. 1 Activate Activate (by (by double-clic double-clicking) king) the the “10.5 Mass Mass Top Top View” saved view in the “Chapter 10” f older.
7 Activate Activate (by double-cl double-clickin icking) g) the “10.4 Camera Camera positions” positions” saved view in the “Chapter 10” f older.
The 3D mass of the building is shown in Top Top View in the 3D Window. Window. We We will save it from here. 2 Select Select the “File “File > Librarie Librariess and Objects Objects > Save Save 3D Model Model as…“ menu command. 3 In the File File Dialog Dialog Box that that appears appears specify specify a name and location for the new Object file. In our case we’ll save it under the name “SkyScraper_Block.gsm”.
Here you can see the two Cameras placed on the Floor Plan at a very high zoom level.
190
Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
10. Advanced GDL Scripting – continued
We We chose the non-editable option because we do not want to modify modify the object. This way our 3D script will be short and clean. 5 Select Select the “Object” “Object” tool tool and enter enter its Dialog Dialog. The “Skyscraper_Block.gsm” Object is selected. Specify “0” for the Object vertical position. Also, select its lower left selection hotspot then click “OK” to leave the Dialog.
4 In the next next Dialog Dialog that that appears appears specify specify the 3D 3D Model to to be saved as an Object. Check the “Remove redundant lines from symbol” checkbox. In the 3D description format field, choose the “Non-editable binary 3D data” radio button.
Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
191
10. Advanced GDL Scripting – continued
6 Activate Activate (by double-c double-clicki licking) ng) the “10.6 “10.6 Object Placemen Placement” t” saved view in the “Chapter 10” f older.
Click the lower left corner of the Sla bs and Walls mass to place the Object.
192
7 Activate Activate (by (by double-clicki double-clicking) ng) the “10.7 “10.7 Placed Object Object 3D” saved view in the “Chapter 10” f older.
The Object we saved from the 3D model has now been replaced with the Slabs and Walls mass in the 3D Window.
Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
10. Advanced GDL Scripting – continued
10.7 Creating the parameters u e 10_2_03.mp4 Watch Movie 1 Select Select the Object Object and select select the “File “File > Libraries Libraries and Objects Objects > Open Object…” menu command to open the Object for editing. 2 Create three new new parameters parameters in the the parameter parameter list list based based on the following table: Variable Variable Time_Build Beg_Frame End_Frame
Type Boolea Boolean n Intege tegerr Integer
Name Built Built durin duringg animat animation ion Beginning Fram rame of of Building Ending Frame of Building
Value
The “Time_Build” “Time_Build” parameter will control whether the animation feature is tur ned ON or OFF. OFF. It must be t urned ON for any animation of the Building to occur. The “Beg_Frame” “Beg_Frame” specifies the number of the Frame of the animation at which the Building starts to be built from the gr ound up. The “End_Frame” “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 Switch on the bold toggle toggle of of the “Time_Bui “Time_Build” ld” parameter parameter.. Also switch on the subordinate toggles of the other two parameters.
0 0
We We could also create a Parameter Parameter Script that would would hide the two two latter parameters when the first parameter is turned OFF. This was the case for the Object in the first part of this Chapter. We will skip this step now, because we do not have too many parameters.
Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
193
10. Advanced GDL Scripting – continued
10.8 Creating the 3D Script u e 10_2_04.mp4 Watch Movie 1 Open Open the 3D 3D Script Script for for editi editing ng..
2 Type or or copy-paste copy-paste the followin following g code into into the beginning beginning of the 3D Script: IF Time_Build THEN IF GLOB_FRAME_NR >= Beg_Frame THEN ADDZ (GLOB_FRAME_NR (GLOB_FRAME_NR - Beg_Frame) Beg_Frame) * (270 / (End_Frame - Beg_Frame)) CUTPLANE DEL 1 ENDIF ENDIF
194
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 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 by (End_Frame Beg_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. Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training 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 of (GLOB_FRAME_NR – Beg_Frame) and (90 / (End_Frame – Beg_Frame)) will give the position of the Cut Plane. 3 On Page 100 100 of the ArchiCAD ArchiCAD 10 GDL GDL Reference Reference Guide 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 commands> CUTEND This can be considered similar 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.
Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
We 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 t he 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. 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 (GLOB_FRAME_NR - Beg_Frame) Beg_Frame) * (270 (270 / (End_Frame - Beg_Frame)) CUTPLANE DEL 1 As you can see, an ADDZ command precedes the CUTPLANE command, and a DEL 1 command follows it. The ADDZ command is needed to elevate the Cut Plane to its desired position, but a DEL 1 command is also needed to move the Local Coordinate Syste m origin to where it was before the CUTPLANE command commenced. This is needed because the commands generating the 3D model follow, 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 copy-paste the following following code code at the very end of of the 3D Script: IF Time_Build THEN IF GLOB_FRAME_NR >= Beg_Frame THEN CUTEND ENDIF ENDIF
195
10. Advanced GDL Scripting – continued
We We are now finished with the modification of of the Object. We are now ready to do the steps necessary to create the animation.
10.9 Creating the animation AC Guide GDL Ch 10_2_05.mp4 Watch Movie 1 Go to the 3D Window Window,, and select select the Object. Object. Go to its its Settings Dialog.
As you can see, this is a CUTEND command (as mentioned above), but it is in the same double IF-THEN structure as the CUTPLANE command. This is because the CUTPLANE and CUTEND commands come in pairs. If one is executed in the 3D Script and the other is not, ArchiCAD will give an error message. Therefore, the CUTEND command must always be executed under the same conditions a s 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 the changes changes you have have made to the Object. Object. Close Close the Library Part Editing Window.
196
2 Turn the “Built “Built during during animation” animation” paramete parameterr “ON”. For For the “Beginning Frame of Building” parameter, “0” will be fine. For the “Ending Frame of Building” p arameter, set a value of “95”. Close the Dialog with the “OK” button.
Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
10. Advanced GDL Scripting – continued
4 Check the the “Rebuild “Rebuild Model Model for Each Frame” Frame” checkbo checkbox x in the lower left corner of the Dialog.
3 Select Select the “Docume “Document nt > Creative Creative Imaging Imaging > Create 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.
5 Click the the “Save” “Save” button. button. In the Dialog Dialog that that appears specify specify a name for the video file to be generated and click the “Save” button for the generation to begin.
In the “Result” field, select “QuickTime Movie File” (or another format of your choice). This concludes the second Project created in this chapter. Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide
197
10. Advanced GDL Scripting – continued
198
Graphisoft® ArchiCAD® Creating GDL Objects – Interactive Training Guide