Introduction to Object Making GDL for Beginners Written by David Nicholson-Cole
Graphisoft Visit the Graphisoft website at http://www.graphisoft.com for local distributor and product availability information.
Introduction to Object Making Š 2004. Originally written 2000, rewritten 2004 by David Nicholson-Cole. All rights reserved. Reproduction, paraphrasing or translation without express prior written permission of Graphisoft is strictly prohibited. Cover credits: Marks Barfield Architects, creators of the British Airways London Eye, http://www.marksbarfield.com. GDL model by David Nicholson-Cole. Published by GRAPHISOFT R&D Rt. 2004 edition. The version of GDL described in this manual is compatible with ArchiCAD 8.1, ArchiCAD 9 and ArchiFM 2000.
Trademarks ArchiCAD and ArchiFM are registered trademarks and PlotMaker, Virtual Building, StairMaker and GDL are trademarks of Graphisoft. IFC and IAI are trademarks of the International Alliance for Interoperability. Artlantis and PhotoCAD are trademarks of Abvent. Piranesi is a trademark of Informatix. ArchiFacade is a trademark of Cigraph. Lara Croft is a trademark of Core Design. Lightworks is the trademark of Lightwork Design. All other trademarks are the property of their respective holders.
About this Book Introduction to Object Making is designed to help you get more enjoyment and productivity from ArchiCAD: it takes you beyond the confines of the standard ArchiCAD Tool palette into the realm of object making. We hope that this little primer will open up new worlds for each user. Part I, Object Making Without GDL, shows you how to make objects using existing tools, without having to touch any GDL script. Part II, Beginners’ Guide to GDL Scripting, eases you into the possibilities of GDL scripting. We hope you will find the transition enjoyable, but please note that you don’t have to read the whole book to get useful information: even if you never get to the GDL script, the initial object-making tips will greatly enhance your confidence and productivity with ArchiCAD. Some of the examples used in the book will be available from the support website or from the installer CD.
about object making from other sources, including the reference manuals, for which all the authoring team should be thanked. It takes object making a lot further than the original volume. The author would like to thank his editing team at Graphisoft - Anett Csaki, Tibor Szolnaki and Akos Pfemeter - for their regular emails of advice and support. He would also like to thank Karl Ottenstein of Sandpoint, Idaho for his critiques and technical proofreading during the writing.
Printing Note We have provided this as a .PDF file, but we have designed it with chapters starting on odd numbered pages. This is to enable you to print out your own copy and run it off on a double sided photocopier if you wish to save paper.
About the Author David Nicholson-Cole is an architect and teaches at Nottingham University in the UK. He has been an enthusiastic evangelist for GDL and a prodigious producer of GDL objects since discovering the power (and the pleasure) of GDL. He made his mark in the GDL world as the author of the series of GDL training books, the GDL Cookbook. David founded the ‘ArchiCAD University’ series of user conferences, and is a founder member of the GDL Alliance. The GDL Cookbook 4 logically follows after the book you are now reading. It is an A-Z of GDL technique, and is usable in its own right as a GDL manual. David has also travelled around the Globe at the invitation of ArchiCAD dealers and their customers, teaching GDL.
Acknowledgements Introduction to Object Making with ArchiCAD: GDL for Beginners was developed in concept by Graphisoft as a means of filling the gap between the GDL Cookbook and the existing reference manuals. The first edition was in 2000 for ArchiCAD 6.5 and 7.0. This edition has been completely rewritten during 2004 to include ArchiCAD 8 and ArchiCAD 9 thinking and techniques. It contains easy to follow exercises in object making, and pulls together wisdom
3
IIntroduction to Object Making
4
IIntroduction to Object Making
CONTENTS PART ONE: OBJECT MAKING WITHOUT GDL______________ 9 Chapter 1: Introduction to Object Making . . . . . . . . . . . . . . . . . . . . . . .9 1.1 About Object Making . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .9 Library Parts in ArchiCAD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .10 Sources of Library Parts. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .13 Add-ons that make Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .14 1.2 Making your own Library Parts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .14 Without GDL – using ArchiCAD’s Tools . . . . . . . . . . . . . . . . . . . . . . . . . . . .14 Making Objects with GDL Scripts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .15 How do you make an Object? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .16 Does it need to LOOK right, or BE right? . . . . . . . . . . . . . . . . . . . . . . . . . . . . .16 The idea of an ‘Investment Object’ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .16 Can you learn GDL?. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .17 The ArchiCAD experience . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .17 Read about Object Making . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .18 Chapter 2: Object Making without GDL 1 . . . . . . . . . . . . . . . . . . . . . . 19 2.1 Making Objects without GDL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .19 Getting started with Object Making . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .19 2.2 Let’s make something in 2D . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .20 2.3 Bring a file in from DXF/DWG. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .20 2.4 Let’s make a 3D Object – a Table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .21 2.5 Let’s Make a 3D Window with slabs . . . . . . . . . . . . . . . . . . . . . . . . . . . . .22 2.6 Let’s make a Chair using Wall tool. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .24 2.7 Let’s make a Roof Truss with Fills . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .25 Summary of Object Making in this chapter . . . . . . . . . . . . . . . . . . . . . . . . . . . . .27 Chapter 3: Object Making without GDL 2 . . . . . . . . . . . . . . . . . . . . . .28 3.1 Using Basic Shapes from the Library . . . . . . . . . . . . . . . . . . . . . . . . . . . .28 Make a ‘Banana’ Truss or Mullion object. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .28 3.2 Let’s make an Object by Cutting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .29 3.3 Urban Modelling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .32 Urban modelling – entire buildings as objects . . . . . . . . . . . . . . . . . . . . . . . . . . . .32 Urban modelling – entire sites can be objects . . . . . . . . . . . . . . . . . . . . . . . . . . . .33 Urban modelling – the Camera is the mightiest weapon! . . . . . . . . . . . . . . . . . . . .33 3.4 Making Objects with Add-ons and Solid Geometry . . . . . . . . . . . . . . . .33 Profiler – for extrusions and lathing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .34 3.5 Make a Flywheel with Profiler! . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .35 3.6 Convert Mesh to Roof . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .37 Other free Add-ons within ArchiCAD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .37 3.7 Carving Walls with the Roof tool . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .38 Solid Element Operations (SEO) to the rescue! . . . . . . . . . . . . . . . . . . . . . . . . . .39 Notes on the naming of parts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .40 Why bother to make objects? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .40 Are you using the Student version? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .41 Summary of Object Making in this chapter . . . . . . . . . . . . . . . . . . . . . . . . . . . . .41 Introduction to Object Making
PART TWO: BEGINNERS' GUIDE TO GDL SCRIPTING _____ 42 Chapter 4: Starting with GDL. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42 4.1 Starting with GDL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .42 The Scripts and Buttons in the Parameter Table. . . . . . . . . . . . . . . . . . . . . . . . . .42 3D Entities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .44 First steps in 3D GDL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .44 3D View. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .44 Check Script . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .45 3D Space and the 3D Cursor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .45 Do not forget the 2D script . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .46 Summary of GDL, to this point. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .46 4.2 Let’s build a 3D Object – a Chair . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .47 4.3 Let’s make this chair parametric. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .48 4.4 First steps in 2D scripting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .50 Selecting Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .52 Subtypes – you can put this into a category. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .52 Summary of GDL, in this chapter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .52 Chapter 5: Providing Options in GDL . . . . . . . . . . . . . . . . . . . . . . . . . 54 5.1 Providing Options in GDL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .54 5.2 Boolean parameters – easy options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .54 5.3 Popdown Menus: allow many choices. . . . . . . . . . . . . . . . . . . . . . . . . . . .56 5.4 The MultiObject concept . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .58 Summary of GDL in this chapter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .61 Chapter 6: The Power of PRISM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62 6.1 The Power of PRISM. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .62 PRISM is the most versatile element in 3D GDL . . . . . . . . . . . . . . . . . . . . . . . .62 ‘Instant GDL’ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .63 Writing Prisms from new. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .64 About Prism syntax.... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .64 6.2 Apply Prisms to the chair seatframe . . . . . . . . . . . . . . . . . . . . . . . . . . . . .66 6.3 Learn about Circle Geometry and make the chair more comfortable. . .68 Summary of GDL in this section . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .70 Chapter 7: Looking into Autoscripted GDL . . . . . . . . . . . . . . . . . . . . 71 7.1 Looking into Autoscripted GDL. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .71 Examine the 3D script of the autoscripted table . . . . . . . . . . . . . . . . . . . . . . . . . .71 The table can be tuned up – to be parametric . . . . . . . . . . . . . . . . . . . . . . . . . . . .74 Cautionary note for modifying objects. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .79 7.2 Come back to ‘Instant GDL’ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .79 Try instant GDL with a REVOLVE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .80 Modifying objects made with Add-ons . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .82 Summary of GDL in this section . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .82 Chapter 8: Build on the power of GDL . . . . . . . . . . . . . . . . . . . . . . . . 83 8.1 Subroutines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .83 Golden Rules for Subroutines. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .84
5
Contents
8.2 Macros . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85 Subroutines versus Macros . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85 Complex example of Macros . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86 8.3 Textures – the big secret revealed . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87 You could do Texture mapping with a Macro . . . . . . . . . . . . . . . . . . . . . . . . . . . 89 More things to note on textures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89 Summary of GDL in this section. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90 Chapter 9: Billboard Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91 9.1 Billboard Objects – use picturereality! . . . . . . . . . . . . . . . . . . . . . . . . . . . 91 9.2 Make your own Billboards as accurate Cutouts . . . . . . . . . . . . . . . . . . . . 92 9.3 Make your own Billboards using the Alpha Channel with PICTURE . . 95 9.4 Rectangular ‘cutout’ – the combination object . . . . . . . . . . . . . . . . . . . . 97 9.5 The Billboard idea in 2D? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98 9.6 Billboard creation – the photograph . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99 Summary of Billboarding in this section . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100 Chapter 10: GDL Windows and Doors . . . . . . . . . . . . . . . . . . . . . . . . 101 10.1 GDL Windows and Doors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101 The Rules of Windows and Doors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101 10.2 Revisit the Window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102 10.3 You can make Skylights too . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105 10.4 Try a very complex window! . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107 Note for future versions of ArchiCAD. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110
6
Objects can be better than Windows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110 Summary of GDL covered in this chapter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110 Chapter 11: GDL Roundup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112 11.1 GDL Roundup. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112 The programming language of GDL. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112 11.2 Loops – FOR... NEXT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113 The FOR... NEXT Loop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113 Loop by counting numbers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113 Loop by Distance – and optimise it! . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114 Smart way to recalculate spacing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114 Loop by Angle. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115 Other ways of Looping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116 11.3 Graphical Hotspots . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117 Let’s write some Graphical Hotspots . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118 11.4 Solid Geometry Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118 Solid Geometry on the chair. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119 11.5 Defining Text in 2D. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120 11.6 Other possibilities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121 11.7 Advice for Newcomers to GDL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121 11.8 Summary of ArchiCAD 9 changes . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122 Index ___________________________________________________ 123
Introduction to Object Making
PART ONE: OBJECT MAKING WITHOUT GDL CHAPTER 1: INTRODUCTION TO OBJECT MAKING An introduction to the possibilities of object making in ArchiCAD, with or without GDL. Architecture is... “the conscious, correct, and magnificent interplay of volumes assembled under light”. -- Le Corbusier
1.1 About Object Making The real 3D world can be thought of as a vast assembly of objects made visible in light. ArchiCAD’s 3D environment can be thought of as a large theatrical stage where you assemble the cast (the elements and objects), the set (the plan) and the screenplay (the design idea). You bring the objects together, illuminate them, and then – let the play begin! Most of the objects in the ArchiCAD assembly area are building elements – walls, slabs, roofs, columns, meshes, etc. – brought together to form buildings. These elements are easily made with the tools given to you in ArchiCAD. Whenever you need to go beyond walls and floors, you can use special objects such as furniture, windows and doors, lamps and components. In ArchiCAD manuals, these are also referred to extensively as Library Parts. These can be found in your library or made specially. So, why should we bother to make objects? Well, we can make: • Structural elements that are right for their purpose. • Details of building construction that look authentic. • Furniture that is smart, functional and elegant. • Components that conform to catalog numbers and manufacturers’ specifications. • Lamps that can transform the environment of a model. • Windows, Doors that cut holes in walls, open or swivel, offer a choice of styles for frames, ironwork and leaves or sashes. • Skylights and Dormers that cut holes in roofs like windows cut holes in walls. • Label tools or blocks of custom text. • Stairs in which you can vary landings, risers and handrails. Introduction to Object Making
• Picture objects that can be placed in a model to look like people, trees, or even whole buildings. • 2D drawing objects and tools that can enhance your productivity and drawing accuracy. In short, the pleasure and productivity of the ArchiCAD user can be greatly enhanced with objects. This book is intended to ease the ArchiCAD user safely into making objects. It is not entirely self contained; it needs to be read with the GDL Reference Manual, the Help Menu and the main ArchiCAD Reference Guide. Dip into these frequently. If you wish to take object making further, your next stages after this primer are to take a more informed look at the manual and GDL Help menu, and to work with the GDL Cookbook, all of which take you progressively into more advanced GDL.
9
PART ONE: OBJECT MAKING WITHOUT GDL
If you have tried making objects in ArchiCAD without GDL (we will call these ‘Autoscripted’ objects), you are used to getting an object whose only possibility for variation is stretchiness. You are not offered a choice of materials, you have to get these right before saving the object. This introduction to object making will encourage you to build objects yourself, but more significantly it will encourage you to try to make them capable of offering variations – thus they could be partially parametric.
Libraries must be loaded Whatever you make, however you make it, ArchiCAD must be able to find the object. Every time you open ArchiCAD, it reads through the library directories (folders) and makes an index of what it finds.
The Eureka Tower in Melbourne, Australia, by Fender Katsalidis: Object Technology is not just for pretty renderings – it is central to the task of construction documentation.
Library Parts in ArchiCAD When you build an ArchiCAD project, you can use the primary modelling tools – walls, slabs, columns, roofs, etc. The ArchiCAD Tools palette also offers access to library parts: furniture objects, lamps, windows, doors, skylights etc. In the Tools palette or the Tools menu or Extras menu, you may also find add-ons such as ArchiTerra, StairMaker, Profiler or RoofMaker. To place an object in the project you can use different actions, such as click and stretch, click and click again to indicate direction, or you may encounter an entire dialog box containing instructions and many data fields In your use of ArchiCAD, you will have noticed that most library parts offer many chances for variation (called parameters) such as the number of mullions in a window or glazing styles in a door. They may also offer different ways (in materials, pens and fills) of representing themselves in the 3D view and in 2D.
10
The existing ArchiCAD Library is a folder in your installed ArchiCAD directory. ArchiCAD’s own library will be loaded (by default) but when you are running a project, or experimenting with GDL, you should make additional folders of your objects. Make sure you do not make objects or folders with the same names as ones that already exist in the libraries. When you are working with ArchiCAD, make sure that the folder you are saving your objects to is one of your loaded libraries.
Introduction to Object Making
PART ONE: OBJECT MAKING WITHOUT GDL
demolition of the built environment. Documentation is vital at every stage and buildings have to be managed by teams of people who require access to shared information databases. Objects in the environment can be classified by Subtype – for example they will be Seating, Windows, Roof structure, Storage or other similar categories. If your ArchiCAD model uses internationally sourced GDL components, how does it know the difference between objects called ‘sedia’, ‘janela’, ‘fenster’, ‘Tür’, ‘tepe_penceresi’, ‘iskemle’, ‘parathiro’? Is a ‘lanterna’ a lamp or a skylight? ArchiCAD knows!
You can either make a new library folder that relates to current projects, or your objects can be stored in a personal library in the ArchiCAD folder. The main point is that you should know where they are, and ensure that you have loaded them. Subfolders to keep furniture objects, building components, window objects, textures etc., should be logically named and organized.
What’s new since the last object making book? There are many small changes in the GDL since the year 2000, but let’s look at the four most notable changes that affect the object maker. Subtypes: All object names now end with a .GSM, and they carry a unique internal ID number which enables ArchiCAD to know if they are windows, doors, lamps etc. International conferences have agreed on a way of classifying objects in the virtual world called Industry Foundation Classes (IFCs). Graphisoft play a leading part in this movement. A 3D model is in reality a vast database, of which the 3D form is a visible manifestation, and the design process is just one stage in the life of the building. The IFC concept considers the lifecycle stages of conception, design, management and even Introduction to Object Making
All objects now have an internal identity code GUID (Globally Unique IDentifier) which includes the subtype classification, and enables the APIs inside ArchiCAD to perform correctly whatever the object’s name – so a skylight will cut a hole in a roof but not a wall; a lamp will have brightness and colour controls but cannot cut holes in a roof. The GUID is very powerful – more so than the object’s name. As a risky experiment, I changed the name of an object in a library, reloaded libraries and checked the plan. The object was still in the
11
PART ONE: OBJECT MAKING WITHOUT GDL
correct place, with its new name, and looked the same in 3D view – because the GUID was unchanged (don’t do this at home!). You can see a quick sample of the IFC categories in GDL by going to File>GDL Objects>Open Object by Subtype – click open the cascading groups and you will get a comprehensive listing of the possibilities – even animals, cars and railings are included. Graphical Hotspots (GHs): GDL objects can now have custom hotspots in any part of the model for editing its configuration. Previous versions of GDL only permitted stretching of an imaginary cuboid around the object. Now an object of some complexity can be manipulated by the user – in a piece of storage furniture, you can pull or push the drawers, swing open or shut the doors, change the spacing of shelves or dividers – it is easy to do using hotspots in the 3D or the 2D or both, and the hotspot coding is not difficult. For the GDL writer, GHs are very rewarding to write and get working.
This structural steel tube can be stretched and twisted and rotated – in 3D space and in 2D using graphical hotspots. Solid Geometry Commands (SGC): We can achieve a far more authentic 3D appearance and improved line drawing of objects by adding or subtracting solids. Where intersecting tubes would look acceptable in 3D render but wrong in wireframe, we can now add them and get cleancut junctions. We can now subtract 3D outlines out of a 3D solid surface (for example spherical indents into a slab) to create shapes that could not be built with ‘positive’ construction commands. These are similar to the Solid Element Operations in ArchiCAD.
12
This carved wood arch is now easy with SGC. Open GL: This is a new engine for fast 3D visualisation, originally devised by Silicon Graphics. It is much faster than ArchiCAD’s 3D engine, using accelerated routines on dedicated hardware – the graphics card of your computer, Mac or PC. Open GL includes routines for hidden line, shading, texture mapping, texture filtering, anti-aliasing, lighting, geometry transformations, etc. This affects you because previously, textures were relatively unconsidered. Now it looks blatantly horrid if you are lazy with textures and all your woodgrain goes the wrong way. It can also cope with models of more polygons allowing a higher level of detail, more curviness. Open GL drawings can be preferred to renderings as they include pen lines, as in most of the illustrations in this book. Rendering: ArchiCAD 9 introduces the major advance in rendering technology, Lightworks. It is one of the most popular rendering engines available on the market. Currently more then 80 applications are licensing this technology and a total of 1 million end users are using it. The Lightworks rendering engine is now built into the ArchiCAD rendering interface. Lightworks gives you the ability to create high quality photorealistic images within ArchiCAD. Lightworks offers ray-tracing, soft shadow and reflection features and complex shader editing capabilities, and works with ArchiCAD’s own elements. Find more details in the ArchiCAD 9 documentation, and see the website: http://www.lightworks.com/.
Future developments with ArchiCAD Whichever version you are using by the time you read this, you can be sure that it will be easy to find your way around. Every new release has been safely incremental, so that users have been able to adapt Introduction to Object Making
PART ONE: OBJECT MAKING WITHOUT GDL
Sources of Library Parts
Internet, you will find an increasing number of websites devoted to ArchiCAD objects and add-ons such as GDL Central (www. gdlcentral.com) and Objects On Line (www.objectsonline. com). Try some of these in Google: Studio Arkada, Arkiklub, ArchiRadar, GDL Alliance, Cigraph. The Graphisoft website gives you an up-to-date list of addresses of such sites. From GDL Central, you can discover the addresses of manufacturers using GDL for products. You will find that, with the free GDL object web browser plug-in, GDL objects can be viewed in a browser, changed parametrically, and rendered, almost as if you were examining them from within ArchiCAD – and then perhaps, downloaded to the user.
The ArchiCAD Library
DXF and DWG Libraries
It is worth going through the ArchiCAD Library included with your package before you start creating library parts on your own. Investigate what already exists. This will give you an idea of what you can use and do not need to make; and the examples in there will give you ideas of what is possible. You will be able to see how parameters change and this will make you think about what qualities you might like to include in objects that you make – such as useful 3D options, clear organization and description of parameters, stretchiness with hotspots, nice textures, 3D authenticity and intelligible 2D symbols, pop down menus and even a user interface.
Most building component manufacturers offer disks of DXF/DWG files, although most of these are 2D only. It is always worth getting these, as DXF/DWG files can be used in ArchiCAD, and you will be able to make use of them in GDL. 2D DXF and DWG files can be brought straight into the Project plan. Where you see the opportunity to make library parts out of DWG or DXF originals, you may be able to take advantage of the parametric power available to you in GDL. For 3D, you can also make objects with other applications from 3rd parties – Zoom, Sketchup, Rhino, Design Workshop, AutoCAD, 3DS – save them as a DXF/DWG, then bring them into ArchiCAD as a library part. The DXF/DWG Conversion Guide included in your ArchiCAD package explains this procedure in more detail. Sites like 3D Cafe (www.3dcafe. com) are full of third party objects – although these will be mostly DXF/DWG models requiring import into ArchiCAD via GDL. However good they may look, they will not be parametric. You can also work in the other direction. If you take the time to learn GDL, you have the advantage over other CAD users in that you can make a 2D or 3D library part in GDL that is parametrically variable, and you can save the resulting varied forms as separate DXF/DWGs. Parts you create in GDL will wholly or partially work in AutoCAD or ADT using the GDL Adaptor.
readily to new capabilities. The fundamental modelling tools (Walls, Slabs, Roofs) have changed for the better, but are still familar with each new release. We have an extra armoury of tools like the Column, Beam and Mesh, the continuous Line tool – and in recent times, we have the technology of ‘Add-ons’ – custom tools which make modelling even easier. GDL itself, the internal code of ArchiCAD, has also changed over the versions, but never so differently that an experienced user couldn’t immediately make use of it, and later adapt to the new features as they became evident.
GDL is very widely supported – the web is full of sites with object making advice and downloads.
Complementary Libraries Several specialist libraries are available on the web or on CD from companies specialising in object making and add-ons, such as People and More, Theometrics, Hoshino, M.A.D., etc. If you explore the Introduction to Object Making
Using old libraries – update library parts You can use library parts from older ArchiCADs providing they have 3-letter suffices. They will be much slower to load, and may work
13
PART ONE: OBJECT MAKING WITHOUT GDL
incorrectly. You can speed this up by opening ArchiCAD with the Special Menu visible. Boot up ArchiCAD holding down the Opt-Cmd keys (Mac) or Alt-Ctrl (PC) – you will see the Special Menu appear. Load the library you want to update. Now select ‘Update Library parts’ from the Special Menu. It may take 10-20 mins. It is bringing them all up to date with GUIDs and other AC8/9 characteristics.
Add-ons that make Objects There are a number of third party programs that can create or edit ArchiCAD library parts, for example, Zoom GDL, 3NF. You will also find a growing number of object-making Add-ons working in ArchiCAD such as RoofMaker, Trussmaker, Profiler, Roof, Floor and Wall Accessories, ArchiForma, GDL Toolbox. Objects created by these Add-ons contain GDL scripts as well as other, application-dependent data.
1.2 Making your own Library Parts Without GDL – using ArchiCAD’s Tools Walls, Slabs, Roofs and other ArchiCAD 3D tools are available in the Tools palette as custom tools for object making, regardless of their originally intended purpose. You could, for example, model a dining table easily by using walls and slabs. The legs could be tall, small slabs, or short thin walls. The tabletop could be a slab. A lipped edge to the top could be made with a very thin low wall. The resulting structure can be viewed in the 3D window and saved as a library part. Library parts originating from the floor plan can be saved either as ‘Editable’ scripts or in ‘Binary’ format. Editable scripts give you some GDL so you can enhance the library part’s 3D appearance by modifying its script. You can do useful work on a script, mainly in editing materials and pen values. Binary library parts offer lightning fast imaging speeds, but do not allow editing, and have no parameters other than ones enabling stretchiness – width, depth and height. If you want to perform other modifications, you must return to the original floor plan document, modify the model, and save it again as the same or as another binary library part. If you save floor plan elements as a GDL script, the complexity of the resulting script will depend on the element types you have used. The
14
Slab tool and Roof tool will produce GDL script that is relatively easy to modify. The Wall tool creates bits of script which are harder but not impossible to modify, but are easier to build in the first place. Some of the most interesting possibilities are with the Mesh tool, which makes surfaces that can be converted to roofs and saved as objects. Sometimes the objects you make with ArchiCAD tools are more easily built on their side, rather than upright. Windows and doors should be built flat on the floor and ArchiCAD will convert them to be upright. Sometimes you will not be able to make an object all at once. You may have to make the legs first and save those, then make the superstructure, save that, then make additional parts, and save them. There are primitives such as cylinders, cones and domes in the ArchiCAD Library that you might also use as part of your object. You can then bring all those subsidiary parts together in the floor plan, and save the whole result as your final library part. Later in this book there is an exercise to demonstrate this procedure. Be warned, though, that this final object will only work if all the subsidiary objects can be found in the loaded libraries.
This bentwood chair is entirely made from small walls. For the more experienced object maker, it is possible to combine the use of ArchiCAD tools with a knowledge of GDL. Because you cannot rotate objects in the ArchiCAD floor plan (other than around the Z axis), you will quickly see the benefit of learning even a small amount of GDL, in which you can rotate shapes however you want. Shapes can be drawn out in the floor plan with the wall, roof or slab tool, saved as little chunks of GDL, brought back into the plan and Introduction to Object Making
PART ONE: OBJECT MAKING WITHOUT GDL
then added into a larger GDL project that the writer is working on – moved and rotated into position, amended or simplified. Not all objects need to be 3D. It is possible to use the 2D tools of lines, text and fills to draw standard symbols, select them, and ‘File>GDL Object>Save selection as...’ a library part. If you already have a 3D object that you wish to use purely as 2D, you can select it, ‘explode’ it, and save the resulting lines as a new 2D library part. This does not change the original 3D part. All library parts are objects, but when you save them you can decide if they are to be an Object (a piece of furniture or a building component), a Window, or a Door. If it’s to be a Lamp or a special furniture object, place the object in the plan, open it and select a new Subtype for it.
This accurate ship model for the US Coastguard was built entirely by tracing over the DWG construction drawings in ArchiCAD with 2D fills, dragging the fill shapes into GDL, and tidying up into 3D subroutines. Assemblies built with the Tools palette do not have to be lost. You may want to edit or elaborate and resave. Select your assembly and save as a Module. This will take a fraction of the disk space, and can be put in a folder near your Library with a filename that helps you remember its relation to the library object that it helped you create. With modules, you may wonder, why bother to save as objects? The answer is, if you wish them to behave as objects (stretchy) and allow further editing (improved materials etc.) and appear correctly in schedules, they must be saved as library parts.
Introduction to Object Making
Making Objects with GDL Scripts Even a small knowledge of GDL allows you to go far beyond the possibilities offered by the simpler methods above. If you can describe what you want in words and numbers, you can make objects with GDL. That’s why it’s called Geometric Description Language. • Because GDL has many 2D and 3D commands, you can make interesting objects that cannot be made with the Tools palette – they can be Complex and Curvy. • Because you can define diameters, spacing, thickness, materials and pens, your objects can allow variations –- they can be Parametric. • Because you specify elements in a GDL model by precise dimensions, angles or parameters, the objects will be exactly what you want them to be –- they can be Accurate. • Because you can write IF statements, you can build rules of behavior into your objects, such as manufacturers’ requirements, checks on incorrect parameters, self-sizing components etc. – they can be Smart.. • Because you can write routines that loop around and repeat actions many times, you can economically build large or repetitive structures that would be futile to build with the Tools palette – your objects can be Tools. • Because you can rotate, slide and resize components in the model, your objects can change their shape – you can make Mechanisms. You also have the ability to decide which parts of a GDL model can cast shadows, which pen colors the object should be drawn with, how many polygons there should be in curvy bits. You can generate your own materials – shiny, matte, transparent or glowing – so that they will work even with an ArchiCAD in a different language from yours. GDL objects are independent of dimensional settings because they are parametric; GDL models can animate, or contain dozens of varied configurations selectable from a popdown menu. GDL is an ideal tool for the Internet, for marketing products such as office furniture or kitchens. GDL Objects are cross platform and
15
PART ONE: OBJECT MAKING WITHOUT GDL
economical in size. They can be viewed with a browser, configured in their parameters, and downloaded.
How do you make an Object? Look around you, examine the 3D objects that surround you as you read this book. Observe, if you can, the essential primitive forms that compose each object. Most objects can be seen as composed of blocks, prisms, cylinders, cones, tubes or surfaces. Your coffee mug is a hollowed out cylinder, with a closed bottom. Your laptop is two flattish brick shapes hinging. Your mouse is an elongated egg shape with a flattened bottom surface. Ask yourself what detail needs to be included; discard detail that is not essential to the 3D render you want to get from it – think about the viewing distance that the object will be seen from. Use a level of detail that is within your abilities to model either from the Tools palette or with GDL script. Difficult 3D tasks such as surface rippling or perforation might more easily be solved by using textures instead of struggling to find a physical 3D modelling solution. If you are using the ArchiCAD tools (not GDL), view the object in terms of the familiar tools of wall, slab and roof, and include in your vision the primitive shapes from the shapes library or bits you can make with Profiler or Trussmaker. If using GDL, look at it in terms of blocks, spheres, cylinders and cones. As your GDL skills grow, you can add prisms, sweeps, plane and meshed surfaces and tubes.
CADCAM system (cutting tool) or a rapid prototyping machine. So you must be satisfied that it IS right. For this, you are better off working in GDL from the beginning.
The idea of an ‘Investment Object’ Ask yourself if the object you want to make is to be used more than once, if it could be useful in other projects. You might be the one person in the office making objects for other people, and therefore you need to make the object usable by others. If you make it parametric and smart, it might take you longer to make an object that could more quickly be made with the Tools palette. But if the object has versatility and can be used in many more projects, the time taken to make the object well is an investment and your users will be grateful for the effort.
Does it need to LOOK right, or BE right? An object that is used to furnish the interior of a house may only be required to give a luxurious impression of the interior, an authentic ‘lived in’ look. It only needs to LOOK right. This could be built with ArchiCAD’s own tools or with GDL, and the dimensions could be ‘eyeballed’ – that is, you use the grid as a guide and get the size as accurate as your eye tells you it needs to be. But using the Tools palette, your objects will still have a ‘blocky’ look to them. Another object may be required to be totally accurate, so that you can derive accurately dimensioned sections and plans from it. It may need to be precise enough to fit a confined space, like a kitchen or bathroom part. At the top end, it may be required to drive a
16
Investment Objects: This parapet ladder is required un-countable times on the buildings of Orcutt Winslow (Arizona) and each one is painfully slow to draw in 2D sections with different heights for each ladder. The GDL object took the author less than an hour to write and is stretchily configurable in every conceivable direction and provides 2D and 3D data for materials ordering and welding.
Introduction to Object Making
PART ONE: OBJECT MAKING WITHOUT GDL
Furthermore, objects made with the Tools palette are no longer editable if the original floor plan file that made them has been lost (and you also forgot to save them as a module!) A piece of GDL that is well written can be extended and made more powerful when your own knowledge of GDL improves or when a new edition of ArchiCAD offers more features. A well written object could be taken on by someone else in the office, years after you have left, and improved to take advantage of greater knowledge or of new features like graphical hotspots or better texture and detail. Here’s another investment idea – objects you make can be used in AutoCAD and ADT using the free GDL Adaptor – how many people may now be able to enjoy a good parametric object, and perhaps pay you for it?
Can you learn GDL? Many objects do not need to be built with GDL – the ArchiCAD tools may be enough. Experienced ArchiCAD users who are scared of GDL get very skillful in transforming the simple 3D tools of wall, slab and roof and some add-ons into most complex objects. But they will never have the pleasure of making their objects parametric. If you are prepared to go beyond the Tools palette, GDL is an easy scripting language compared with those available in the other CAD packages. GDL is based on BASIC, the easiest of the programming languages. Millions of people learned BASIC during the pioneer years of microcomputing, and GDL remains the most useful and practical descendant from BASIC. Experts who used to say that BASIC was not powerful enough for commercial applications can be confounded by a well written piece of GDL. ArchiCAD users who make the bold step of tackling GDL are frequently surprised at how easy it is compared with what they expected. Users can suddenly find a practical use for all the mathematics they learned at school. Total beginners can please themselves with rapid progress up the learning curve. They can make objects that impress their friends and colleagues, and genuinely improve the quality of their work. Experts in GDL continue to find additional depths and techniques in GDL. With energy and programming experience they can extend the possibilities. As soon as they begin to feel they have reached the limit,
Introduction to Object Making
Graphisoft’s next edition of ArchiCAD provides new areas of exploration and power.
The ArchiCAD experience You may wonder if you can learn to make good objects without knowing too much about ArchiCAD. Well you can, but it really pays to have a good knowledge of ArchiCAD as a working tool – the use of the 3D and 2D elements; the use of techniques such as the Magic wand and the Marquee; splitting, mirroring, resizing and multiplication. If you are a regular user of ArchiCAD you will also develop a feel for what you like or hate about objects – do they stretch mindlessly, are they difficult to pick up or snap to, are they transparent when they should be opaque, do they look clumsy in 2D, can you understand the parameter descriptions? A critical appreciation of the experience of the user will help you make better objects.
Spelling and grammar A note for pedants: in the text, some words are capitalised or italicised for emphasis or because they are titles e.g. the Wall tool. In other cases you may find spellings that you do not agree with e.g. colour, metre. Largely, we have used English rather than American spelling in the English language edition. For the countries which use commas as a decimal point, please note: in GDL, commas are separators, period (stop) symbols are decimal points.
You learn by looking at the objects Try to get the objects that are illustrated in this book from a CD or Website, and work through them as you read the book.
17
PART ONE: OBJECT MAKING WITHOUT GDL
Read about Object Making Besides this book, you can read about object making in other manuals and guides: ArchiCAD Reference Guide – see table of contents and index of that volume. In particular, peruse the section on “Parametric Objects” (Tools chapter). It is an important complement to this book and it would be repetitive for me to reprint it all here – but it contains very valuable information on object making. DXF/DWG Conversion Guide: Bringing in objects from other CAD environments. ArchiCAD Training Guide: Making library parts (see table of contents of that volume). GDL Reference Manual: Syntax of GDL commands, in depth information on every aspect of GDL except programming. Help Menu in ArchiCAD: Syntax of GDL commands, more frequently updated (when versions change) than the Manual, this book or the Cookbook. Not included with ArchiCAD, but obtainable: The GDL Cookbook: Project-based approach to learning GDL that teaches both GDL and the technique of programming with GDL from beginner to expert level. Project Framework: Discussion of how to get the most out of ArchiCAD in the professional office, with good explanations of organization of your libraries. You could also consider keeping a personal notebook of your progress with object making. By noting your successes, you can build up a personal fund of expertise.
18
Introduction to Object Making
PART ONE: OBJECT MAKING WITHOUT GDL
CHAPTER 2: OBJECT MAKING WITHOUT GDL 1 Before learning GDL it is wise to become fully conversant with object making using ArchiCAD’s own tools.
2.1 Making Objects without GDL Most ArchiCAD users become skilled at making objects using the normal building elements in the Tools palette before they tackle GDL. For ArchiCAD newcomers, let’s make sure you are fully conversant with object making before moving on to discover the power of GDL.
Three methods of saving an object from ArchiCAD Make the object using the Slab, Wall and Roof tool, and select it in the floor plan window with the cursor. Then use one of these three methods:
1 If the object has been made the right way up, or on its side, view in the 3D window in plan or elevation respectively. Save the resulting view as a library part – use File>GDL Objects>Save 3D Model as... to save it as a .GSM object, window or door. Save it into one of your loaded libraries. 2 If the object has been made the right way up in 3D or if it is 2D, use File> GDL Objects> Save Selection as... to save it into one of your loaded libraries. 3 If the object is 2D, use File>GDL Objects>New Object... and when the GDL dialog appears, click the 2D Symbol button and draw it into the 2D symbol window – or paste in something you drew earlier in the floor plan. Set the A and B dimensions to the size of the object in your drawing. Processes 1 and 2 are called ‘Autoscripting’. ArchiCAD creates a GDL library part, with 3D form (if any) and either 2D scripts or symbol, and routines to provide stretchiness. Every object, 2D or 3D, has an imaginary size-defining cuboid around it of ‘A’ for width, ‘B’ for depth and ‘zzyzx’ for height. Method 1 and 2 will set this size automatically; for 3 you have to set the size. When you have made such objects, open them using File>GDL Objects>Open Object... – you will be able to view the scripts – a Introduction to Object Making
highly educational process! The format of GDL script it generates could be called ‘industrial’ – quite off-putting in appearance and a lot more complicated than the ‘Creative GDL’ that you can attempt with the help of this book.
Getting started with Object Making Before making your first object with the Tools palette (without GDL), ensure that you are or you will become conversant with some of these basic ArchiCAD using skills: • The use of the Magic Wand (for transforming a Fill to a Slab, or a Slab to a Roof, Line to a Wall etc.) • Setting Grids, large and small, and setting dimensional preferences to work with Metres or Decimal Inches. • Using the Coordinates palette to make things accurate. • Using the Settings dialogs for the various tools in the Tools palette to get their materials and heights correct. • Using Add-ons like Profiler and Trussmaker. • Discovering the useful ready-made bits of GDL in the ‘Special constructions>Basic shapes’ library. • Using the Marquee tool and 3D Cutaway to cut objects. • Solid Element Operations (new in ArchiCAD 8). • Making curved edges in slabs and fills with the Pet Palette. • Setting up 3D Projection Settings to arrange camera and viewing angles correctly. • Making Section/Elevation windows and copying and pasting between those and the floor plan. • Multiply, Rotate and Mirror. • Align texture – set origin and set direction.
Setting up Open a new ArchiCAD file, load your standard library, and load a new folder to use as your working library and save the new file to that folder or to somewhere convenient. Set the large grid to 12” or to 300
19
PART ONE: OBJECT MAKING WITHOUT GDL
mm and the small grid to 5mm or 0.2”. Zoom in to somewhere near the Origin of the Floor Plan, so that you are viewing an area of the grid that is a little larger than the furniture you wish to build. Try to work at or near the real origin, not a temporary one. Hairlines help with 3D building, True line weight helps with making 2D objects.
2.2 Let’s make something in 2D Let’s try making some 2D bathroom fittings. There is no scripting to do, it can be drawn with 2D tools. You could use this procedure for electrical symbols, kitchen or bathroom furniture, or as a personalised symbol for trees and plants. There are two ways to do this: draw the object in the floor plan using Lines, Arcs, Fills, Hotspots and Text. Select and File>GDL Objects>Save Selection as... an object into a loaded library (method 2). You are advised to use mainly the Fill tool with opaque fill, so that the object is solid against a coloured background and not transparent. Be warned that the object is not scale sensitive, so text and line widths and vectorial fills may appear differently according to the scale of the final drawing. Bring it straight back by selecting a library part from the Toolbox and placing it in the Floor plan next to the original drawing. Normally, the most recent library part saved is the first object that appears when you place an object in the plan.
from the original drawing. This object may be saved as ‘bthrm_whb.gsm’ and the other two objects may be saved with names to match, e.g. as ‘bthrm_wc.gsm’ and ‘bthrm_bidet.gsm’. The other method (3) is to create a New Object (from File>GDL Objects>New Object) and from the GDL dialog, hit the 2D Symbol button to get a 2D symbol window and draw the symbol directly into that window (or paste it from the floor plan drawing). Check the size of the sanitary fitting, and set the A (width) and B (depth) values in the parameter table correctly, or your drawing will be distorted when it is an object. One benefit of method 3 is that you can return to add more detail to the drawing in the 2D symbol window and you can decorate it with the hotspots of your choice on key parts of the object, like the corners and the plugholes. If you do not add any special hotspots, you will get 5 ‘bounding box’ hotspots – so add those hotspots.
Set the A and B to the correct dimensions You will not have to do this too often because the ArchiCAD library is well equipped with 2D objects, and many of the 3D objects from the ArchiCAD Library have a ‘2D only’ mode in which the 3D can be omitted.
2.3 Bring a file in from DXF/DWG
If you now Open the Object (from the File>GDL Objects menu) you will find that the 2D view is scripted, including all the hotspots
20
If you want to bring in some 2D from DXF/DWG, bring it in to the floor plan first. Then you have the option to clean it up, get the scale right and make it into a 2D Library part as in the earlier section. When you want to bring the 3D DXF/DWG into ArchiCAD, bring it in as a GDL library part. The procedure is File>GDL Objects>Open Object. Look for ‘Files of Type...’ and select either the DXF or the DWG. Click on the file you want. You can opt for Default Translator. The Default Translator brings a 3D DWG in as GDL Script. Save the object, then place it in the floor plan and open the object: look at the Introduction to Object Making
PART ONE: OBJECT MAKING WITHOUT GDL
scripts. All the 2D and 3D data was imported, but you may be faced with colossal quantities of script. You may be disappointed with the result. Nothing brought in from DXF/DWG is solid; it seems to be a vast mass of polygons and lines, and in no particular order. If you attempt to edit these you will need a lot of luck and guesswork. The most you can be sure of editing successfully is the 2D symbol, and in the 3D, some IF statements added by you to hide or show portions; and insert some material and pen numbers. 3D objects may come in on their side, or the wrong size due to your not knowing if they are created in millimetres, inches, feet or metres. If the object is the size of a pinhead or larger than your town, you may have to ‘duplicate’ the Default Translator and amend the scale conversion of the import. It may also be many kilometres from the Origin. Solids may be inside-out hollow things. You may find that the lack of control over the number of polygons leaves you with a model that has so many polygons that your rendering times become unacceptable. Many objects can be found by some smart searching with Google. Check the file format before downloading. Choose the DXF/DWG if you have a choice. Always take the opportunity (exert your ‘consumer power’) to ask manufacturers of components to provide objects in GDL.
side, and only 150m high. You have to be prepared to do some fixing, e.g. rotating it upright, making a new 2D symbol and resizing it correctly in height and plan area.
2.4 Let’s make a 3D Object – a Table The next object, a Table, is to be made ‘the right way up’ and for this, the Slab tool is the most useful tool. Build up the table, starting with the table top, and add the legs and frame. For each part, use the settings dialog box to get the height of the slab correct. Remember that the height (altitude) of the slab is the top and the thickness is the amount of slab below the top. If you build from walls, the altitude of a wall is its base, and the height of the wall is above the base. It helps you later (if you want to tweak some of the GDL) to build over the main origin. If you have made a temporary origin somewhere else and the main origin is greyed out, just select the Origin tool and click on the grey main origin.
We can use the curving function in the Pet palette to soften the edges of the object. Remember also that you need to set the materials of the tabletop and legs using the Slab settings dialog box. A cylindrical element like the chair leg could be made by magic wanding a slab to a circular arc, or by bringing in a cylinder from the ArchiCAD Library. Perhaps the best way is to use the Column tool, set to the right dimension and materials. This model of the Eiffel Tower comes in perfectly from DXF directly from the Eiffel Tower’s own website. Unfortunately, it’s lying on its Introduction to Object Making
21
PART ONE: OBJECT MAKING WITHOUT GDL
To make sure that each leg is consistent, make just one leg correctly at first. Next, Edit>Drag a Copy to the other end of the table. If this option isn’t available, use Options> Preferences>Miscellaneous to activate the ‘Show Element copy...’ button. If you use the grid, you can make the table reasonably accurate in dimensions. Keep an eye on the Coordinates palette as you type in your X and Y locations and you can make the table totally accurate. This is easier if you set Grid Snap to ON, and use a small grid of say 10mm or 3/8”. Make the table about 750mm (30”) high.
When you have built the chair, select it and using 3D Projection Settings, view it in 3D hidden line, in Plan with the camera at 270°. Save it using File>GDL Objects>Save 3D model as....
Now click on the object icon in the Tools palette and place it in the floor plan. The result is indistinguishable from the original, but the GDL object can be placed as often as you need, it will appear in listings and can be used in other building models. This table will be stretchy, but if you stretch it, the section sizes will deform – so build it the size you want from the start if you want to avoid distortion. No matter how well you make it this way, it will never permit you to make parametric alterations to height, leg spacing or timber sizes unless you are prepared to dive in and do some editing in GDL. We will cover the editing of ‘industrial GDL’ in a later chapter.
2.5 Let’s Make a 3D Window with slabs Windows have to be made flat on the floor, and are best made with the Slab tool. Again, it is best to build it over the origin, and the origin
22
Introduction to Object Making
PART ONE: OBJECT MAKING WITHOUT GDL
should be symmetrically at the centre of the lower sill of the window. The external face of the frame must lie at a height of project zero on the ground plane. Normally, slabs have their tops on the ground plane, so be careful to set your window frame at the right height and altitude. Draw out a rectangular slab first which defines the overall opening size. Then select this slab, and with the Slab tool selected draw another rectangle within the first slab. This draws a hole in the slab and effectively makes the frame hollow. A better way to do it is to make the frame from four separate pieces. In this era of Open GL you want to try to get better texture rendering – look at the woodgrain – GDL organises the grain separately for each piece. Set the material of this slab to frame material. You can now draw another slab into the window, set this to 20mm (3/4”) thick and set it to ‘Glass’ for top bottom and sides. Make sure the height of the glass is well positioned in height, within the frame. For added realism, you can add a smaller group of frame sections to play the part of a casement, and a small slab below the project zero to be a sill.
The illustration above shows how the window should sit on the project zero ground plane. Check that the frame/casement/glass relationships are working correctly. Use a Section/Elevation view to get it perfect, including the glass position. In this case, the project origin is neatly positioned at the centre of the sill. This is not absolutely necessary because ArchiCAD will make Introduction to Object Making
adjustments when it saves the window so that the origin finishes up in the right place. But it is tidy and more disciplined to get it right at the start. When you are done laying slabs, select all the slab elements of the window, and view them in Plan (270°) just like you did for the table. Use a wireframe view to show the frame. Although you are viewing it in plan, ArchiCAD will turn it the right way round for it to work as a window in a wall. Save that 3D view as an Object and when asked, click on the ‘Window’ icon. Check the box that hides redundant lines. Make sure you save it into a loaded library. If you have not already done so, make a folder in your personal library for windows and doors as you save. If you clicked the window or door icon, ArchiCAD will recognise that it has to cut a hole in any wall. The hole size will be the width and depth of the window you made.
Back in the floor plan, build a wall, and then select a window to put into it. Select the window you have just saved. Place it into the wall, making sure that the Eyeball cursor is clicked to the outside face of the wall (the face with more hotspots). You can now view the result and change its parameters – of size only. One unfortunate finding is that the textures can be perfectly aligned in the object itself, but in the wider ArchiCAD environment, the wood textures behave differently. The way to guarantee perfect textures is to use Edit>Align 3D texture on each part of the frame before you save the window object.
23
PART ONE: OBJECT MAKING WITHOUT GDL
outline of the window, and give it an ID of ‘wallhole’. We will explain that more fully in chapter 10 on windows.
2.6 Let’s make a Chair using Wall tool
The technique of making windows is similar to door construction. But you would need GDL to change the window or door styles, to make it open and shut, add grilles, or offer a choice of glazing or ironwork styles.
Before you move on, you would find that the 2D symbol (see figure at right, in illustration above) is too horrid to use in a plan. The curve in the window head produces a lot of spurious lines. You should open the Window as a GDL object, click on the 2D Symbol button and it will open up a drawing window, enabling you to delete the bad lines and clean up the pen thicknesses (left side, in illustration above).
Unusually shaped windows – ‘wallhole’ idea Actually, this example is so simple that you find adequate windows like this in the ArchiCAD library already. Windows like this only cut rectangular holes in the wall. What you may need is a window of a more unusual shape. The trick is to lay a roof or a slab over the
24
Many objects are easier to make lying on their side, because of their complexity or shape. They may be far easier to build in profile than to build as a stack of slabs or walls assembled vertically. You can make skillful use of the Wall tool. Walls are most useful as they can be set to a thickness and height and can be snapped to follow lines with the Magic Wand. They are more controllable at following curves than the Slab tool. Their only trouble is their annoying tendency to join together and form strange spiky mitring effects when you least want it. In the Display Options you could turn off Clean Wall Intersections for straight lined objects. To get these curvy walls working, we should retain Clean Wall Intersections.
This Bentwood chair illustrates the use of the Wall tool perfectly – it could be made with the Slab tool but only with more difficulty.
Making the Frame and Seat First, using the 2D line tools, draw the outline of the chair frame, including the curve of the arms using 2D lines. Then set the Wall tool to be your choice of Wood material, 30mm (1.25”) thick and 150mm (6”) high. Magic Wand the Wall tool to the lines (click with space bar down); this causes the little walls to follow the lines. Ensure that the walls are grouped; drag a copy of the wall group to one side. Now use the Elevate command to raise that wall group by 600 mm (24”). Move that wall group back until it is exactly over the first. You now have the bentwood frame of the chair. Using the same wall setting, put in the Introduction to Object Making
PART ONE: OBJECT MAKING WITHOUT GDL
straight sections for the seat and back. Change their heights to start from 150mm (6”) above the deck and finish 600mm (24”) high – as in the illustration. Duplicate the seat and back walls, and make them about 90mm (3.5”) thick and change material to fabric. You can use the wall-end feature of ArchiCAD 8.1 to get rounded ends, or get the same outline with the Slab tool. To finish, the chair has some little black hinge bolts for the connecting rods, which can be a small but very high slab. Try using the Log setting in the wall, set to 30mm (1.25”) log heights to simulate bamboo for the arms. It works on the straight bits, but not on the curves. For this effect, you will need real GDL.
Stand it upright in 3D When you have something like the Bentwood chair in the diagram, lying fully on its side, it’s time to rotate it upright. Set the 3D projection setting in the parallel views to 90° position for camera with elevational view selected. Save the 3D view as a library part into your loaded library; this time, click the object icon (not the window or door) and tick the ‘Editable’ radio button, and tick the redundant lines checkbox.
Give the object a Preview Picture If you are pleased with your object, capture a small rendered view of it with the image size set to 128x128 pixels. Select it and copy. Open the object’s GDL dialog, click the Preview Picture button and paste the image into the Preview Picture of the object. It will look better in Windows/Finder and will be much easier to pick from the Object browser. You can paste any image that is near-enough square into the Preview Picture, but it will be rescaled by GDL. Pasting in a 128x128 ensures a distortion free image. You do not need to use ArchiCAD for the image. It could come from a photo, or a company logo.
2.7 Let’s make a Roof Truss with Fills
Place the chair into your project and enjoy! In this view, the finished chair object admires its creator with satisfaction. To improve it, you might edit the 2D Symbol (as you did for the window) to erase extraneous lines.
Introduction to Object Making
Try this exercise, which provides a link between the section/elevation and the floor plan windows. Construct a small one-room building, and place a pitched roof over it. Make the walls higher than the roof and then use the Trim to Roof command to make the walls and roof fit each other. Insert a window and door if you like. Now using the Section/Elevation tool from your Tools palette, draw a section through the building, and view the section.
25
PART ONE: OBJECT MAKING WITHOUT GDL
whole truss. In this case, use a separate Fill for the Steel wires, the Timber and the Circlebolt. Now select the fills, copy them, move to the floor plan and paste them. Move them to a clear space, and it would help if one end corner of the truss is over the Origin – perhaps one of the truss bearings. The hotspots will help you. Now you can magic-wand the Slab tool to follow the outline of the Fill, and to cut any holes you might have (there are none in this truss).
Making the 3D with Magic Wand and Slabs
This homely interior (rendered in ArchiCAD) needs some timber trusses.
Make sure before you use the Slab tool so that it is centered on the ground plane – in this case, for the timber set the thickness to 100 mm, the top of the slab to 50 mm and the material to timber. Thus the truss is nicely centered above and below ground zero. You will make similar settings for the Steel wires and the circle bolt. You may have a bit of trouble with the Magic Wand. Snap-click to the outline of the fill first to get the outline of the truss. If there are holes in the truss, select the new slab, select the slab tool again (making sure it is the slab and not the fill by looking at the Info palette) and then snap-click any of the holes in the fill. This will drill holes in the slab. You should finish with a small truss like the one illustrated. If you make a mistake, delete the waste slabs and try again with the sequence above. Make yours more complicated if you want to, with more members, or more varied width of members, and add extra metal plates for extra realism.
Draw Fills into the Section View the section. You can make use of the Line tool to set up guidelines to make sure that your timbers line at the right angles and have the right depths. When you have the section in the foreground, you can only draw with the 2D tools. Use the Fill tool to outline a small truss. This ensures that your future truss will fit the roof perfectly. Select the fill and continue to draw into it. If you need any holes, you can cut holes in the fill. Thus you form the outline of the
26
Keep the two sides of the truss separate by splitting the slab at the apex; do an ‘Align Texture’ for each side for the wood grain. This will look good in the finished object. Now select and view the truss from Introduction to Object Making
PART ONE: OBJECT MAKING WITHOUT GDL
the 90° camera position in parallel elevation view. Save the 3D view as a library part, click the object icon and you have your truss, with texture alignment.
Tidy up the 2D Symbol – add hotspots Now bring this truss into the floor plan. Open it as a GDL object and edit the 2D Symbol. Place 2D hotspots at the apex and at the bearing points where the truss meets the wall. This makes it easier to place in the model. Place one truss into the building and look at the original Section view. Use the view to get the first one the right height and position relative to the wall – make sure your truss aligns perfectly with the original fill pattern. Autoscripted objects are automatically stretchy so be careful when handling them – you do not want to stretch them accidentally. Use Edit>Drag a Copy or Edit> Multiply> Distribute to move and duplicate them, and use the Coordinates palette if you want exact spacing. This same method can be used to make complex structures – the limitation being that they will not be parametric, and they will all be rectilinear in section. Trussmaker is good for most trusses if made from a single material. This method is good for composite wood-steel trusses. Remember that single slab objects made this way will have the texture all one direction and will not look authentic unless you do it in separate pieces as we did for this truss.
Summary of Object Making in this chapter • You can make complex objects without GDL using the 3D tools or using library objects that already exist. They will be stretchy but not smart, and not parametric in anything except stretchiness. • These can be 2D or 3D and can be saved from the floor plan, or from the 3D view. • Windows and Doors can be made without scripting GDL. • The Wall tool is powerful for object making without GDL. • Using the Magic Wand, you can ‘steal’ shapes from 2D ArchiCAD and turn them into Objects.
Now the inhabitants have a nice steel tied timber roof!
Introduction to Object Making
27
PART ONE: OBJECT MAKING WITHOUT GDL
CHAPTER 3: OBJECT MAKING WITHOUT GDL 2 Even without GDL there are techniques of object making that go beyond the simple use of the standard ArchiCAD tools.
3.1 Using Basic Shapes from the Library You can make more complex or curvy objects using library parts that are in one of your loaded libraries. The standard ArchiCAD library contains a directory of special structures such as cones, curved tubes and vaults. Before you try to do this, just check which libraries are loaded (File menu>Load Libraries) and if it’s not already in, load the ArchiCAD Library. If you have an object-making add-on like Trussmaker, ArchiForma or GDL Toolbox, consider whether you can make your object with one of these more easily.
Make a ‘Banana’ Truss or Mullion object This banana truss has been built entirely from the ‘elbow’ and ‘cylinder’ objects in the existing ArchiCAD Library. The key is placing and configuring them, and thinking out which way to organise the camera direction. In this process, you are making parts of the truss, saving them, bringing them back in, grouping, then resaving – ‘nesting’, or ‘encapsulating’. Some of these components are somewhat confusing to manipulate. Once you have done the first save, you lose control over parametric changes, as the objects which follow are the ones you saved. So place them correctly at each stage. This object starts with the ‘Elbow’. Lay it down flat on the ground (centre of the tube at ground zero) and configure it to the length you want. Use 2D lines as guidelines. Place some single cylinders of a smaller diameter (see below) to form the bracing tubes.
Here the elbow has been placed and stretchy cylinders laid. Now save this with the camera at 90° in elevational view. Bring it back in to the plan, twice, and it should be upright, as in the next illustration. The upright truss halves can be splayed at the angle you wish to achieve, and then reviewed and resaved. Add in a column to form the long straight tube.
For the next step, it’s easier to rotate it 90°, so we can save it as an upright truss.
28
Introduction to Object Making
PART ONE: OBJECT MAKING WITHOUT GDL
Save again, with the camera at the same viewpoint, in elevation. You need great precision in placing them in relation to each other. Bring it back in, this time laid flat on the ground. It’s time to add in linking cross tubes. You will need the sectional view to get the precise position and height of each cross tube. In the plan make sure that the cylinder ends are ‘lost’ inside each main curving tube. View it in 3D Plan, 270° and you can save it as a horizontal 3D Truss.
You could view it one more time in 3D Elevation, 90°, and save a version of it, upright, for use as vertical wind resisting mullions – which is what I intended to make originally. Remember that if you ever wish to view the final object, you will always have to be able to find the constituent parts in a loaded library. If you alter one of the components, it may result in an error when the final object is viewed. We have become used to seeing the ‘Missing objects’ dialog box coming up at some time or other. This is useful; if you read it, the warnings of duplicate library objects and of missing ones require action. If the composite object never needs to be edited again, then you could view it once more in 3D plan view from an angle of your choice and then save as a Binary. This ensures that all the subsidiary objects are included and wrapped up into a new bundle of polygons and and you do not need to worry about missing the earlier components.
A final finish would be to open it as a GDL object and plant some hotspots into the 2D Symbol to remove the bounding box and make the truss easier to pickup and snap to wall surfaces.
3.2 Let’s make an Object by Cutting The banana truss/mullion is an example of nested objects (objects within the larger object). As another example of nested objects, we Introduction to Object Making
29
PART ONE: OBJECT MAKING WITHOUT GDL
could make a rounded vault, and further refine it with the ability to form a crossing – a groin vault. This is something we cannot do easily with the Slab tool, nor even with the Roof tool. Try using the more powerful Wall tool because it is smoother and more easily manipulated. We will draw a length of vault on its end, using the circular wall variant of the Wall tool. If you are more ambitious, follow this example making it as a Gothic vault (instead of Arched) by having two sections of curved wall meeting each other. Set the camera at 90°, viewed in 3D elevation, then save as a vault object. Call it ‘vault_part1.GSM’ if you like. Bring it into the floor plan and you now have a stretchy vault. You can change its length, width and height. So it may have been round when you first built it, but it could now be elliptical if you wish. Drag a copy of your vault object, and be careful not to change its width – change only the length. We are going to cut (or mitre) the vault at 45° angles to make it usable as a groin vault for the crossing.
The plan shows the basic wall curved to form a flattened circular vault; above it, the resulting library part – stretchy in three dimensions The marquee is mostly used as a rectangle but it can be very powerful when used as a polygonal shape, like a fill. First draw one 2D line down the centreline of the vault, using the half point tickmarks. When you hover the cursor over the end of the vault, you should get a little ‘tick’ mark to indicate the half width of the vault. Now draw two 2D lines from this half point at 45° angles to indicate the line you wish to cut along. By using the Shift key, you can ensure that these lines are at exactly 45°.
Cutting with the Marquee tool Now you may have noticed that one function of the Marquee tool is to act as a cutter when you view in 3D. Everything within the marquee is displayed, and everything outside is ignored. It’s a great way to do instant 3D sections. By the way, with ‘Image>Elements to show in 3D’ you can reverse that, and view only things outside the marquee.
Toolbox icon of the Marquee tool with the polygon and rectangle variants. And the ‘Elements to Show in 3D’ allows you to select the way that the Marquee operates. Now, using the Marquee tool in polygonal mode, Magic wand the Marquee tool to the 2D lines so that it encircles most of the vault that you intend to retain.
30
Introduction to Object Making
PART ONE: OBJECT MAKING WITHOUT GDL
Plan of the shimmering marquee over the vault object. The thin 2D lines ensure that your cutter is at exactly the right angle. Use the Coordinate Box if you like to type the angle in. Now you see the groin vault part in 3D. View this in 3D axonometric and you will find that you have a groin vault mitred at 45°. If the cutting effect does not occur, close the 3D window, use the Display> Rebuild command, and then try 3D again. If it is cutting correctly, use the 3D projection settings to set the camera position to 270° and the view type to Parallel>Plan. Save this as a library part and you can call it ‘vault_part2.GSM’. Return to the floor plan, and place your new vault piece. Now this object has default ‘Bounding Box’ hotspots. You can make your life easier – open the 2D Symbol in the GDL dialog and customize your hotspots. Place your own 2D hotspots at the corners, including one in the middle. Zoom in real close and place one at the pointy apex of the groin-vault. Personalised hotspots will remove the bounding box. The hotspot at the pointy corner can now be used as a hinge around which to Edit>Multiply>Rotate.
Introduction to Object Making
Place the result next to a piece of straight vaulting and you can now group these two. Now use Edit>Multiply to Rotate yourself another three and you have the complete groin vault!
Picture of the four vaults in 3D axo You can now add in more uncut vault objects alongside these, stretch to appropriate lengths and before you know it, you have your church roof. You can use the same technique with the polygonal marquee to take a sideways ‘bite’ out of a large vault and have a pair of smaller vaults intersecting. Try making a Doric column with Profiler, add a square base top and bottom. Bring it all together. All this can be done without GDL, and yet, when they see it, your friends and colleagues will be convinced you have become a GDL expert.
31
PART ONE: OBJECT MAKING WITHOUT GDL
Picture of the final structure, with the groin vault, and some columns made with Profiler, and a window made with little walls.
marquee, and view it in 3D in plan view. Either way, you will get all stories showing. If you had a basement that you wished to omit, then use Image>Elements to Show in 3D... dialog and you can decide which stories to omit. Save as an object. If you save it as ‘Editable’, you are in danger in the long term of losing the subsidiary library parts (such as windows) that it was built from. It may also fail to render due to spurious errors such as missing parts or bad polygons. Save as ‘Binary’, and you can safely export it to your urban model; place it anywhere and at any height and it will work. You would need a copy of the original if you wish to go back and modify any part of it, as the only editing you can do to a binary is to make it stretchy – so store the layer combination. If you do not want the binary building object to be stretchy (to help with selection), open the 2D symbol window of the GDL object, and place 2D hotspots wherever you think would be most appropriate – corners, turrets, entrance canopy, ridges, etc. and then save again. That will turn off the bounding box hotspots.
3.3 Urban Modelling Urban modelling – entire buildings as objects Entire buildings can be library parts. ArchiCAD is a powerful tool for building modelling. A finished building is an elaborate combination of layers, stories, library parts and building elements – it is not easy to transport to another model. In a city, every building has different story heights and different layer titles. An urban model is going to be concerned with city blocks, street furniture and landscape, and buildings are just a small part of this. If you are doing urban modelling, many buildings will be single forms, but the special buildings with a higher level of detail are best built in another plan and brought in as individual library parts. If you wish to include buildings from another project, open the file of the building, try to make the windows of ‘Ice’ or of a less transparent material, hide all layers to do with internal furnishing and small details (unless they need to be seen through windows) and hide the site on which it sits. Then select the entire building using the fat (thick lines)
32
Proposal for a 43 storey tower for Central London by Robert Luck. You can just see Tower Bridge in the far distance. the entire central area of London is a low polygon count object. Introduction to Object Making
PART ONE: OBJECT MAKING WITHOUT GDL
If you only need facades, you can build an entire facade on the ground, using the Slab, Wall and Roof tools. Then save it using the 3D view with the camera at 90° in the Parallel>Elevation view. Bring it back into your floor plan and assemble the building from facade library parts. Again, we advise that these are binary, to avoid any lost subsidiary components, and to reduce the risk of rendering errors. A disadvantage of this method is that you cannot use normal Window and Door objects in the library – but it’s great for areas of curtain walling. If the object is binary, you can change its materials at a stroke to a single one in the object settings box – untick the ‘Use objects own materials’ option. Try changing it all to ‘Ice’ for the ‘Sketchup’ effect!
Urban modelling – entire sites can be objects The converse of this idea is probably more commonly used. Your building may have a lot of detail; the site model of its surroundings may be larger in area but it may have fewer polygons than the building. Make the site separately, save it as an object, and bring it into the building model, in a lower storey. This way, you can hide or show the site at a single moment using layers, or change its materials from realistic to ‘Ice’ or ‘Whitewash’ ‘Pine, shiny’ in a moment. You can update the site by going back to the original site model and reviewing in 3D and resaving. For this to work best you must not alter the width and depth. If you alter these, the autoscripting routine will reposition the bottom left corner and thus the object’s position in your other model. Placing an oversize 2D rectangle around the large model and magic wanding the marquee to the rectangle will maintain a consistent boundary size.
Urban modelling – the Camera is the mightiest weapon!
While not wishing to suggest that Lara Croft’s environments are modelled with ArchiCAD, the point here is that you can use textures more vigorously. Open GL has changed the situation remarkably – it is far quicker to model urban environments with the greatest simplicity in 3D and then apply textures. If you cannot photograph an entire building, you can reconstruct its elevation from photos of the entrance, and main fenestration and roof features, and copy and paste together the whole facade. This technique is so important, we have the whole of chapter 9 dedicated to it – ‘Billboard Objects’.
The textured facades are so much more realistic than trying to use 3D modelling tools (as in the foreground, above).
3.4 Making Objects with Add-ons and Solid Geometry Progressing from the standard ArchiCAD Tools, we can make use of some of the object making Add-ons or functions. Profiler, Convert Introduction to Object Making
33
PART ONE: OBJECT MAKING WITHOUT GDL
Mesh to Roof, Solid Element Operations and Trussmaker are major assistants to object makers. There are some non-Graphisoft third party Add-ons, notably ArchiForma, GDL Toolbox and Zoom, but this book would never end if we covered all those – in brief, those are so good they exceed all conventional non-GDL methods of object making. However, true native coded GDL is more powerful than any of these because it is parametric and almost infinitely customisable in the way of user interface and 3D options once you have learnt it. It’s fair to say that some of the curvy shapes you can make with ArchiForma or Zoom would take years of GDL knowledge to equal with native GDL.
Profiler – for extrusions and lathing Profiler is a popular and essential tool, although it is not an official part of ArchiCAD – it’s in the ‘Goodies’ folder. If you do not see it in your Tools menu, put the Goodies folder into the Add-ons folder, and re-start ArchiCAD. In one form, Profiler is able to make Extrusions on the ground plane. Click out an outline with the Fill tool, select the fill, invoke Profiler from the Tools menu, click a starting point on the profile, and finally click out a pathway – and you will have an object. If you made a mistake, you can just make the extrusion again, and save over the name of the first effort. The API inside Profiler gets a template of a GDL object, writes the XYs of the profile and path into the Master, 2D and 3D scripts and saves a new unique object in your library – not dependent on macros or ‘super-objects’. The new object can be emailed or moved to another disk and will still work.
Profiler offers either Extrusion or Lathing.
Profiler used for Extrusion.
34
Introduction to Object Making
PART ONE: OBJECT MAKING WITHOUT GDL
Profiler used for Lathing. In its other form, Profiler is able to make Lathed Objects. The interface (sequence of actions) is more tricky than when making an extrusion, but after 2 or 3 tries, you might get something that looks right. We will make an object based on Lathing, as it is an important technique, and we can include Solid Element Operations (SEO) in the same task.
3.5 Make a Flywheel with Profiler! The horizontal flywheel is an object familar to winter sports enthusiasts – it rotates at the ends of a cable car or draglift, drives the lift cable and can be 2 metres or more in diameter. We need Profiler first to make the general flywheel shape, and we can use SEO to cut out the weight reducing holes. This is done by dropping in some cylinders, subtracting them, and saving the result. Profiler is able to make a full 360° sweep, or you can make two 180° ones and group them together. The profile is clicked out horizontally (it will be lathed round the Y-Axis). Summon Profiler from Tools menu. Click on the anchor point checkbox to tell it that you will decide where the axis will be.
Introduction to Object Making
As you progress, read the instructions that appear at the bottom left of the ArchiCAD window as you click. Use a horizontal 2D line to give you a line to snap to with all these clicks. Click again at the same point to start the hole, and the third click tells it how large to make the hole in the middle. It cannot tolerate a zero hole in the middle. Your next clicks are to click out the sweep angle. As you near 360°, it bounces back to nothing. You will either get a slice of 5 degrees or you may get the full 360° sweep. Save it in the library and it will be placed in your plan by Profiler. Mirror a copy, position it to form a full wheel and then group, and you have a wheel.
35
PART ONE: OBJECT MAKING WITHOUT GDL
Dare you tweak the profiler object yourself ? It takes about 30 seconds for an experienced GDL writer to modify the code in the profiler object to force it to sweep through 360° or any other angle. If you are daring, open the GDL profiler object, click open the 3D Script, replace the parameter ‘angle’ in the REVOLVE command with ‘360’, and save. You can find out more about Profiler in the instructional html files in the Goodies folder.
Now select the wheel on its own, 3D view in Plan at 270° and save the 3D view as Object, Editable. Place the resulting object in the floor plan. You will get the wheel with the cutting operating in the GDL, but by calling cylinders from the ArchiCAD library in the GDL. If you save it as Object, Binary, the object is completely independent of the library.
Now try Solid Element Operations! When you get to know how to use SEO you will be grateful that you were introduced to the technique – it is incredibly liberating for the object maker. Now bring in the same Cylinder from the Basic Shapes library that you used to make the banana truss. Place one upright into and through the wheel, then multiply that one to make few more, by rotation. Here we have 6 cylinders at 60° angular separation. Now group the 6 cylinders – to each other, NOT to the wheel. Make sure that groups are not ‘suspended’. Select Edit>Solid Element Operations (recap with the “Solid Element Operations” section (Techniques chapter) of the ArchiCAD Reference Guide if you are not confident with this). Select the wheel as the target and the group of cylinders as the operator. Click ‘Execute’. Nothing will appear to happen, as the cylinders are still there.
36
If you take a quick view of the editable script of an object made with Solid Element Operations, you will gain a quick tutorial in the syntax for Solid Geometry Commands in GDL! They are basically the same thing.
Introduction to Object Making
PART ONE: OBJECT MAKING WITHOUT GDL
3.6 Convert Mesh to Roof You will find the Mesh tool very powerful in making shapes. It can be edited in 2D or in 3D, it allows curved edges, it interpolates if you add extra ridges, edge points or internal points, and there are settings you can apply to make it look smooth or ridgy. You can cut holes, add or subtract chunks. Users are often frustrated that if a mesh is used as a membrane (no earth sides or fill) it is only one surface of zero thickness and only one material. There is an answer – you can give it thickness.
Select the Mesh, use Tools>Convert Mesh to Roof, and the mesh will be converted to a surface with thickness and with different materials on top and bottom. Better still, you can suspend groups and then edit the collection of joined roofs – select them individually to delete, punch holes, or change the materials – as you wish.
With this, you could construct complex roof shapes, eyeballing or entering heights as you go. When you are ready to, convert to roof and your structure is tidily jointed and made parametric – and you could save the roof as a module or as an object, as you please.
Other free Add-ons within ArchiCAD
Try this hyperbolic saddle shape. One trick is to make it flat at first and apply a curve to the edges before you set the altitude of the corners. This will have the effect of interpolating the points of the triangles that will be formed at a later stage along the edges. Putting in the simple inner ridge is easy and you find that the heights of the new points are interpolated too.
Introduction to Object Making
You can profit by having a play with some of the other tools. The Battered and Canted walls and Roofmaker and the Roof accessories give opportunities for object making. Trussmaker is a great benefit, providing incredible versatility. You can create small structures using different pen lines in 2D – for this the continuous line tool is very helpful. The example here can be made without Trussmaker. With the 2D lines drawn, you could use the Magic Wand and get a small Wall tool to run along the line building rectangular tubing. Save this from the 3D view in Elevation, 90° and it’s pretty good. Trussmaker will make circular or rectangular tubing, and it has useful parametric features such as a ‘leaning over’ angle and 2D capabilities.
37
PART ONE: OBJECT MAKING WITHOUT GDL
Seriously, this was done by someone who knew no GDL!
3.7 Carving Walls with the Roof tool You can run Trussmaker to create tubular frameworks, bring them back, rotate slightly, join with others, review in 3D, resave as binary, bring them back, join them again, and so on until you have built up complex 3D tubular structures. This model of the Lovell Radio Telescope at Jodrell Bank by Chris Jones was done entirely with Profiler and Trussmaker, by progressive viewing, saving, placing, grouping, re-saving etc. By saving the tower as a fixed object, and saving the swivelling telescope reflector and its framework as a separate object, the whole reflector assembly can be swivelled by providing a simple GDL command ROTx angleparameter.
38
This ought to be an important part of Object Making. For a long time, Roofs have been able to cut Walls – ‘Trim to Roof ’. The theory is that you can make fat pieces of wall, then nudge up to them with smaller pieces of roof and make shapes by carving out chunks. The benefit of this idea is that even if you throw the roof bits away, the cutting effect remains – and it can be undone with a simple ‘Undo rooftrim’ command. However, if you try this, it is too unpredictable. Roof bits only cut reliably if their pitch is along the line of the wall’s reference line. If they cross the wall at any angle, then the cutting line is extended a random amount beyond the edge of the wall. Even if the pitch line is along the wall line, there are sideways cutting effects that reduce accurate ‘carving’. The wall under the hyperbolic saddle shape (even if only the edge roof elements are selected) gets cut in a wrong way because pitch lines are in many directions, and some of the cutting planes seem to continue on into space. Introduction to Object Making
PART ONE: OBJECT MAKING WITHOUT GDL
this chapter, so it resulted in some research into roof cutting and carving!
This stone is a piece of ArchiCAD Wall carved in different directions. The roof that is axial to the wall line cuts the ridge perfectly, but the sideways cutting plane extends too far. The roofs at angles to the wall line extend their cutting planes beyond the ridge although their side cutting is correct. If you wished to form a wall up to the edgebeam, you could make a temporary dedicated single roof piece to do the cutting because the edge is almost straight.
The illustration above shows the use of a curvy roof used to cut a wall. If you keep the wall line and pitch lines, you get a perfect result (rear wall). If you rotate the wall and thicken it (as in the foreground wall, thickened to 7.5m) the cutting is all over the place. The next example is an attempt to carve a piece of stone. Something like this was required by a client of the author during the writing of Introduction to Object Making
Solid Element Operations (SEO) to the rescue! Do not be worried by the erratic roof problem – your complete answer is in SEO. Here is the same block, with all the cutting and carving working perfectly. Position the roof elements as accurately as you need (using Section/elevation window). Invoke the SEO palette (from the Edit menu) and use the ‘Subtraction with upward extrusion’ option. The nice thing about this is that cutting is dynamic – you can adjust the position of the roof or walls and see the difference immediately. You do not need to worry about putting the roof elements into a hidden layer. If you are making an object, simply select the wall element that is being cut (but not the roofs), view in 3D Plan view, and save it as a GDL Object.
39
PART ONE: OBJECT MAKING WITHOUT GDL
Notes on the naming of parts All saved objects end with the suffix .GSM. Even Mac users must work with this convention. Do not alter these suffixes when saving or at any later time. Do not alter the names of objects in the libraries or your project file will not be able to find them next time it loads. The subtype selection is what decides if the object is a window, door, lamp, table or other object type – so make sure you select that correctly. The best method is to think of a good name at the time of saving. Avoid using generic names for library parts – ‘Table.GSM’ sounds like a good name for a table – but the next time you open your project file, you may find a quite different table appearing because one of that name already exists in a different folder. ‘Table_japonica.GSM’ is more likely to be unique – it will not match anything already in the ArchiCAD Library. Use something like that, and your Library Manager will be able to find it. ArchiCAD 9’s object browser permits you to find objects by name – e.g. you can search on a word like ‘round’ and all objects with ‘round’ in the name will appear: round_table.gsm, round_canopy.gsm, merrygoround.gsm etc. You can also search on wild cards (*), e.g. ‘Smith_*.gsm’. The stone block here is shown in Glass so that you can see the accurate cutting on the far side of the block. If you wish to modify the stone carving later, you could select the little bundle of wall and rooves and save the selection as a module, to bring back later. You can now delete the original wall and roof elements.
SEO gives you perfect cutting of the wall under the saddle.
40
Why bother to make objects? Your confidence with the standard Tools palette may now be greater and you may ask, ‘Can’t I just group the walls and slabs and roof bits together into objects, and duplicate when I need more?’ Let’s highlight two key reasons for object making: • Unless you have a systematic way of saving, you will lose the objects you make – they will not be stored and indexed systematically as are the objects in your library. Saving a bunch of slabs as a Module with a clear naming system is your only chance of retaining your sanity with a ‘no-object’ approach. But it lessens the investment value of your work – so my advice is to make objects. • Schedules get very confused without objects. A room full of furniture all made of grouped slabs and walls makes the scheduling function of ArchiCAD report that there are a whole lot of slabs Introduction to Object Making
PART ONE: OBJECT MAKING WITHOUT GDL
and walls in the room – wouldn’t you would prefer the scheduler to report a clean list of 4 ‘chairs’ and 2 ‘tables’ and a 3 sets of ‘shelves’?
Are you using the Student version? Many people reading this book may be students of architecture and design, eager to go beyond object making and try the real thing – GDL. My experience is that students are more willing to dive in and try GDL than architects because they have a more research oriented approach, don’t mind working in the evenings, and don’t cost their time by the hour. It’s also more recently that they were at school and learning a bit of trigonometry and algebra – so they aren’t scared by elementary mathematics. Before we embark on GDL scripting, you may be wondering about the differences between the professional and the student version. The PNE, BPE and PAE file types are analogous but different to the PLN, BPN and PLA files. The files from the student version are closed to the professional, although the student version can open the professional files. It is not even possible to copy and paste from one to the other – if you try, only 2D data is copied. But GDL development is cross platform and cross version. The student version is an ideal GDL development environment. It has all the power to develop objects and to test them in an ArchiCAD environment. The only drawbacks may be: • You cannot use the .PAE Archive file to send objects to others outside the education world. You cannot send a Module either. You just have to put the objects into a .ZIP archive and email or transfer that archive. • There is a chance that the Preview Picture may be overwritten with an ‘Education’ logo, in which case it would need to be re-pasted in the professional version.
• Using the Marquee tool, you can cut library objects into smaller shapes, or cut bites out of them. • If you wish to place your building in a larger site model for visualisation, you could save it as an object, but make sure you hide the layers containing complex interiors. • You can take object making to the other extreme – of having entire surrounding buildings or landscapes as objects and bring them into your main building model. • Textures mapped to facades of extremely simple building shapes produce better results than over elaborate 3D modelling. • Take a close look at the Add-ons and special modelling functions available to ArchiCAD users, particularly Profiler, Trussmaker, Solid Operations and Mesh to Roof. • Roofs cut walls, but do not try to use them to carve walls. Solid Operations do it better. • Take care with the naming of library parts – avoid using generic names for objects – but make sure the name is descriptive. • Save your assemblies of slabs and walls etc. as modules in case you need to remake an autoscripted object.
Summary of Object Making in this chapter • Take a look through the existing library and see what use you can make of the ‘Basic Shapes’. Introduction to Object Making
41
PART TWO: BEGINNERS' GUIDE TO GDL SCRIPTING
PART TWO: BEGINNERS' GUIDE TO GDL SCRIPTING CHAPTER 4: STARTING WITH GDL Now it’s time to gather your courage and make a start with GDL. It’s not as difficult as you expect! “GDL Authoring is an intellectual act of creativity and discipline.” -- David Sutherland, Fender Katsalidis, Architects of Eureka Tower, Melbourne 2004
4.1 Starting with GDL Chapter 1 discussed reasons why you might want to build with GDL. Chapter 2 may have lulled you into thinking you needn’t bother with GDL. Now it is time to decide – read on? Do not be nervous. You will find it easy if you take it in stages. Open the Object Making window: the GDL Dialog From ArchiCAD, select a typical object, select from the File menu>GDL Objects> Open Object. You will get a GDL editing dialog box like this, with a bar of buttons across the top and down the left-hand side. In the side bar, the wide buttons allow scripts to be displayed in the large white window. The small white buttons allow the scripts to be displayed in floating text palettes.
The GDL Dialog: the list of parameters and their descriptions, types and values are the ‘Parameter Table’.
The Scripts and Buttons in the Parameter Table Before starting with an easy exercise, let’s look at the function of the scripts and windows available to you. Not all of these will be of use to the beginner.
42
Introduction to Object Making
PART TWO: BEGINNERS' GUIDE TO GDL SCRIPTING
Parameters button shows you the list of parameters and parameter titles that the user will see and use when they use your object. By hitting the ‘New’ button and filling in the small details, you can create parameters. By selecting a ‘Subtype’ you can say if the object is in a special classification. Don’t do this until you have more experience. Master Script can be used for housekeeping tasks such as checking user errors and defining materials. This is read by the other scripts. If you enter a value like the radius of a tube or the width of a chair seat, it becomes available to all the other scripts – saving you from repeatedly typing the same information into each script. It also contains routines to correct errors in the user’s parameters, e.g. zero for radius. 2D Symbol is a drawing window into which you can paste a 2D image, or draw using 2D tools. It will only be displayed if there is no 2D script. With GDL knowledge, you are better off trying to write a 2D script. 2D Script can make a 2D symbol in several ways. • It can be used to draw lines, 2D shapes, polygons and text. • It can tell GDL to draw in 2D whatever it finds in the 3D script (PROJECT2). • It can be used to force the 2D Symbol window to be the 2D symbol (FRAGMENT2). Its most creative use is for you to write a parametrically organized script to draw what the object will look like in 2D, by using 1, 2 or all three of these options. By designating Hotspots, the 2D script can make the object stretchy and easy to pick up. If the 2D script is left blank, the object will display whatever is drawn into the 2D Symbol window. If you leave both blank, the object will not show in the project. 2D Full View shows what is generated by the 2D Script. This will not normally show what is in the 2D Symbol window. 3D Script is the primary means of building parametric 3D objects. If the object is simple, almost all the work can be done in the 3D Script. This is the power center of most library parts. 3D View is generated by the 3D Script – not to be confused with the 3D window of the main project.
Introduction to Object Making
Property Script enables you to write Components and Descriptor commands if the object is to be in a schedule. Parameter Script is the place where you can build pop-down menus, and send updated values of parameters back to the Parameters Table. Comment is a small text field in which you can write a set of instructions to your user on how to use the object. You can put the URL of your website in there with a hash# symbol, so the user will see a clickable web-access icon. Preview Picture is a window containing a small bitmap image of a view of the object. It tells the user what the object will look like in its setting, and could come from Artlantis Render or an ArchiCAD photorendering. This becomes the icon of the object in the settings dialog box. User Interface Script enables you to build a custom settings dialog box with your own text fields and images, with buttons and input fields for the user to enter parameters. It supports multiple pages. It is great for complex objects where the user might need more explanation of the purpose of parameters. Relax! When you start GDL, you only need the 2D and 3D scripts at first, and then the Master Script.
The purpose of the Parameter Table is to set up the parameters types, names and default values you are going to use, but it is also the way you can construct the settings dialog that the user will see. The most important parameters of ‘A’, ‘B’ and ‘zzyzx’ are moved into white boxes alongside the parameters.
43
PART TWO: BEGINNERS' GUIDE TO GDL SCRIPTING
3D Entities
Dimensions – use the decimal system
This book cannot contain comprehensive syntax of all GDL coding. Please have a GDL manual handy for cross checking. The easiest 3D elements to build with are Block, Cylinder, Sphere and Cone. Their syntax is very simple. • BLOCK x,y,z x being the Width, y the Depth and z the Height. • CYLIND h,r h being the Height, and r the Radius. • SPHERE r r being the Radius. • CONE h,r1,r2,90,90 h being the Height, r1 the Radius at the base and r2 the Radius at the top. The 90, 90 are the angles relative to the cone’s axis at which you cut off the top and bottom. You can vary these numbers to get interesting effects.
The dimensions you are writing here are in metres. The native dimensioning system of GDL is always metres, no matter what you set your main project to be using. In your project, you could be working in feet and fractional inches, centimetres, millimetres. But GDL is ‘hard coded’ so you need to work to one dimensional system. If you wish to script with feet and/or inches, you can, but you must write them with punctuation, e.g. BLOCK 1”,2”,3’-0”. It reduces a risk of confusion (for humans) if you write dimensions with a decimal form, as 2.0, not as 2. If a dimension is smaller than a single metre, foot or inch, write it with a leading zero e.g. 0.55. If you must work in non metric, write mostly in Decimal Inches – we all know that 54.25” is 4’-6 1/4”, and it’s so much easier to write. When you get further you will write in parameters, and dimensions may not matter.
First steps in 3D GDL From File>GDL Objects>New Object, you will get a GDL dialog, and you can open the 3D Script window. Try writing BLOCK 1,2,3. Look at the result in the 3D window – a tall cuboid. Now try writing, CYLIND 1,1: a short but very fat cylinder appears at the near left corner of the cuboid. Now try writing SPHERE 1: – a large ball appears at the same corner, partially submerged in the fat cylinder. Finally, try the CONE: play with the cutting angles. All these objects have been built at the same location, called the Global Origin. Even at this stage you will be eager to improve the appearance of the object. It is all the same color, depending on the default PEN. So above the Block command, write PEN 1, and write MATERIAL 'Surface, Whitewash' (or use the name of a material that is known to you in your materials library, or write MATERIAL 18, ArchiCAD’s default index for white). PEN 1 MATERIAL 'Surface, Whitewash' BLOCK 1, 2, 3 CYLIND 1, 1 SPHERE 1 CONE 4, 0.5, 0.1, 90, 90
44
3D View Click the ‘3D View’ button (of the library part, not the project) and you will see this. These objects all exist in the same space and overlap each other, so we need to find a way to separate them. The wireframe view shows each of the objects and the shaded view shows you how well GDL permits objects to ‘collide’ like this in the shaded view without harm.
Introduction to Object Making
PART TWO: BEGINNERS' GUIDE TO GDL SCRIPTING
Check Script If, when you click the 3D window, it refuses to draw because of an error, return to your script and click the ‘Check Script’ button. This will point to the line where the error occurred, usually because of a wrongly placed comma, or a spelling error. Do this often when writing GDL.
3D Space and the 3D Cursor You need to move about in 3D space to be able to place elements such as the legs of a chair, or a tabletop. Movement around the model is done with ADD commands. These work on the logical idea that the 3D world can be thought of in three cardinal rectilinear directions called X, Y and Z. You should be familiar with the idea of X, Y and Z from the normal ArchiCAD environment – the Coordinates palette allows you to enter a dimension in X or Y (and you can also enter radial dimensions and angles). In GDL, we use X and Y; Z is used to provide vertical movement.
The three-pointed object that you can see in a GDL 3D view reminds you which ways are X, Y, or Z. This is like a 3D Cursor. When you word process, you are used to the idea of a cursor – wherever you place the cursor, you can begin typing, and whatever you type appears. In GDL, there are two of these, one at the origin, and one where you have moved to. The one labelled ‘G’ is the Global Origin of the GDL model. The one labelled ‘L’ is the Local Origin, referred to here as ‘3D cursor’, for short. Wherever this is, your next 3D Introduction to Object Making
command will happen. Using the ADD command, you can move the 3D cursor about in 3D space in a single XYZ move. ADDX, ADDY, or ADDZ move the 3D cursor in those axial directions, in one direction only.
The importance of DEL It is a good discipline to return the cursor back to the origin as often as possible. GDL remembers every cursor move you have made. The DEL command undoes or ‘deletes’ these movements, allowing the cursor to retreat back to the origin, leaving the 3D elements behind.
2D Cursor movement When you are writing GDL in 2D, you have a similar concept of X and Y based 2D space. You do not have to worry about height. Using the ADD2, ROT2 and DEL commands, you can move about in 2D space providing you specify both the X and Y distances. Unfortunately, you do not have a visible cursor.
You can Rotate, Shrink and Stretch In reality, the 3D world is too complex to be defined ONLY in absolute terms of X, Y and Z. So you will be glad to know that you are also able to Rotate the 3D cursor (using the ROT command) and move radially, and work at different angles from the pure horizontal and vertical. You are also able to shrink or expand the cursor (using the MUL command which multiplies) so you can easily deform or mirror elements of your model. A few simple examples will illustrate how all of these work. Take the previous script and have fun with it. Expand the dimensions to give them at least one decimal. !Cursor Movement PEN 1 MATERIAL 'Surface, Whitewash' BLOCK 1.0, 2.0, 3.0 ADD 1.0,1.0,1.5 ROTy 90 CYLIND 1.0,1.0 !Expand dimensions ADDz 2.0 MULz 0.5 SPHERE 1.0 ADDz -2.0
45
PART TWO: BEGINNERS' GUIDE TO GDL SCRIPTING
CONE 5, 0.5, 0.1, 90,90 DEL 5
Avoiding spaghetti – use DEL frequently You may be familiar with the difference between Absolute distance (distance from the Origin) and Relative distance (distance from where you are now to the next position). In GDL, you navigate around the 3D model making Relative jumps. Because you can also Rotate and Multiply, you are in danger of getting lost – after a few lines you could be ‘deep in spaghetti’. After each set of moves, you should return to the origin using DEL before doing the next job. For example, in a chair model, you could build the legs, then return to the origin before starting work on the seat.
Do not forget the 2D script The Block is built as in the previous example. The cursor moves in the X direction, using the ADDX command. Write this as one word ADDX followed by the distance. Then, using the ROTY command, the cursor can be rotated around the Y axis. Now the Cylinder gets drawn – although cylinders always grow vertically, the vertical axis is now laying on its side, so the cylinder grows sideways. Now you can ADDZ which raises the cursor vertically in its new orientation. We want to draw the Sphere, but as a bit of fun, use a MUL command to halve its height and make it elliptical. MULZ 0.5 makes it half as high, but leaves width and depth unchanged. You usually specify a number to delete cursor movements, e.g. DEL 5, but you can also DEL TOP – this extends the DEL command so that it deletes everything back to the origin. Write DEL 5 it is better because it requires you to count the cursor movements, which means that you are in full control of the process.
Use Comments frequently In this example, we have started by adding a Comment. Using the exclamation mark, you can type anything you like after the mark and the machine will ignore it. But it is most useful to the human eye and brain. It is always good to comment your scripts with a name and a date. It is also a good typographical discipline to write GDL commands in upper case and to write comments and parameter names in lower case.
46
Finally, when you save the GDL model, and bring it into the project floor plan, you will be dismayed to find that it does not display – it has no symbol, and at best you will have nothing more than a hotspot. So for now, open the object again, open the 2D script window and write a single line: PROJECT2 3,270,2
This is a ‘killer’ command that in one line, projects a view of the 3D object in 2D, regardless of its complexity. Later, when we get onto 2D scripting, the PROJECT2 command can be explained in more detail, along with other 2D GDL commands.
Summary of GDL, to this point • Start with the easy 3D commands. • Write (!)Comments to define a piece of work. • Write GDL commands in UPPER case, and everything else (parameters, comments) in lower case. • Set a Material and Pen color. • Use Check Script to see if errors occur. • Be careful with commas and spelling. • Click in the 3D window to see the object build. • Do one bit at a time, return the cursor to the origin using DEL and then do the next bit; and so on. Avoid DEL TOP. • Do not forget to make a short 2D script: PROJECT2.
Introduction to Object Making
PART TWO: BEGINNERS' GUIDE TO GDL SCRIPTING
4.2 Let’s build a 3D Object – a Chair From ArchiCAD, choose File> GDL Objects> New Object. We are going to build a simple chair. Remember that this tutorial is about GDL, not chair design, so please do not be concerned that it is a simple chair. It needs to be.
The Legs Start in the 3D Script with a CONE command for one leg of the chair, so that the legs appear to taper from 60mm to 30mm (2.4” to 1.2”). Later we can introduce more subtleties of form and size. Starting from the left-hand front corner, use the ADD commands and work your way around the chair, planting legs as you go. Let’s assume the seat height is 500mm (20”). !Simple Chair Example, 3D script PEN 1 RESOL 12 !---All the legs----------MATERIAL "Wood-Pine, shiny" CONE 0.5, 0.015,0.03, 90,90 ADDx 0.45 CONE 0.5, 0.015,0.03, 90,90 ADDy 0.55 CONE 0.5, 0.015,0.03, 90,90 ADDx -0.45 CONE 0.5, 0.015,0.03, 90,90 DEL 3
Notice that it is wise, even for such a simple object, to write a comment, and to state the material and pen color. We used a RESOL statement to set the number of polygons, the ‘Resolution of Curvature’, on each leg to 12. You may not have the Material name used here, so put in the names of materials that you know to be loaded. Notice that the textures are horizontal. At this stage you may have to make a vertical version of Pine to make it look right on the legs. The operation to make the legs required three ADD commands, so we can use DEL 3 to bring the cursor back to the Origin. Then rest.
Introduction to Object Making
Click in the 3D view frequently as you develop the script.
The Seat and Back The seat should be of a different material so start with the comment and for the upholstery, write a new material statement. When you use quote marks, it does not matter if they are double or single quotes as long as you are consistent. Lift the cursor and draw the block. Note that the seat block goes from centre to centre of the legs – not good joinery, but easy GDL! The upholstery is really a small shallow block set above the larger seat block. !---Seat & upholstery--ADDz 0.45 BLOCK 0.45,0.55,0.045 MATERIAL "Surface-Fabric" ADD 0.025,0.025,0.045 BLOCK 0.40,0.50,0.005 DEL 2
Now for the Back. Note that we are working with CONE and BLOCK on this chair. As your experience increases, you will expand the range
47
PART TWO: BEGINNERS' GUIDE TO GDL SCRIPTING
of GDL commands you use to achieve form. There is usually more than one way to make any shape. We can use a thin block of upholstery, as we did for the seat. !---Back Legs, panel and upholstery--MATERIAL "Wood-Pine, shiny" ADD 0,0.55,0.5 CONE 0.6,0.03,0.02, 90,90 ADDx 0.45 CONE 0.6,0.03,0.02, 90,90 DEL 2 ADD 0,0.54,0.70 BLOCK 0.45,0.025,0.35 MATERIAL "Surface-Fabric" ADD 0.05,-0.01,0.02 BLOCK 0.35,0.01,0.30 DEL 2
2D Script To complete this, you will want to see it in your floor plan. You must write a short 2D Script. Open the 2D script window and write the single line PROJECT2 3,270,2. Save and close the object, return to the floor plan. Click the Object tool in ArchiCAD Toolbox, click in the plan, and your chair will appear, with its own hotspots provided by ArchiCAD. It will not be stretchy – we did not write in this capability. The chair may not win a design award, but it is your first GDL object – so reward yourself and then move on with GDL.
First add some parameters Click on the chair object and open it again for editing. In the Parameter Table, click the ‘New’ button 8 or 9 times to make new parameters. They are given default names, and they always start with a value of zero. Click in the parameter name box (‘Variable’) of the first one and rewrite a name for the leg thickness parameter. Call it ‘lsec’, a 4-letter shorthand for ‘leg section’. Write in the larger field something like ‘Leg sectional diameter’ or equivalent. This is what the users will read when they open your object – so make your description a model of clarity. Then enter a starting value, such as 0.06m. If your system settings are in another unit system, write in 60mm, or 2.25” or whatever suits you. Add in more parameter names. Try ‘sthit’ for Seat height, ‘framat’ for Frame material and so on. Do likewise for the other parameters your user will be allowed to change. You will find a ‘Type’ button in the Parameter Table that you can pop-up to reveal an iconic palette to tell GDL whether the parameter is a Dimension, a Material, Pen etc. See the example below. Make sure you set the parameter types correctly – it’s a common source of GDL errors.
4.3 Let’s make this chair parametric If you stretch an autoscripted object, it deforms proportionally, but unrealistically. Square table legs become rectangular, cylindrical legs become elliptical. If you stretch a correctly written parametric object, it retains important properties such as diameters and thicknesses – stretches intelligently. The primary reason for using GDL has to be to enable objects to be parametric. So this simple chair needs to be upgraded.
48
Introduction to Object Making
PART TWO: BEGINNERS' GUIDE TO GDL SCRIPTING
The popup parameter type palette permits 12 types of parameter. Select the appropriate type.
Rules for parameter naming A and B and ‘zzyzx’ at the top of the Parameter Table are ‘Magic parameters’ that govern the width and depth and height of objects. You do not have to use them. You could use ‘wid’ and ‘dep’ along with the other parameters. Let’s use A and B and ‘zzyzx’ here because they will enable the object to be stretchy. Change them to valid dimensions for a chair, as above. The rules for names of parameters are simple. Use more than one or two letters so that you can remember what the parameter means. Short named parameters are used as ‘counters’ or ‘flags’ when you get further with GDL. It’s important to be able to read your script weeks later and still understand what you meant. It is more expressive to write ‘framat’ than ‘fm’. It takes more typing, but that is a small worry compared with the importance of understanding. It’s easy to make typing errors with long parameter names, so avoid over-long names like ‘leg_cross_section’. The letters must be sequential (no spaces) but you can join words with an underscore e.g. ‘leg_mat’. Parameters are not case sensitive, but as a discipline, stick exclusively to lowercase for parameters, uppercase for GDL commands. You must not use words that are already GDL commands (or archaic GDL commands). So names like ‘block’, ‘strlen’, ‘open’ ‘tri’, ‘tetra’ or ‘nod’ cannot be used. See the list in the manual.
Tidy up the Parameter Table You can move parameters up and down using the little arrows at the left. You can also click on the parameter type icon, and set some of them to be a Title or Separator. With the Title parameter type, you can organise the parameters into groups. Then by hitting the little Indent button you can link a parameter such as ‘framat’ to the Pens and Materials group.
Now convert the 3D script The next task is to convert the script from dimensions to parameters. Once you have written a few GDL scripts, it becomes second nature to think out the structure of an object in terms of parameters and write directly into the script using parameters. You develop a personal lingo of words like ‘rad’, ‘diam’, and ‘matl’ that you can use in all objects. Start by changing all the leg section widths to ‘lsec’, then gradually change all the others. Everything in the chair can be replaced by parameters – even the Pen. Try it for yourself. Compare this with the previous dimensional script and convert it, line by line. !Simple Chair, Parametric 3D PEN cont_pen RESOL 12 !--All the legs----------MATERIAL framat CONE sthit, lsec/3,lsec/2, 90,90 ADDx A CONE sthit, lsec/3,lsec/2, 90,90 ADDy B CONE sthit, lsec/3,lsec/2, 90,90 ADDx -A CONE sthit, lsec/3,lsec/2, 90,90 DEL 3 !--The Seat and upholstery----ADDz sthit-frsec BLOCK A,B,frsec-0.002 MATERIAL seatmat ADD lsec/2,lsec/2,frsec BLOCK A-lsec,B-lsec,0.005 DEL 2 !--Back Legs, panel and upholstery
Introduction to Object Making
49
PART TWO: BEGINNERS' GUIDE TO GDL SCRIPTING
MATERIAL framat ADD 0,B,sthit CONE bhit,lsec/2,lsec/3, 90,90 ADDx A CONE bhit,lsec/2,lsec/3, 90,90 DEL 2 ADD 0,B-0.01,sthit+bhit*0.3 BLOCK A,lsec/2,bhit*0.6 !Back panel MATERIAL seatmat ADD lsec/2,-0.01,lsec/2 BLOCK A-lsec,0.01,bhit*0.6-lsec DEL 2
When you multiply or divide, note that Star (*) means multiply, Slash (/) means divide.
The idea of ‘Manufacturers Rules’ – a systems approach The back is a little more complicated than the seat. Now we have to do a little systematic thinking on the chair and apply some design rules. You could trouble the user for parameter values for every part of the chair – or you could have some easy system rules that define the design. In this case, the gap under the back panel is 0.3 of the back height. The panel is 0.6, and the final space above is 0.1 of the total height. This is what we could call a ‘manufacturer’s rule’. We have to apply a systems approach to all 3D objects if parametric scripting is to work at all.
Error checking As you work your way through the script, keep clicking in the 3D view window of the GDL object to see if the logic of your arithmetical expressions are making sense. If they are not, it may be a bad spelling, or a misplaced comma. A wrongly spelled parameter will result in a value of zero, or could produce an error message. Click on the ‘Check Script’ button and read the error message – if you get one. Make sure that dimensions are dimensions and not angles or something else.
50
3D is more powerful if it is parametric You can see that it is possible to write 3D scripts that are 100% based on parameters and not on real dimensions. This is the key to making objects smart and powerful. Once ArchiCAD users have grasped this they realize that there was something useful in all that algebra they learned so painfully at school. Later with GDL, you may find that your school trigonometry comes in handy too! Save the chair object, look at it in the floor plan, view its settings window, and play with it. Change the materials, height and leg thickness. If you have done everything correctly, it should behave parametrically.
4.4 First steps in 2D scripting Use a script for a more effective 2D symbol In the first version of the simple chair, you used the command of PROJECT2 3,270,2 – that does it all. To achieve this, it has to generate a 3D solid of the object as seen in plan view and work out what hidden line drawing will be seen from above – meanwhile the clock is ticking. With too many of these in the project, your floor plan can take too long to load or regenerate. So we advise that you always use a 2D script unless the object is too changeable or complex to script. Let’s try a small script for this chair. The RECT2 command is a 2D command that is equivalent to BLOCK, and CIRCLE2 is equivalent to CYLIND and CONE. 2D commands are more flexible as you can specify the X and Y of their location, e.g. RECT2 x1,y1,x2,y2, and CIRCLE2 x,y,rad. All 2D commands end in the letter ‘2’. There are two ways of doing this chair. We could follow the same sequence as the 3D script, using the ADD2 command to move around and plant each circle or rectangle. Alternatively, we could stay at the origin and just issue all the LINE2 and CIRCLE2 commands without having to move anywhere. We also have to consider how the symbol will look. When we placed a corner of the seat block into the curved legs, the solid 3D hid the seat corners. In the 2D, a RECT2 imposed over 4 leg circles would look wrong, because the circles are transparent. So we will make a smart use of LINE2 to simulate the rectangle. Introduction to Object Making
PART TWO: BEGINNERS' GUIDE TO GDL SCRIPTING
!Simple Chair, Parametric 2D Script HOTSPOT2 0,0 !corner spots HOTSPOT2 A,0 HOTSPOT2 A,B HOTSPOT2 0,B HOTSPOT2 A/2,B/2 !pickup spot !PROJECT2 3,270,2 !now disabled s4=lsec/4 !Quarter of diameter s2=lsec/2 !Half of diameter PEN cont_pen CIRCLE2 0,0,s2 CIRCLE2 A,0,s2 CIRCLE2 A,B,s2 CIRCLE2 0,B,s2 LINE2 s2,B-s4, A-s2,B-s4 !back LINE2 s2,B+s4, A-s2,B+s4 !back LINE2 0, s2, 0,B-s2 !side LINE2 A, s2, A,B-s2 !side LINE2 s2,0, A-s2,0 !front
We can keep the PROJECT2 command in the script, but make it inactive by turning it into a comment line – in case we make some changes and want it back. Do not ‘comment it out’ until you are sure that your CIRCLE2 and LINE2 statements sit comfortably over the correct locations. Note that the ‘s2’ and ‘s4’ are temporary variables to avoid typing errors and save time. Save the object and place it on the floor plan. You will find that it generates the symbol instantly. The earlier non-parametric chair with a PROJECT2 is untidily full of lines. The scripted 2D parametric chair is better to look at in 2D.
Although you may prefer to work in Hairline much of the time, it is essential you see how your work appears with True Line Weight.
Write your own hotspots The scripted hotspots now permit stretching because they are on the leg centres and not on the bounding box. Much better! If you wish to guarantee that hotspots are where you want them and that the object will be stretchy, this is a typical small script you can use frequently! Put the HOTSPOT2 statements before the ones that contain the 2D drawing commands. 2D Hotspots only need the X and Y location. The first hotspot you write will become the placement hotspot of the object when placed in the plan. HOTSPOT2 HOTSPOT2 HOTSPOT2 HOTSPOT2 HOTSPOT2
0,0 !4 Corner stretch spots A,0 A,B 0,B A/2,B/2 !Pick up Centre spot
If you have used ArchiCAD, you will know that hotspots have three main purposes: allowing objects to be picked up; making them stretchy; and giving them ‘gravity’ (helping them to snap against wall surfaces or each other). Decide where you will need them most – corners, centre, intersections, etc.
Introduction to Object Making
51
PART TWO: BEGINNERS' GUIDE TO GDL SCRIPTING
The distance between the hotspots must be A and B for stretchiness. Just suppose your Origin was in the centre of the chair, not the near left corner. You would need this, using half values of A and B: HOTSPOT2 A/2, B/2!4 Corner stretch spots HOTSPOT2 -A/2, B/2 HOTSPOT2 -A/2,-B/2 HOTSPOT2 A/2,-B/2 HOTSPOT2 0,0 !Pick up Centre spot
More about Hotspots It is possible to write 3D Hotspots too – these help when viewing the object in the 3D window, making it easier to pick up and stretch or move. It is possible to write Graphical Editing Hotspots! What are these? Well imagine a furniture cabinet which you can fully manipulate in 3D and 2D – open and shut the doors, pull drawers in and out, adjust the spacing of shelves and partitions, pull down a hinged work top. With Graphical Editing Hotspots, you can build GDL objects like complex articulated mechanisms. This is fun!
3D can be more curvy Before long, you will want to break out of the rectilinear tyranny of BLOCK and RECT2. The more curvy commands, CYLIND, CONE and ELBOW are easy to use. With those three, you can build interesting tubular structures, such as the frames of steel furniture or lattice grids. You can do a lot more with PRISM and POLY2, which enable complex shapes in 3D and 2D, and permit curved edges. We would like to make objects with more user options and one of the best ways to provide this capability is with Popdown menus. And we would really like to know how to write these magic hotspots! We will explore all of these in a later chapter. Now that you have got this far, you may find it an easy challenge to explore further – peek into the GDL manual, or move on to the next chapter.
Selecting Objects Normally, you can only select objects by clicking on the hotspots of the 2D symbol in the plan. If your hotspots are in an illogical place, or
52
are on the bounding box, you may have to drag the mouse in a small marquee in your attempts to find those elusive hotspots. In ArchiCAD 9 you can make the job easier for users of your object. In the 2D drawn symbol, you should provide a fill over the area of your object. In a 2D Script, you should provide a filled POLY2. If you do this, your user can click anywhere in the fill and they can select the object easily. Another AC9 idea is that of making specific lines sensitive to your mouse. In a 2D Script, you can duplicate instances of LINE2 and ARC2 with HOTLINE2 and HOTARC2 (using the same syntax) and the mouse will detect the object anywhere along the line. Even in an object with PROJECT2 as the main way of drawing the symbol, you can inject a few HOTLINE2 commands to make it easier to pick up.
Subtypes – you can put this into a category You could classify this object as ‘Seating’. It’s early to do this, but you could try clicking onto the ‘Select Subtype’ button and choose ‘Model element, Furniture, Seating’. This will give you many more parameters than you first expected, many of them are to do with ArchiFM (Facilities Management); they may get in the way of your learning GDL. For now, select Model Element, and look further at Subtypes when you have got some more GDL experience.
Summary of GDL, in this chapter • You can write GDL entirely in dimensions, but try not to. If you must write in non-metric, use decimal inches. • It is better to write GDL in parameters. Try to make the entire script parametric. • Use parameter names that look logical, like ‘seatmat’. • Remember to click the pop-up parameter selector palette to tell GDL if a parameter is length, material or pen color or one of the other types. • Organise the Parameter Table into tidy groups with indent buttons to link parameters to titles. • Describe the purpose of the parameters clearly. • Click in the 3D view window frequently, or ‘Check Script’. Introduction to Object Making
PART TWO: BEGINNERS' GUIDE TO GDL SCRIPTING
• After each 3D task is achieved, DEL back to the origin before starting the next task. • Writing a 2D script is easy and saves time in the long term. • 2D Hotspots are vital for making objects stretchy. • Try cylinders, cones and elbows for extra quality and authenticity. • Control curvature of cylinders, etc, with RESOL or TOLER. • You could consider trying to apply the correct ‘Subtype’ even for simple objects. • Now, at last, you have a useful application for that algebra you learned at school.
Check the object As this object progresses, it gets more complex and you may be unwilling to type it in yourself. Check the original version out on the Website or the CD, and you can play with the code, or copy parts of it to an object of your own. It’s a great idea to build a similar object but to use different parameter names, so you go through the process of composition, with support from the script in the book, but not copying entirely.
Do some GDL – do it yourself There is an old educational proverb (it’s bound to be Chinese, all the best ones are): ‘If you Hear... you forget. If you See... you remember. If you Do... you understand’. I am a great believer in ‘pair programing’. If you find GDL a bit daunting, sit down with someone else and work through it together. I have found this technique to work very well with GDL teaching.
Introduction to Object Making
53
PART TWO: BEGINNERS' GUIDE TO GDL SCRIPTING
CHAPTER 5: PROVIDING OPTIONS IN GDL Perhaps you are looking at GDL because you like the idea of objects being intelligent – let’s look at practical examples of this power. "The Object Genome Project is a project to categorize and create Intelligence – provide it in the Master Script intelligent building blocks of objects that are used in design projects. We can add some intelligence and options to an object in various Object Genomes are used to describe architectural environments as ways: large as entire city blocks, buildings and sections of buildings. • IF Statements enable easy decision making by the object. The intelligent objects evolve over time, new characteristics, and rules • ValueLists (Popdown menus) allow the user to make choices, and are added as new and adjusted requirements come up. Our can regulate the variations in the object. environment and buildings are not static. • The Boolean parameter is a checkbox method for the user to say Just like the Human Genome can describe mankind, the Object ‘ON’ or ‘OFF’ to something – it’s a binary choice, like ‘Yes’ or Genome describes our built environment. Buildings are complex by ‘No’. nature and The Object Genome Project takes a methodical approach • The PARAMETERS command sends information back to the of analysing, documenting, and creating tools to master this Parameter Table. complexity." -- Kimon Onuma, Webscape, Pasadena, CA and Tokyo. We have a principle that we want to keep the 3D Script for 3D and the 2D Script for 2D. So we can use the Master Script for a lot of the 5.1 Providing Options in GDL thinking and decision making, and this will send parameter values to The simple chair was useful for breaking the ice with GDL; it is the other scripts in the object. parametric, but it doesn’t have any sense of intelligence. The first sign of intelligence in any organism is the ability to make decisions. Non 5.2 Boolean parameters – easy options intelligent organisms still have smart features, such as the regulation Introducing the IF-Statement of digestion, temperature, growth – autonomic functions. A sign of higher intelligence is the ability to communicate and respond, We could add two variations of leg braces to the chair and try two environmentally and socially. ways of allowing the user to choose the braces. We could also extend this to making the chair into a multi object – one that offers a number In our own very humble way, GDL authors can apply these concepts of preset variations. to our little objects. Objects can contain data – depending on certain conditions such as user defined width and height changes, or a change Show or hide the back of the chair in the drawing scale, they can adapt themselves appropriately, resizing We could use a Boolean parameter to allow the user to turn the back the spacing of shelves, deciding whether to omit handles, bolts or panel ON or OFF. Make a new one called ‘bakon’ and use the popup other levels of detail. Objects can offer the user easy options, either paletter to make it Boolean. Make a new Title parameter called ‘3D with checkboxes or with popdown menus. Objects can be self fixing Options’ and position the new parameter under it, indented so that if the user enters negative or bad values, and report back the it’s part of the new group. corrected shelf spacing or drawer height. In a sense, they can delight the user by being friendly to use and robust enough to survive rough treatment.
54
Introduction to Object Making
PART TWO: BEGINNERS' GUIDE TO GDL SCRIPTING
We can use an IF statement to decide whether to show or hide the back. IF statements can be written on a single line or, as in this script, can be written in the form shown here. The first line ends with the word THEN, followed on the next few lines with the things to be done as a result of the IF question. You round off the IF statement with the ENDIF statement to end it. Single line IF statements are of the sort: IF bakon=0 THEN arms=0
But here we need to write more than a single statement as a result of the IF condition. So we use an IF... ENDIF. The value of ‘bakon’ is sent to the 3D Script as a 1 or a zero. If the condition is not true (‘bakon’ is zero) the interpreter moves to the ENDIF command and continues with the rest of the script. We could write IF bakon=1 THEN, but as ‘bakon’ can only be 1 or 0, GDL accepts the parameter name alone as enough to judge its value to be ‘True’ or ‘False’. !--Back Legs, panel and upholstery IF bakon THEN MATERIAL framat ADD 0,B,sthit CONE bhit,lsec/2,lsec/3, 90,90 ADDx A CONE bhit,lsec/2,lsec/3, 90,90 DEL 2 ADD 0,B-0.01,sthit+bhit*0.3 BLOCK A,lsec/2,bhit*0.6 !Back MATERIAL seatmat ADD lsec/2,-0.01,lsec/2 BLOCK A-lsec,0.01,bhit*0.6-lsec DEL 2 ENDIF Introduction to Object Making
S Show or hide the braces In the same way we could add a new routine for the leg braces and could provide an additional boolean parameter to the 3D options group to control the braces. The braces will be double cones. We could have used cylinders but they would not look authentic – the ends have to be smaller so that they fit to the legs, mortice and tenon style. Follow the logic of the script below, and you see it’s simply a matter of moving and rotating the 3D cursor to the right place, and pushing out those cones. CONE can only go vertically, so the cursor has to point horizontally. We return the cursor to the origin as each brace is installed, with a DEL command.
!Braces IF brace THEN MATERIAL framat ADDz sthit/3 ROTx -90 CONE B/2,lsec/4,lsec/3,90,90 ADDz B/2 CONE B/2,lsec/3,lsec/4,90,90 DEL 3 ADD A,0,sthit/3 ROTx -90 CONE B/2,lsec/4,lsec/3,90,90 ADDz B/2 CONE B/2,lsec/3,lsec/4,90,90
55
PART TWO: BEGINNERS' GUIDE TO GDL SCRIPTING
DEL 3 ADD 0,B/2,sthit/3 ROTz -90 ROTx -90 CONE A/2,lsec/4,lsec/3,90,90 ADDz A/2 CONE A/2,lsec/3,lsec/4,90,90 DEL 4 ENDIF
This arrangement of braces is an H-configuration and we would be in trouble if we introduced another – like an O-configuration – because we would now have three choices, ‘None’, ‘H’, or ‘O’. Boolean cannot handle more than two alternatives, so we need to consider the use of a Popdown menu, or ValueList as we call it when writing the code.
5.3 Popdown Menus: allow many choices Popdown Menus are a great benefit to GDL users and authors. One popdown menu can offer the user a host of configurations or choices, and guarantees that the user cannot make a spelling mistake. Users have all used popdown menus in ArchiCAD Library parts, so it’s the most helpful way for your object to be told how to perform by the user. This makes the user’s decision more informed. The choices can be maker- specific with proper names or model numbers. If your popdown menu offers three distinct choices for the shape of an object, the user cannot mistakenly enter a wrong choice. GDL objects can now be much friendlier to the user, and for the developer, there is less need to write error catching routines. With numerical values, the ValueList can control lower / upper limits, providing a form of collision control e.g. preventing an anglepoise lamp head turning through the arm.
Scripting a Popdown menu : make a ValueList Technically, we call a popdown menu a ‘ValueList’. Making a ValueList is easy. We have to set up the list of values in the script and offer them to the user. First make a new parameter – either text or a number – and then type in a list of values for the ValueList menu in the Parameter Script or the Master Script. The VALUES command is the way to store the values. This then forms the popdown menu. This will pop out and
56
down in a setting dialog the same way that we get Materials, Pens, Lines, etc. A typical ValueList for a text parameter called ‘font’ would be: VALUES ‘font’ ‘Times New Western’, ‘Arial’, ‘Verdana’, ‘Courier’
Note that there is no comma after the parameter name (in quotes), but the list of menu choices are in quotes with commas. A ValueList of this form is best put in the Parameters Script.
Simple ValueLists are best built in the Parameters Script, but ones involving a lot of decision making are best built in the Master Script – GDL prefers it, and it also permits ‘joined-up thinking’ on your part. You build the menu and you write the IF statements that follow as a result. This way of writing ValueLists is an author’s special and is called the ‘Variables Method’. It works far better than the standard syntax. !Add to the Master Script !-------Pop down Menu----------bv0="No leg braces" bv1="O brace" bv2="H brace" VALUES "bracetyp" bv0, bv1, bv2 IF bracetyp=bv0 THEN brace=0 ELSE brace=1 ENDIF
What we do is to build a list of the words that will appear in the ValueList, making each choice equal to a simple variable like ‘bv0’. The single line starting with VALUES builds the popdown menu. The benefit of this way of doing it is that the decision-making that follows is easily done on the basis of simple variables like ‘bv0’. By this method, we can make popdown menus in English and Norwegian
Introduction to Object Making
PART TWO: BEGINNERS' GUIDE TO GDL SCRIPTING
and French if we so choose, and there can be no risk of spelling mistakes or upper/lower case confusion. This ‘variables method’ of building Valuelists only works if it is done in the Master Script. Because the ValueList is the primary decision making point, we can click the ‘Hide’ button in the parameter table for the ‘bakon’ parameter. Its value is now governed by the Master Script, not by the user. Here is a rerun of the original brace routine in the 3D Script, with the IF statements working. !--------Braces front to rear---------IF brace THEN MATERIAL framat ADDz sthit/3 ROTx -90 CONE B/2,lsec/4,lsec/3,90,90 ADDz B/2 CONE B/2,lsec/3,lsec/4,90,90 DEL 3 ADD A,0,sthit/3 ROTx -90 CONE B/2,lsec/4,lsec/3,90,90 ADDz B/2 CONE B/2,lsec/3,lsec/4,90,90 DEL 3 IF bracetyp=bv1 THEN !---H Brace-----ADD 0,B/2,sthit/3 ROTz -90 ROTx -90 CONE A/2,lsec/4,lsec/3,90,90 ADDz A/2 CONE A/2,lsec/3,lsec/4,90,90 DEL 4 ENDIF !brace=bv1 IF bracetyp=bv2 THEN !---O Brace-----ADD 0,0,sthit/3 ROTz -90 ROTx -90 CONE A/2,lsec/4,lsec/3,90,90 ADDz A/2 CONE A/2,lsec/3,lsec/4,90,90 DEL 4 ADD 0,B,sthit/3 Introduction to Object Making
ROTz -90 ROTx -90 CONE A/2,lsec/4,lsec/3,90,90 ADDz A/2 CONE A/2,lsec/3,lsec/4,90,90 DEL 4 ENDIF !brace=bv2 ENDIF !If brace
Add Arms – it’s easy! This far into the book, we can leap forward in faster moves, as you will have developed some confidence with GDL coding if you have tried out the easy stages of this little chair. We can add some arms, and then the chair is able to adopt a surprisingly large variety of configurations. Add an ‘arms’ parameter to the Parameter Table, and make it Boolean. !Add this to the end of the 3D Script !Arms IF arms THEN MATERIAL framat ADD 0,0,sthit !Left CONE 0.2 ,lsec/2,lsec/3,90,90 ADD 0,-lsec, 0.2 ROTx -90 MULy 0.5 !Squash the arm cone to an ellipse CONE B+lsec, lsec*0.7,lsec*0.45, 90,90 DEL 4 ADD A,0,sthit !Right CONE 0.2 ,lsec/2,lsec/3,90,90 ADD 0,-lsec, 0.2 ROTx -90 MULy 0.5 CONE B+lsec, lsec*0.7, lsec*0.45, 90,90
57
PART TWO: BEGINNERS' GUIDE TO GDL SCRIPTING
DEL 4 ENDIF
can have over a million variations – an ‘object genome’. CNC machines now make custom manufacturing possible, even with small production runs. We are all indebted to Kimon Onuma, president of the GDLA, for bringing to our minds the expression ‘Object Genome’.
!Add to the Master Script IF bakon=0 THEN arms=0
Make the Chair a MultiObject – Master Script magic!
This routine demonstrates the use of MUL to reshape the basic shapes. The conical arm now becomes pleasingly elliptical. Because we do not want Arms flapping about in the air if the Back is omitted, it’s important to write a small error-avoiding line in the Master Script. As these arms and braces are similar CONE routines, over and over again, it seems a pity to keep writing them so often. We need to learn how to write Subroutines – soon.
If the user chooses to keep this chair as a custom chair, it might be that they intend to commission the furniture-maker to make a special, and this customisation is a useful visualiser of the end result. Otherwise, they are happy to use one of the standard products, and have a choice of fabrics and woods, perhaps. This chair can be adapted to be a MultiObject. It is amazingly simple – you do not have to change the 3D Script at all – the work is done in the Master Script. Make a new parameter [text], let's call it 'chairtyp'. Build a Popdown menu definition in the Master Script.
The number of variations is growing.
5.4 The MultiObject concept We can make one GSM library part contain the code for many objects, in effect for it to become a super object. This is more economical than having a library of many different objects, all similar – because improvements and maintenance are easier to provide to a few well written objects.
GDL for Manufacturing The MultiObject is a very important concept in ‘GDL for Manufacturing’. GDL is smarter than a dumb DXF object, but one facility that makes it appear smartest by comparison is its ability to operate as a ‘Configurer’. The GDL object can contain many configurations of a designed object, that can be selected by the user, and which when selected will follow the correct rules – a kind of DNA for furniture making. One good kitchen cabinet GDL object
58
PARAMETERS, LOCK and HIDEPARAMETER These are three commands which allow you to modify the Parameters Table as the use will see it. PARAMETERS can pump a new value into the infield. LOCK can grey out a parameter and its description, indicating the current value but discouraging the user from trying to edit it. HIDEPARAMETER can hide the parameter altogether e.g. if the chair has a choice of square or round legs, the parameter for diameter could be hidden and the one for square section should be revealed. These commands should only be used in the Parameters Script or the Master Script. If the chair is to be one of the standard items, we should Lock all the user-customizable parameters like seat and back height. If they were not locked, it would confuse the user – but its good because it can display the new value to the user. It’s like the difference between a Introduction to Object Making
PART TWO: BEGINNERS' GUIDE TO GDL SCRIPTING
throttle and a speedometer in your car. You cannot make the car go faster by swivelling the speedometer needle! We want to transform this object to a MultiObject. To do this, we can simply use the Master Script to define a new value for the parameters for each of the standard versions of the chair: for seat height, leg section, etc, overriding the choice in the parameter table. You can use the colon to include more than one short GDL statement on the same line of text. It’s a help for compacting code, but can sometimes lead to your overlooking ‘bugs’. Use the ‘Variables method’ to build the menu. This example shows abundantly how good and how easy the method is. !Cookbook Chair: Master Script !------Menu for Chair------cv0='Customised chair' cv1='Foot stool' cv2='Nursery chair' cv3='Piano stool' cv4='Dining chair' cv5='Dining armchair' cv6='Kitchen stool' cv7='Bar stool' VALUES 'chairtyp' cv0,cv1, cv2,cv3, cv4,cv5, cv6,cv7 IF chairtyp<>cv0 THEN !Grey out custom parameters LOCK 'A','B','sthit' LOCK 'lsec','frsec' LOCK 'bakon','bracetyp', 'bhit','arms' ENDIF IF chairtyp A=0.35: lsec=0.04: bakon=0: ENDIF IF chairtyp A=0.30:
=cv1 THEN !Footstool B=0.30: sthit=0.28: frsec=0.04: arms=0 bracetyp=bv0 =cv2 THEN !Nursery chair B=0.35: sthit=0.32:
Introduction to Object Making
lsec=0.04: frsec=0.04: arms=0 bakon=1: bracetyp=bv0: bhit=0.5 ENDIF IF chairtyp =cv3 THEN !Piano stool A=0.45: B=0.40: sthit=0.45: lsec=0.05: frsec=0.1: arms=0 bakon=0: bracetyp=bv0 ENDIF IF chairtyp =cv4 THEN !Dining chair A=0.45: B=0.40: sthit=0.45: lsec=0.05: frsec=0.05: arms=0 bakon=1: bracetyp=bv1: bhit=0.55 ENDIF IF chairtyp =cv5 THEN !Dining armchair A=0.50: B=0.45: sthit=0.45: lsec=0.05: frsec=0.05: arms=1 bakon=1: bracetyp=bv1: bhit=0.65 ENDIF IF chairtyp =cv6 THEN !Kitchen stool A=0.35: B=0.40: sthit=0.60: lsec=0.05: frsec=0.05: arms=0 bakon=0: bracetyp=bv2 ENDIF IF chairtyp =cv7 THEN !Bar stool A=0.35: B=0.40: sthit=0.65: lsec=0.05: frsec=0.05: arms=0 bakon=1: bracetyp=bv2: bhit=0.3 ENDIF !More parameter checking IF bracetyp=bv0 THEN brace=0 ELSE brace=1 IF bakon=0 THEN arms=0 !Feedback to the user PARAMETERS A=A, B=B, sthit=sthit, arms=arms, lsec=lsec, cpn=cpn
The variations are now easily selected with preset choices.
59
PART TWO: BEGINNERS' GUIDE TO GDL SCRIPTING
At the end we choose to use the PARAMETERS command to show all or some of the values in the parameter table.
Cleaning up the object â&#x20AC;&#x201C; the professional touch To clean it up, check that you have all your parameters tidily sorted, indented and titled in the Parameter Table. Make a nice looking interior view with the chair. Render it at a size of 128x128 pixels. Copy and paste the square image into the Preview Picture of the GDL Dialog. Your chair will now look nice in the object browser.
You can also put a small note into the Comment window, including your internet address. Precede the internet address on the first line with a hash symbol. The rest of the Comment could be instructions or a copyright notice.
Another idea is to use Popdown menus as a form of instructions or information.
60
Introduction to Object Making
PART TWO: BEGINNERS' GUIDE TO GDL SCRIPTING
Picture tiles in the User Interface. With more work, we can build a graphical User Interface that presents ValueLists as a series of picture tiles. Wonderful! Unfortunately, it’s beyond the scope of the book, but it’s fully covered in the GDL Cookbook.
Summary of GDL in this chapter • We can try to make objects smarter and more user friendly by offering options. • Boolean parameters offer ON/OFF options. • ValueLists offer unlimited variations. • ValueLists built with the ‘variables method’ are easier to make and it’s easier to process the result. • IF statements can be long or short, and make decisions. • The Master Script is remarkably powerful. • Keep the user informed with PARAMETERS, LOCK and HIDEPARAMETER commands. • Give your object a Preview Picture and a URL. • If the object is complex, provide instructions and a graphical user interface.
Introduction to Object Making
61
PART TWO: BEGINNERS' GUIDE TO GDL SCRIPTING
CHAPTER 6: THE POWER OF PRISM Prism is a 3D command that adds real 3D power to GDL.
6.1 The Power of PRISM PRISM is the most versatile element in 3D GDL We have found that BLOCK is adequate for making elementary furniture and frames, but you rapidly discover that BLOCK is too primitive for serious work. Apart from its rigid shape, you have to move the cursor to the location of the block, and the block always grows from the near left corner. You have no control over pen lines or surfaces. Many objects have specific shapes or curves in them that require you to draw their outline shape correctly. PRISM is the answer, and there are several useful variants to play with. Prisms can be multi-colored, bent, rounded, cut, drilled, chamfered and hollowed out – very versatile. You can define the outline of a prism by listing the XY locations of its nodepoints. Your cursor can remain at the origin and your script can calmly draw prisms that are hundreds of metres away because it is entering the precise XY locations of each node. By adding underscores or preceding letters to the primary word ‘PRISM’, we can have a whole family of PRISM with related syntax: PRISM, PRISM_, CPRISM_, BPRISM_, FPRISM_, HPRISM_ and SPRISM_. We will explore a number of these commands.
Make a Prism – use Slab! Draw out a shape in the floor plan using the Slab tool – anywhere. Select it, use File>GDL Objects>Save Selection As... and store it as an object. Now place the new object in the plan, and it should look like the original slab, even having the same pen colour. Open it in GDL and look at the 3D Script. All autoscripted objects made this way have a mass of ‘housekeeping script’ at the start, but at the heart of it is a CPRISM_ statement which contains the outline of the shape you just clicked.
62
If you made this in a random location, you will find the numbers for the XY locations to be quite high, or perhaps negative. It all depends where you clicked. In a future chapter, we will look at the ‘housekeeping’, but for now try another idea.
Introduction to Object Making
PART TWO: BEGINNERS' GUIDE TO GDL SCRIPTING
‘Instant GDL’ The code for many prisms can also be ‘stolen’ from ArchiCAD. Now draw out a slab yourself of roughly the same shape. As a regular discipline, try to draw slabs in the counterclockwise direction, because GDL is happier working that way. Mathematically, counterclockwise is a ‘positive’ direction if you start trying to curve edges later. Draw it so that one of the points coincides with zero – the global origin. Usually, GDL seems to remember the order in which you clicked the points.
Now open a File>GDL Objects>New Object, and bring up a floating palette of the 3D Script (click on the little white button to get it). This is a trick that takes some learning, so try it a few times. Position the floor plan and the 3D Script as shown above, overlapping. Grasp an edge of the slab, and drag it smartly across into the 3D Script – as fast as you can. Do it slowly and nothing happens... So do it fast! Everything in ArchiCAD is in fact GDL (under the surface). You can click on anything in an ArchiCAD floor plan – wall, roof, floor, mesh, even and object – and you will find out what its GDL code is by
Introduction to Object Making
dragging and dropping it into a GDL script window. 3D objects should be dragged into a 3D script window, and 2D into 2D. You may get a 3D code looking like this: BODY -1 MODEL SOLID RESOL 36 !!Slab-018 PEN 1 ADDZ 4.1 BODY -1 cPRISM_ "Whitewash", "Whitewash", "Whitewash", 13, 0.1, 0.0, 0.0, 15, 4.28548, 0.0, 15, 4.28548, 0.949196, 15, 5.279549, 0.949196, 15, 5.279549, 2.155116, 15, 3.405484, 2.155116, 15, 3.405484, 3.067704, 15, -0.000425, 3.067704, 15, -0.000425, 2.00845, 15, -2.444858, 2.00845, 15, -2.444858, 0.949196, 15, 0.0, 0.949196, 15, 0.0, 0.0, -1 BODY -1 DEL 1
All Slab tool objects are converted into CPRISM_ – this is a prism in which the top, bottom and side surfaces are specified by name or number. The next line contains the number of nodes and the thickness, and then follows the list of XY locations. Each one ends in the number 15, and the final node ends in a -1. The 15 is a ‘masking code’ and simply tells the slab to be drawn as a Solid and tells all the edge lines to be drawn. The -1 tells GDL that the slab is finished (and also that the end point is the same as the start point). This is the default, so leave these as they are unless you want to omit nodepoints. Note that the slab in the illustration was started 24 metres from the from the main origin of the project – your numbers will be wrong. Move the object so that one node is on the Main Origin. Do the drag-trick again and you will see that the first node listed is 0,0 like it appears in the sample script, above.
63
PART TWO: BEGINNERS' GUIDE TO GDL SCRIPTING
Note also that the XY locations are accurate to a millionth of a metre in ArchiCAD 8 onwards, this becomes million millonths – no kidding! This is a lot of reading for the GDL parser, and if you write creative GDL, you can write in much cleaner numbers. If you set the small snap grid, perhaps to 1 mm or 0.1” and trace out another slab and drag it into the 3D Script, the numbers get shortened. You can also do ‘Instant GDL’ in 2D Try drawing a polygon with the Fill tool. Drag and Drop the result into a 2D Script window – another example of instant GDL! If you include curves in the edges of the fill, you will see extra codes which define the curves – ‘polylines’. In creative GDL you make use of 2D dragging more often than 3D dragging. Fills provides the XY syntax for outlines for EXTRUDE, REVOLVE, SWEEP, TUBE and other more exotic 3D GDL commands.
Writing Prisms from new More frequently, we write prisms in creative GDL with parameters, not by dragging from ArchiCAD’s floor plan.
the prism by returning to the start. If you are working in real dimensions, dragging from ArchiCAD in to GDL will do. In creative GDL you are more likely to be defining prism outlines using parameters. The only way you can do this without losing your way is to sketch it out on paper, and number the nodes. Let’s look at the basic syntax.
About Prism syntax... Prisms come in several forms of which these are the three main ones. MATERIAL slabmat PRISM number of nodes, thickness, X1,Y1,...... Xn,Yn
For a simple prism, you do not include materials or the underscore (state the material before the statement), and you do not even need to close the prism. The default is for it to be a closed solid. By adding an underscore and 15 at the end of each line, you get much the same thing, but with added potential. MATERIAL slabmat PRISM_ number of nodes, thickness, X1,Y1,mask,...... Xn,Yn,mask, X1,Y1,-1
Normally, the value of the masking code is always 15. The power of masking in the underscore version of PRISM is that you can omit faces and lines of the prism and you can curve corners and edges and drill holes through the prism. The curved corners are made using the technique of the ‘Polyline’. It is too early to lead you through all these possibilities now, but you need to know that they are available. CPRISM_ topmat,botmat,sidemat, number of nodes, thickness, X1,Y1,mask,...... Xn,Yn,mask, X1,Y1,-1
Simple A-B based rectangular prism. Left, the origin is at the near left. Right, the origin is at the centre. To illustrate how prisms work, the nodes have been numbered in the order in which they were clicked. In this example, there are 5 points if you include the first point twice – the idea being that you fully close
64
CPRISM_ is what you get when you make ‘instant GDL’ with the Slab tool. This has all the powers of PRISM_ but it also allows you to change the colours of the top, bottom and side faces. These material parameters are included in the statement. You also have the following types of prism which are suitable for later study – check the syntax in the ArchiCAD Help menu: • BPRISM_ is an extension of CPRISM_ but allows you to bend the prism by adding a radius of curvature. It bends downwards, but if you precede it with a mirroring routine (MULZ -1), it will bend upwards. Introduction to Object Making
PART TWO: BEGINNERS' GUIDE TO GDL SCRIPTING
BPRISM_ topmat,botmat,sidemat, number of nodes, thickness, radius, X1,Y1,mask,...... Xn,Yn,mask, X1,Y1,-1 • FPRISM_ and HPRISM_ are extensions of CPRISM_ but allows you to have curved or chamfered top edges (hills) by specifying the angle, height and material of the hill. This is useful for suggesting softness, e.g. upholsery in furniture. However, they create a lot of polygons and lines in 3D view. FPRISM_ is almost obsolete because HPRISM_ does the same but better. HPRISM_ topmat,botmat,sidemat,hillmat, number of nodes, thickness, hillangle,hillheight,hillstatus, X1,Y1,mask,...... Xn,Yn,mask, X1,Y1,-1 The Hill is visible in the illustration – if the hill angle is 0, the hill will be rounded. Hill material and height have to be included. Hill status is 0 or 1 (invisible or visible edges).
BPRISM_ and FPRISM_/HPRISM_ • SPRISM_ is an extension of CPRISM_ but allows you to have a cutting plane taken through the prism. As it is possible and easier to use an actual command CUTPLANE, this version of the Prism is almost never required.
PRISM_ (Prism underscore) and CPRISM_
Clean up the Prism Return to the CPRISM_ we dragged and dropped earlier. If you just want a pure prism, clean away the statements before and after the prism. If you find an ADDZ command like the one in this example, it is a leftover from a previous Slab tool setting, so you can delete that, along with DEL. You are left with a simple CPRISM_ command. Make the material parametric : CPRISM_ slabmat, slabmat, slabmat, 13, 0.1, 0.0, 0.0, 15, 4.28548, 0.0, 15, 4.28548, 0.949196, 15, 5.279549, 0.949196, 15, 5.279549, 2.155116, 15, 3.405484, 2.155116, 15, 3.405484, 3.067704, 15, -0.000425, 3.067704, 15, -0.000425, 2.00845, 15, -2.444858, 2.00845, 15, -2.444858, 0.949196, 15, 0.0, 0.949196, 15, 0.0, 0.0, -1
If you are doing a very simple solid one-color prism, you can remove the ‘c’ and the material definitions to make it simpler. One single material definition is enough for the whole prism. You can use the GDL text editor’s Find and Replace function to remove some of the surplus spaces to make the code look more compact. So you are left with simpler PRISM_ : MATERIAL slabmat Introduction to Object Making
65
PART TWO: BEGINNERS' GUIDE TO GDL SCRIPTING
PRISM_ 13, 0.1, 0.0, 0.0, 15, 4.28548, 0.0,15, 4.28548, 0.949196, 15,
etc, etc, etc In creative GDL, you have to decide how your model is to be written. • Do you have a single prism shape that is not parametric? If so, use the dragging method, but try always to work from the main origin of the project to ensure that at least one node of the prism is zero. • If the shape is parametric, such as a window or door frame, then you should always do a sketch on paper of the prism, number each node in an anti clockwise direction. Then start writing the prism methodically using parameters, or significant dimensions where appropriate. • Remember that Prisms can be anywhere in the XY plane, but must rise vertically from a local zero plane. You will usually have to ADDZ before you make a prism. Have a look in the GDL Reference Manual (by now you should find it a lot easier to browse) and read the section on PRISMs in the chapter dealing with 3D – to make sure you know the syntax.
using A and B as parameters for width and depth with the origin at the near left corner. !Alternative Codes for the Seat frame.... !BLOCK A,B,frsec-0.002 !Simple Prism PRISM 5,frsec-0.002, 0,0, A,0, A,B, 0,B, 0,0
Comma confusion? In some countries, it is common to write decimal points as commas, e.g., 1,25. In other countries it is common to write thousands with commas for example, a million is 1,000,000. If you have a localized ArchiCAD, this is how numbers may appear in the parameters box. But in GDL, the scripts are hard coded so only one convention can be followed. Dots are used to form the decimal point, and commas are used to separate numbers. Many of the errors in your early efforts in creative prism writing with GDL will be with misplaced dots and commas. Pay strict attention to them. Use a monospaced font in scripting, so that you can get all the commas and dots to line up vertically.
6.2 Apply Prisms to the chair seatframe We looked at prisms because we need to reach beyond the limitations of blocks and cylinders. Let’s make the seat frame more realistic. We can make the seat using one prism and drill a hole through it. We are
66
Progress from the simple block to a frame that looks more authentic. The frames can be centred to the legs. We shall drill a hole in the prism. The first requirement is that you have the underscore type, with the masking codes. Keep them all as 15 for the moment. !Same prism with drawing codes PRISM_ 5, frsec-0.002, 0,0, 15, A,0, 15, A,B, 15, 0,B, 15, 0,0, -1
Drilling the hole Introduction to Object Making
PART TWO: BEGINNERS' GUIDE TO GDL SCRIPTING
The way to cut the hole is to write the Prism statement for the outline of the solid, using 15s for masking. When you repeat the first point as the last point, the prism needs to be told that it’s the last point by using a masking code of -1. Continue on with the XY points for the inline of the hole , using 15s again for the masking. Again, you use a -1 to indicate that you have completed the inline. Make sure that that the number of points is written correctly – with the hole, we have gone from 5 points to 5+5, i.e. 10. Let’s make a temporary parameter of ‘ft’ for frame thickness, and give it a value of 30mm or 1.25”. let this be a manufacturer’s parameter, so do not put it in the Parameter Table. !Prism with hole, for frame effect ft=0.03 !Frame thickness PRISM_ 5+5, frsec-0.002, 0,0, 15, !start of outline A,0, 15, A,B, 15, 0,B, 15, 0,0, -1, !end of outline ft, ft, 15, !start of inline A-ft,ft, 15, A-ft,B-ft, 15, ft, B-ft, 15, ft, ft, -1 !end of inline
With this code, you get the chair as in the illustration (centre). We can add a cushion later.
Centre the frame members for more realism! As we have a mission to improve the look of the chair, we need to centre the frame elements to the legs – we didn’t do this before, to keep things simple. Centring it makes more realistic mortice and tenon joints. So using a half-frame width of ‘f2’ we can alternate the outside and inside lines of the prism by ‘f2’ either side of the 0, 0, A, B rectangle. !Prism with frame effect by drilling hole !Improved statement with f2 ft=0.03 f2=ft/2 PRISM_ 5+5, frsec-0.002, -f2, -f2, 15, !Outline Introduction to Object Making
A+f2, A+f2, -f2, -f2, f2, A-f2, A-f2, f2, f2,
-f2, B+f2, B+f2, -f2, f2, f2, B-f2, B-f2, f2,
15, 15, 15, -1, 15, !Hole inline 15, 15, 15, -1
See the right hand illustration on the previous page. It’s a small change, but worth doing for authenticity. Another way to do this would be to keeping the theme of a frame, but build 4 prisms, one for each side of the frame. The benefit of this would be to be able to control the woodgrain in each piece. We will do this later in the book. As in the illustration we have a chair with a frame and nothing in the frame – very uncomfortable! We can now make a prism to fill the empty space, and make it of upholstery on top, with an undersurface, perhaps of the same material as the frame.
Build in the Cushion We can now make a prism to fill the empty space, and make it of upholstery on top, with an undersurface, perhaps of the same material as the frame. So, following on immediately from the frame command, before you DEL back to the origin, build the cushion. Make the angle at 30° and make the hill height 10mm or 3/8”. We make the outline of the cushion the same as the inline for the hole in the frame. ! Chamfered with HPRISM_ HPRISM_ seatmat,framat, seatmat,seatmat, 5,frsec+0.010, 30, 0.01, 1, f2, f2, 15, !Outline A-f2, f2, 15, A-f2,B-f2, 15, f2,B-f2, 15, f2, f2, -1
67
PART TWO: BEGINNERS' GUIDE TO GDL SCRIPTING
You can see how the seat upholstery is chamfered to give a soft look. Let’s try to curve the back now!
6.3 Learn about Circle Geometry and make the chair more comfortable
The chairback is a chord, a slice off the edge of a theoretical circle. If we can work out from the bulge what the sweep angle is, we can work out the radius. From this you can work out the circumferential distance travelled by the back. This is all that you need. The formulae are printed below.
While this chapter is about Prisms, we can profit by looking at the bendy BPRISM_ and applying it to the back of the chair. We would like to curve the back panel to make it more comfortable and authentic. As the width of the chair is ‘A’, we need to make a parameter for the bulge of the chairback ‘bbulg’ and work out a formula based on A to calculate how much curvature to apply to the chairback. Here it is.
Make a new parameter ‘bbulg’ (dimension). First the Master Script is required to do the calculations.
68
Introduction to Object Making
PART TWO: BEGINNERS' GUIDE TO GDL SCRIPTING
!--------Add to Master Script--------!Back bulge Circle calculation formula IF bbulg<=0.01 THEN bbulg=0.01 IF bbulg>=0.08 THEN bbulg=0.08 bangl=(90-ATN((A/2)/bbulg))*2 !Half angle brad=(A/2)/SIN(bangl) !Radius of curve bcirc=2*PI*rad*bangl*360 !Half chord length PARAMETERS bbulg=bbulg
Here we have two idiotproofing lines to protect against extreme values being entered by the user. PARAMETERS reports the corrected dimensions back to the user in case of an error. We must calculate the sweep angle, and it’s easiest to calculate the half angle ‘bangl’ between the edge and the centre. From that we can work out ‘brad’ the radius. Finally, as BPRISM_ is like a flat surface bent into a curve, we need to find out the length of the chord. As BPRISM_ has to be organised around the centre of the chair for it to bend symmetrically, we need only the half length of the chord. So look at the 3D script as it was before, and make the modification.
!Modify 3D Script !Back Legs, panel and upholstery IF bakon THEN MATERIAL framat ADD 0,B,sthit CONE bhit,lsec/2,lsec/3, 90,90 ADDx A CONE bhit,lsec/2,lsec/3, 90,90 DEL 2 !Back panel ADD A/2,B-lsec/3+bbulg,sthit+bhit*0.9 ROTx -90 BPRISM_ framat,framat,framat, 5,lsec/3,brad, -bcirc,0,15, bcirc,0,15, bcirc,bhit*0.6,15, -bcirc,bhit*0.6,15, -bcirc,0,-1 Introduction to Object Making
!Cushion, not chamfered ADDz -lsec/6 BPRISM_ seatmat,framat,seatmat, 5,lsec/6,brad, -bcirc +ft,ft,15, bcirc -ft,ft,15, bcirc -ft,bhit*0.6-ft,15, -bcirc +ft,bhit*0.6-ft,15, -bcirc +ft,ft,-1 DEL 3 !BLOCK A,lsec/2,bhit*0.6 !original Back panel ENDIF !if bakon
In the 3D Script, we built the back legs, as before, but for the back panel, we have to do some 3D manoevres. We use ADD to get to the centre of the chair. Because BPRISM_ curves downwards, we have to get behind the chair and use ROTx so that the Z axis is facing backwards (away from the chair). Play with the script of the chair changing the ROTx from -90 to 90. The height of the prism will be from the topmost part – ‘sthit+bhit*0.9’. Try changing the values to see where the back moves to. We made the half-width of the prism the half-circumference, so that whatever the bulge value, it will always fit perfectly. The back cushion – by adjusting the Z height, we can shift a small distance and issue another BPRISM_ for the upholstery, using soft fabric. DEL 3 takes us right back to the origin. You may wonder why we cannot chamfer the edges of the upholstery on the back as we did for the seat. We cannot have both a curve. You have the choice of BPRISM_ or HPRISM_ so you choose. For me, the curved back takes priority.
Final touch of quality – Update the 2D Script From the previous illustration you can see that the 2D Script has been updated. Let’s do this. We could ‘cave in’ to the easy option and return to a PROJECT2. Since we took the trouble to calculate the circle geometry of the chairback, let’s put that to use. Comment out the two LINE2 commands and try an ARC2 for the back and a single line for the frame. To remind you: ARC2 x, y, r, alpha, beta: draws part of a circle on centrepoint x,y, of radius r, starting with angle alpha and ending at angle beta – moving in an counterclockwise direction.
69
PART TWO: BEGINNERS' GUIDE TO GDL SCRIPTING
HOTARC2 x, y, r, alpha, beta: the same as ARC2 above, but it is a new ArchiCAD 9 command that makes it easier to pick the object up in the floor plan. Now make the modification to the 2D Script. !Put these lines in for the curved back !LINE2 s2,B-s4, A-s2,B-s4 !back !LINE2 s2,B+s4, A-s2,B+s4 !back ARC2A/2,B-brad+bbulg,brad,90-bangl+2,90+bangl-2 !for AC9 addthe lines below !HOTARC2 A/2,B-brad+bbulg,brad, ! 90-bangl+2,90+bangl-2 LINE2 s2,B, A-s2,B !back for AC7,8 !HOTLINE2 s2,B, A-s2,B !add for AC9
We do not have to use ADD2 commands here. We position the arc with an XY coordinate, and the position is at the centre of the back, as with the prism. The sweep angle of the arc can be ‘bangl’ either way. By deducting 2° either way, it looks better in relation to the legs.
• You can shorten the time of building prisms with ‘Instant GDL’ using Drag and Drop. • ‘Instant GDL’ is best built from slabs placed on the main origin. It is best used if prism shape is not going to change much. Otherwise, define the prism with parameters. • A common cause of errors when writing prisms is confusion with commas. • Drilling holes – write the XYs of the hole immediately after the outline XYs. • Soft edge effects can be achieved with HPRISM. • Curved solids can be made with BPRISM. This may require some calculation to get it the correct size and position. • If the object gets too complex, use a PROJECT2. If you can still manage the code, write the 2D with a proper script.
By gradual improvement in the GDL, we have a much more refined product.
Summary of GDL in this section • Prisms are the most useful command in creative GDL – they can be bent, rounded, cut, drilled, chamfered and hollowed out. • You do not need to move the cursor to build prisms, because the XY of each of their nodepoints can be defined. You may only have to lift them into position.
70
Introduction to Object Making
PART TWO: BEGINNERS' GUIDE TO GDL SCRIPTING
CHAPTER 7: LOOKING INTO AUTOSCRIPTED GDL It is valuable to look into the scripts of objects generated without GDL and know how to modify them – to make them slightly parametric.
7.1 Looking into Autoscripted GDL There is a middle road in Object Making Earlier, we practised making objects without GDL. We have now tried making objects with GDL. It may seem to you that the message of this book is that making objects without GDL should make you feel guilty. This is not so! You can make excellent objects without GDL, but you know that you are rejecting the chances of them being parametric. By contrast, if you make objects with GDL, you will feel virtuous – but you may become so enthusiastic about GDL that you try to do all the work yourself. You can suffer from exhaustion putting in the hours, and frustration if the results are not as good as hoped for. However, there is a middle road that you can follow. You can get ArchiCAD to do much of the work for you and then come in at the half way point and add some of the qualities that make the object parametric. You can also make individual components using the ‘Instant GDL’ method, then move them into the GDL script, and use ADD and ROT to position the component. First, let’s look at an object completely made with ArchiCAD’s own tools and saved as an object.
Making objects in the ArchiCAD environment Anybody who uses ArchiCAD eventually has the curiosity to open the 3D script of an object made in the ArchiCAD environment – and has been thoroughly scared. The auto-scripted object contains a mass of complex ‘industrial’ code that is off putting to look at, and unstructured. It is good enough for the GDL interpreter – but it is not for humans to fully understand. By comparison, ‘creative’ GDL that has been composed by a human looks clean and uncluttered – if it is written with parameters, it is capable of extension into something more powerful from just a humble beginning. If you can become familiar with the look and organization of autoscripted code and make use of it in easy steps, it is not as scary as Introduction to Object Making
it first seemed. Remind yourself again how to make objects using ArchiCAD’s own tools by looking at the start of chapter 2. When you look at a script of an autoscripted object, you need to recognise what the bits are. Every element in ArchiCAD’s toolbox has its 2D or 3D equivalent in GDL. You can find out which by laying out elements in the ArchiCAD Floor Plan and dragging them to a GDL Script window. • Walls become XWALL_{2} • Roofs become CSLAB_ • Floors become CPRISM_ • Beams become BEAM • Columns become CPRISM_ • Mesh becomes MASS • Fills and Polylines become POLY2_B{2} • Line becomes LINE2 • Spline lines become SPLINE2A • Texts become TEXT2 • Circles become CIRCLE2 • Hotspots become HOTSPOT2 • Objects, Lamps, Profiler objects, Stairs etc are brought in as Macros and appear in the form of a CALL statement. In the script, every part will have the original ID, and you can compare that with the IDs in the model.
Examine the 3D script of the autoscripted table Open the table that was used as an example in Chapter 2, or make yourself another quick table. We will run through explaining what is contained in the script, and then look at ways of shortening and modifying it. A primary rule of tinkering with autoscripted objects is to move the module of ArchiCAD bits to the Main Origin – perhaps centred over the main, left hand leg, Resave using method 1 (from 3D view),
71
PART TWO: BEGINNERS' GUIDE TO GDL SCRIPTING
making sure that you tick the ‘Editable’ button. Place the object again, now open the GDL and view the scripts.
First thing you can do it to view the table in 3D and paste a nice small square image into the Preview Window. The 3D script starts out with some titling. It’s good to have date and object’s name and author at the start of the script. Do likewise when you write creative scripts. ! Document name: ! ! Name : table_2_iomwac.gsm ! Date : April 2004 ! Version : 8.10 ! Written by ArchiCAD ! MULXA/2.25753262639 MULYB/1.001325786114 MULZZZYZX/ 0.75 ADDX 0.4849148094654 ADDY 0.5064862370491 BODY -1 MODEL SOLID RESOL 36
The three MUL commands enable the object to be stretchy. When it was first made, the table was drawn by eye in the floor plan, so it was approximately 2.25 metres by 1.0 metres, and the height was 0.75 metres. ZZYZX is what GDL denotes for the height. This rather curious name arises from the need to call it something related to Z when ArchiCAD 6.0 came out. But it could not be called Z as many older
72
objects from ArchiCAD 5.0 (and earlier) already used Z for other purposes and might no longer work. The GDL development team chose ‘zzyzx’ after a small town overlooking a dried salt lake in California near Las Vegas, the last town in the US directory of placenames. Because the autoscripted units are accurate to a million millionth of a metre, you get a vast number of trailing decimals. You will wish you had built them with a small snap grid working. Now you can see how stretchiness works in autoscripted objects. If you shrink the table to a A value of 1.8 metres, the MULX command will ‘multiply everything in the X direction by A/2.25753262639 (i.e. 1.8/2.25753262639). This will make it slightly shorter. If you stretch the height to be 1.2 metres, the vertical components will all be multiplied using MULZ by 1.2/0.75. The MULY command works in the same way. Retain (if you want it to be stretchy). If you want the table NOT to be stretchy, delete the 3 MUL commands, and replace the 2D Symbol with a PROJECT2 3,270,2 in the 2D Script. You’ll get ‘bounding box’ hotspots.
The most easily changed parameters are Material and Pen The ADD command is an offset – this is in case you built the object a long distance from the origin of the main floor plan. Some people build their objects hundreds, sometimes thousands of metres from the project origin. If you build very close to the project’s Origin (it must be the main project origin, not a temporary one) then this offset will be very small. As we built this on the origin, you can see that this Introduction to Object Making
PART TWO: BEGINNERS' GUIDE TO GDL SCRIPTING
offset is trying to place the object’s own origin at the bottom left-hand corner. Retain. The BODY -1 command is one that autoscripts always carry. These are a command to the GDL interpreter to ‘ensure the 3D integrity of each object’. They are not necessary in creative GDL until you get into more complex tasks such as the TUBE command. Delete BODY. MODEL SOLID just tells the object to be solid. This is the default condition, so if you did not write it, your model would still be solid even without the command. RESOL 36 tells it that all rounded surfaces are to have 36 polygons to make up a full circle. 36 is the default value for this, so you do not really need this either. Delete MODEL SOLID. GLOB_SCRIPT_TYPE = 3 GLOB_CONTEXT = 3 GLOB_SCALE = 50 GLOB_NORTH_DIR = 90 GLOB_DRAWING_BGD_PEN = 91 GLOB_FRAME_NR = -1 GLOB_EYEPOS_X = -35.85101578994 GLOB_EYEPOS_Y = -7.730174812729 GLOB_EYEPOS_Z = 1.557576862359 GLOB_TARGPOS_X = -30.44915475591 GLOB_TARGPOS_Y = -5.030201323002 GLOB_TARGPOS_Z = 1.5 GLOB_SUN_AZIMUTH = 239.847 GLOB_SUN_ALTITUDE = 11.2981 BODY -1 BODY -1 GLOB_HSTORY_HEIGHT = 0.65
These GLOB items are called Global Variables. They are not doing anything here except recording the conditions that prevailed when the object was made. At the time the table was made the North point was at 90°, there was no animation taking place (Frame number is set to -1), the camera eye and target positions were noted, the drawing scale was 1:50. These are not commands, they are a historical record. You can find out more about Global Variables in Appendix A of the GDL Reference Manual. There are a few more BODYs here. Meanwhile, you can Delete ALL the GLOB s! ...throughout the script. !!Slab-062 PEN
GLOB_LAYER = "Floors" GLOB_ID = "Slab-062" GLOB_INTID = 667 BODY -1 ADDZ 0.6 cPRISM_ "Surface-Whitewash", "Surface-Whitewash", "Surface-Whitewash", 5, 0.1, 0.04300407447266, 0.01376101330492, 15, 1.259910825444, 0.01376101330492, 15, 1.259910825444, -0.02340206237996, 15, 0.04300407447266, -0.02340206237996, 15, 0.04300407447266, 0.01376101330492, -1 DEL 1 BODY -1
This is the first real 3D element in the script. It is obviously the beam under the tabletop as it is only 100 mm deep and is 0.57 metres off the floor. This and the tabletop were made with a Slab tool, and these always translate into a CPRISM_. The syntax for CPRISM_ was explained in chapter 5. The prism is lifted by 0.6 and drawn; then the DEL command returns the cursor to the origin. !!Slab-059 GLOB_ID = "Slab-059" GLOB_INTID = 651 BODY -1 ADDZ 0.7 cPRISM_ "Surface-Whitewash", "Surface-Whitewash", "Surface-Whitewash", 49, 0.05, -0.004326136003042, 0.4919763397133, 15, -0.03992947334826, 0.490650560281, 79, -0.1100340105909, 0.4778922240699, 79, -0.1776092841723, 0.4552868334455, 79, -0.2412796563933, 0.4232945689723, 79, -0.2997489820857, 0.382566700897, 79, -0.35182699439, 0.3339323311641, 79, -0.3964535351562, 0.2783815152915, 79, -0.4327201367068, 0.2170451076949, 79, etc, etc, etc ...
There is too much to list after this.
7
Introduction to Object Making
73
PART TWO: BEGINNERS' GUIDE TO GDL SCRIPTING
This is the tabletop itself. It is obviously the tabletop because the height of the prism is 0.7 metres, the thickness of the prism is 0.05 metres and there are a lot of points (49) because of the curved ends. If we are not sure it’s the tabletop, the GLOB_ID is matched by the ID of the slab it was made from in the settings dialog. The masking values shows you the 15s but they are modified by having 64 added to each of them – 79 (15+64) means that the point is part of a curve and should be treated as smooth by Open GL and the ArchiCAD Rendering engine.
The table can be tuned up – to be parametric If you have the object open, save a copy of it under a new name – ‘Table_02.GSM’ perhaps. As this is a Table, try hitting “Select Subtype” and tell GDL it’s a Table.
!!Slab-061 GLOB_ID = "Slab-061" GLOB_INTID = 655 BODY -1 ADDZ 0.05 cPRISM_ "Surface-Whitewash", "Surface-Whitewash", "Surface-Whitewash", 15, 0.05, -0.02400049266183, 0.3960784971471, 15, -0.036711189204, 0.31606425849, 79, -0.05203414774601, 0.154755338342, 79,
-0.05719819902872, -0.007197412027317, 79, -0.05218296290095, -0.03700823220845, -0.02400049266183, 0.04732645894257,
-0.1691548391012, -0.3304777709065, -0.4128433470601, -0.4128433470601,
79, 79, 15, 15,
etc, etc, etc... These are obviously table feet, judging by their height and depth.
What about the 2D Script? Look at the 2D script – if you used Save Selection As... (method 2) it may well look very complicated, mostly made of LINE2 and POLY2 commands. If you modify the shape or size of the 3D object significantly, you may have to delete the whole 2D script and replace it with a PROJECT2 command and some Hotspots at the corners. The same applies if you saved the 3D View (method 1).
74
Introduction to Object Making
PART TWO: BEGINNERS' GUIDE TO GDL SCRIPTING
Materials and Pen, but note in so doing that GDL has now given you a load of ready made parameter names for some of these – which you can use. It will also give you ones you do not intend to use, perhaps, so click the ‘Hide’ button next to the ‘ArchiFM’ title and all the other parameters will be hidden from the user’s view. New parameters you make will be put at the bottom, annoyingly. Move them up. Selecting the right subtype is more than a way to save you typing. The object will conform with some of the internal routines of ArchiCAD (for example the wall cutting of window or the roof cutting of the skylight). For most objects, the main advantage is that they will show up correctly in Interactive Schedules. The common parameters are the key to group editing and group reporting. For example if you use ‘gs_top_mat’ and ‘gs_leg_mat’ for the top and leg materials, you could select a whole host of different tables (of subtype ‘table’) and update materials in all tables simultaneously. Simplify A and B to exactly 2.25 m and 1.0 m, the dimensions we wanted in the first place when building the eyeballed table. Here, the parameter box is in millimetres. Do not forget to keep strictly to metres when writing anything into the actual script. Make a new parameter ‘tthik’ for tabletop thickness.
Rebuilding the 3D Script Modify the labelling at the top to remind yourself when you altered the object. Retain the first two MUL commands so that the table will remain stretchy, but clean them up with the exact values of A and B. Delete the MULZ command – height can be controlled parametrically. Looking at the curved top, it’s beyond the scope of this chapter to extend the length or width of the table except by stretching. A little more knowledge of GDL, including Polylines, would make this easy, but the experienced GDL author would embark on this table in creative GDL from the start, not spend time adapting a lot of ‘industrial’ code.
Parameters and Subtypes GDL will load standard parameters from a template called table.gsm, and this will save you a lot of typing. Now make new parameters for Introduction to Object Making
75
PART TWO: BEGINNERS' GUIDE TO GDL SCRIPTING
table that you believe it to be. Change the materials at the start of each CPRISM to the parameters you made. ! Name : table_2_iomwac.gsm ! Date : April 2004 ! Version : 8.10 ! Written by ArchiCAD modified for iOMWAC MULX A/2.25753262639 MULY B/1.001325786114 !!Centre Beam PEN gs_cont_pen ADDZ zzyzx-0.1-tthik cPRISM_ botmat, botmat, botmat, 5, 0.1, 0.04, 0.01376101330492, 15, 1.21, 0.01376101330492, 15, 1.21, -0.02340206237996, 15, 0.04, -0.02340206237996, 15, 0.04, 0.01376101330492, -1 DEL 1 !!Tabletop ADDZ zzyzx-tthik cPRISM_ gs_top_mat, botmat, edgmat, 49, tthik, -0.004326136003042, 0.4919763397133, 15, -0.03992947334826, 0.490650560281, 79, -0.1100340105909, 0.4778922240699, 79, -0.1776092841723, 0.4552868334455, 79, -0.2412796563933, 0.4232945689723, 79, -0.2997489820857, 0.382566700897, 79, -0.35182699439, 0.3339323311641, 79, -0.3964535351562, 0.2783815152915, 79, -0.4327201367068, 0.2170451076949, 79, -0.4598885156183, 0.1511717407535, 79, -0.4774056020433, 0.08210240625503, 79, -0.4849147986173, 0.01124315667042, 79,
Delete the ADD offsets, but remember to delete the equivalent offset command in the 2D script – or the symbol and the actual table will not coincide in location. Put in a parametric PEN command, provide a new title for the tabletop, and remove all the redundant GLOBs and BODYs and all later PENs. Now label each part in the 3D script with the part of the
76
etc, etc, etc... For the beam, change the ADDZ command to be the total table height minus the tabletop thickness minus foot height. For the tabletop, change the ADDZ command to be the total table height minus the tabletop thickness. Change the tabletop thickness to the new parameter of ‘tthik’.
Introduction to Object Making
PART TWO: BEGINNERS' GUIDE TO GDL SCRIPTING
Ever mindful of quality, we could put in a Master Script routine like the one below to control the ‘zzyzx’ height of the table – and you could do this for the ‘tthik’ too. The greater than or equals sign (>=) always works better than simple greater than (>), and the same for the smaller than (<). !Modified Table !Master Script IF zzyzx>=1.2 THEN zzyzx=1.2 IF zzyzx<=0.4 THEN zzyzx=0.4 PARAMETERS zzyzx=zzyzx
If you wish, you can also clean up some of the million millionth of a metre decimals to clean rounded dimensions, but here it is only worth doing it in the case of the beam under the tabletop – we can ensure that it centres nicely on the cylindrical legs. As the CPRISM allows you to specify top material, bottom material and side material within the command, replace all that ‘Whitewash’ with your new material parameters. Because we selected the ‘table’ Subtype definition we have ‘gs_top_mat’, and ‘gs_leg_mat’ given to us. We can also put in the other parameter values like ‘botmat’ and ‘edgmat’ etc. Note that in the script they must NOT appear with quote marks – they are material indices, not names. Although it takes a bit more thinking about, you should do the same thing to all the leg parts under the table top. Once you have embarked on this, you have to finish. Think it out and work it through, guessing which parts they all are and how the heights need to be adjusted. Provide a label for each part. Do it all the way to the end of the 3D Script. !!Foot element under leg ADDZ 0.05 cPRISM_ footmat, footmat, footmat, 15, 0.05, -0.02400049266183, 0.3960784971471, -0.036711189204, 0.31606425849, -0.05203414774601, 0.154755338342, -0.05719819902872, -0.007197412027317, -0.05218296290095, -0.1691548391012, -0.03700823220845, -0.3304777709065, -0.02400049266183, -0.4128433470601, 0.04732645894257, -0.4128433470601, 0.05966670786791, -0.330388076719, Introduction to Object Making
15, 79, 79, 79, 79, 79, 15, 15, 79,
0.07424769749459, -0.1642796538628, 0.07867493665818, 0.002408716924311, 0.0729319557382, 0.1690569439548, 0.05704011900087, 0.3350450848787, 0.04732645894257, 0.3960784971471, -0.02400049266183, 0.3960784971471, DEL 1 !!Little circular pad under foot cPRISM_ footmat2, footmat2, footmat2, 39, 0.05, 0.0410091477233, 0.3437969914738, 0.0410091477233, 0.3463603485633, 0.04011890314868, 0.3514091764344, 0.03836546363036, 0.3562267119174, 0.03580210654081, 0.3606665766344, etc, etc, etc.
79, 79, 79, 79, 15, -1
15, 79, 79, 79, 79,
Comments on ‘structure’ in the script – try a Subroutine Notice that in autoscripted work, after each of the 3D commands are done one at a time, the GDL returns the cursor to the origin. It makes this kind of tinkering vastly easier. Whatever you do to one part will not damage the rest. This is ‘structured scripting’ by the brute force method of returning to the origin with every small 3D statement. Some element of grouping or ordering is more logical though. One whole leg element is over the origin, and you could do something smart with the other leg. The idea behind the table is that is is mainly a rectangle of 1.25m (50”) length and 1m (40”) width, but with rounded corners adding 0.5m (20”) to the overall length of the table. The monopod legs are located at the 0, 0 and 1.25, 0 coordinates. If you can identify all the 3D statements which make up the left hand leg, you could put a number label to them, like 100: and a RETURN statement at the end. Delete all the code for the second right-hand leg (see the object on the CD/web). Now try something like this. Repeat the whole of the first leg 1.25m to the right of the first leg as a Subroutine. We explain more about Subroutines in the next chapter. Read ahead then come back. GOSUB 100:!Single leg
77
PART TWO: BEGINNERS' GUIDE TO GDL SCRIPTING
ADDx 1.25 GOSUB 100:!Single leg DEL 1 END:!=======================================
DEL 1 RETURN
Find and Replace, to clean up the script Finally, you could use the Find and Replace command to weed many of those spaces in the original script. Type 3 spaces in the Find field and one space in the Replace field. Place your text cursor at the top of the script, and hit the ‘Replace All’ button. Once should be enough. Your text will be cleaned up nicely.
Add the final touches of quality – the 2D Script This Table could now be used, but there is an extra level of quality we can give it. The object and the symbol may no longer line up, so let’s sort that out. If you are in a hurry, we could do something like this: write a PROJECT2 and type in some hotspots – these should be located at cardinal points at the table, the extreme edges, not at the bounding box points. (see a few pages back). If you maintain the distances apart of the hotspots at A and B in the 2 cardinal directions, the object will be stretchy. Hide the parameters for Pen and Fills in the Parameter Table since you won’t be using them (hit the little X icons). The hotspot routines are not completely satisfactory if the table is stretched greatly – they will distort. You cannot get them accurately on the right hand leg without a lot of coding of the sort that has been written for the second leg centre spot. The way to get them working parametrically is to write the table parametrically with creative GDL! The first hotspot you write is important. When you place the object, it decides the location of the first click of the object’s placement in the floor plan. 100:!Entire Leg and Foot element !!Foot element under leg ADDZ 0.05 cPRISM_ footmat, footmat, footmat, 15, 0.05, -0.02400049266183, 0.3960784971471, 15, -0.036711189204, 0.31606425849, 79, -0.05203414774601, 0.154755338342, 79, -0.05719819902872, -0.007197412027317,79, etc, etc, etc. etc, etc, etc.
78
!Modified Table - 2D Script !Centre spot HOTSPOT2 0,0 !first leg centre spot HOTSPOT2 1.25*A/2.2575 !second leg centre spot !Stretch Edge Spots HOTSPOT2 0, B*0.5 HOTSPOT2 0, -B*0.5 !End spots HOTSPOT2 -0.5, 0 HOTSPOT2 A-0.5, 0 PROJECT2 3,270,1 !Draw 3D table in 2D Introduction to Object Making
PART TWO: BEGINNERS' GUIDE TO GDL SCRIPTING
Make the 2D Symbol opaque or transparent If you wish to improve the quality further, you could put in a proper symbol. Trace over the table in ArchiCAD with a Fill tool, curving the ends. This will give you an opaque symbol instead of a transparent one. Drag it into the 2D Script, and you will get a POLY2_B{2}. Make a new Boolean parameter called ‘vutype’. Keep the PROJECT2 as an option for the user. Make an IF-statement that makes the option active. For the Fill option, put in a MUL2 command which reflects the one in the 3D Script. When the user changes the size of the table, the projected view will be changed so you only need to put the MUL command with the Polygon fill. Put into the POLY2_B{2} statement the standard parameters for the Background and Fill Pens and Fill type, as offered by the Subtype template. Check with the Help menu, or just follow the example given here.
DEL 1 ENDIF
There are lines containing 900 and 4001 status codes which are beyond the scope of this chapter. For the moment, just use the POLY2 as it comes, and change only the Pen parameters.
Cautionary note for modifying objects If you make objects using the Wall tool, and try this method of modification, you need to be more experienced. The CPRISM is really a very friendly command when you get used to it – so it is easy to modify objects made with the Slab tool. The Wall tool generates XWALL commands in the autoscript, and these are more resistant to human intervention. As the Wall tool is frequently used for objects that are captured in side view from 90°, there are some additional ROT commands at the start of the 3D script which are best left untouched. The Roof tool generates statements with the CSLAB_ command which are also comparatively easy to edit because they contain the outline of the shape with XY locations, and add a third value for the Z height of each point. For this sort of GDL-tweaking work with existing objects, the best advice is to use the Slab and Roof tools as much as possible.
7.2 Come back to ‘Instant GDL’ IF vutype=1 THEN PROJECT2 3,270,1 ELSE MUL2 A/2.25753262639, B/1.001325786114 PEN gs_cont_pen FILL gs_fill_type POLY2_B{2} 9, 3, gs_fill_pen, gs_back_pen, 0, 0, 0, -0.004326136003042, 0.4919763397133, 1, 0.01437138894525, -0.005967130246955, 900, 0, 175.6991656132, 4001, -0.004326136003042, -0.5039106002072, 1, 1.308235298525, -0.5039106002072, 1, 1.272110669571, -0.005967130246955, 900, 0, 171.7011905436, 4001, 1.308235298525, 0.4919763397133, 1, -0.004326136003042, 0.4919763397133, -1 Introduction to Object Making
This is the method whereby you make a component in the ArchiCAD plan, then drag and drop it into a script window. Dragging is not advisable for entire objects for which saving objects using methods 1 and 2 are perfectly suited. But it is the ideal way to make single components such as fretwork, curvy shapes, outlines for furniture legs and a hundred other uses. These can be stitched into the structure of your creatively scripted object. It is possible to do the same for 2D objects, such as fills and lines.
Use 2D to help your 3D model Surprisingly, the greatest assistance to creative 3D GDL is the 2D Fill tool. Drag and drop a 2D fill into the 2D Script window. Then copy and paste the 2D fill (which by this time is a POLY2_B{2} command) into the 3D window and convert it to a 3D command.
79
PART TWO: BEGINNERS' GUIDE TO GDL SCRIPTING
A lot of 3D commands involve drawing out a 2D profile and then doing something with it: EXTRUDE extrudes, REVOLVE lathes the section around an axis; SWEEP pulls a profile through 3D space, twisting or rescaling the section as it goes; TUBE also draws a 2D profile through 3D space, allowing it to be twisted and mitred as it goes; PYRAMID pulls the nodes on a 2D profile to one point; RULED takes the points on a 2D profile and allows you to form a 3D solid by repeating the same number of nodes at different heights. These all use the same syntax for XY points as POLY2_B{2}. All of these profiles support the use of Polylines. These are outside the scope of this book. If you use the 2D Fill tool and force lines to be curves, and then copy them to GDL, you will find many lines with 900 and 4001 in them. These define centres and radii of curvature. If you copy and paste these 2D profiles and use them in this way, you don’t entirely have to know how they work. They just do.
Note that if you have tried to use Profiler for lathing, it works around a vertical axis. Here we have to use a horizontal axis.
Try instant GDL with a REVOLVE
Create a New Library Part from the File menu, and position the 2D window to the right of the screen, so that it is next to the project floor plan. Drag and drop the 2D fill into the 2D Script window – do the drag over very fast. You should get something like this:
There is not time to go into all of these, but let’s try one – REVOLVE. Look up REVOLVE in the GDL Reference Manual. This method makes it easy beyond your expectations to make a lathed object. This liberates you from the ‘polecat’ of Profiler. For a lathing operation, you only have to draw a 2D profile in the Positive-Y zone – that means all points above the X axis – and you can revolve it. When you draw the profile, you do it with the continuous Line tool.
80
PEN 1 SET FILL "25 %" POLY2_B{2} 13, 1, 0, 0, 0, 0, 0, 0, 0.3760557831815, 1, 0.06592689450963, 0.3760557831815, 1, 0.1013692707986, 0.258191153049, 1, 0.142621891345, 0.2282009802147, 900, 0, -107.9665730337, 4001, 0.1838745118913, 0.258191153049, 1, 0.6645848017343, -0.6870353976553, 900, 0, -47.59681179421, 4001, 1.038393080352, 0.305337005102, 1, 1.380200507736, 0.163899448943, 1, 1.556751901622, 0.02393520066069, 900, 0, -60.68649776848, 4001, 1.592356841974, 0.2464046900357, -1 HOTSPOT2 0, 0.3760557831815 HOTSPOT2 0.06592689450963, 0.3760557831815 HOTSPOT2 0.1013692707986, 0.258191153049 HOTSPOT2 0.1838745118913, 0.258191153049 Introduction to Object Making
PART TWO: BEGINNERS' GUIDE TO GDL SCRIPTING
HOTSPOT2 1.038393080352, 0.305337005102 HOTSPOT2 1.380200507736, 0.163899448943 HOTSPOT2 1.592356841974, 0.2464046900357
Now, copy only the list of XY points and paste it into the 3D Script, noting that there were 13 lines in the POLY2. When the list is in the 3D Script, leave all the status codes as they are except the last one which is an ArchiCAD error. This should be 1, not -1. Now add the REVOLVE command above the list of points. The word REVOLVE is followed by the number of points (was 13), the angle through which the profile should be revolved (360°) and finally a masking value, which you can assume to be 61. You need to precede the REVOLVE command with a ROTy –90 because the lathed object is turned around the X-axis, and is therefore horizontal. Things which need to stand upright should be rotated minus 90° around Y. PEN 1 MATERIAL 18 !Temporary values for pen & material RESOL 16 ROTy -90 REVOLVE 13,360,61, 0, 0.3760557831815, 1, 0.06592689450963, 0.3760557831815, 1, 0.1013692707986, 0.258191153049, 1, 0.142621891345, 0.2282009802147, 900, 0, -107.9665730337, 4001, 0.1838745118913, 0.258191153049, 1, 0.6645848017343, -0.6870353976553, 900, 0, -47.59681179421, 4001, 1.038393080352, 0.305337005102, 1, 1.380200507736, 0.163899448943, 1, 1.556751901622, 0.02393520066069, 900, 0, -60.68649776848, 4001, 1.592356841974, 0.2464046900357, +1 DEL 1
Introduction to Object Making
Here is the finished pot. Delete the hotspots and all from the 2D Script and replace with a standard PROJECT2 statement.
The Chesspieces are made entirely using this Drag and Revolve technique. Masking codes and Curvature control The key to knowing the masking code here is thus: – 60 will give you a lathed object open at both ends, with pen lines top and bottom. – 61 will give you an open object with pen lines and a flat bottom. – 63 will give you a solid closed object, with pen lines.
81
PART TWO: BEGINNERS' GUIDE TO GDL SCRIPTING
Whatever value you give RESOL here, the vase will look smooth because we are using Open GL rendering. With ArchiCAD’s 3D engine, you will see the polygons. The RESOL command tells GDL that you only want 16 polygonal faces to the shape. You can ruin your model with too many polygons. Multiply these vases by a few hundred and your computer may not have enough memory to render, and you may have an unrealistic number of polygons if you wish to export to DXF/DWG or an external renderer. The benefit of being a GDL user is that you can control the number of polygons with a simple RESOL (or TOLER) command.
Modifying objects made with Add-ons Objects made by certain add-ons can be opened and edited. Let’s consider only those made with Trussmaker and with Profiler. Both are capable of making objects with linear elements, with a variety of sections. Profiler objects are built with a TUBE command which makes them very easy to edit. Trussmaker is very powerful, but the GDL is ‘industrial’ and provides no easy way to modify.
• • • •
the autoscript. But it has been a good means of demonstrating the contents of an autoscript. The easiest things to change into parameters are the names of materials – they can be replaced with variable names. The methods used in this chapter are fine for complete objects. But if you are working at creative GDL and simply want a quick solution, try ‘Instant GDL’ – drag and drop. Many 3D objects use the same syntax as the 2D Fill tool, so you can make interesting 3D objects easily. REVOLVE is a good use of this technique. You may have to learn about object masking. It is important to control the number of polygons in the model – if you are building any objects that are repeated in great numbers you must use GDL to define the number of polygons in each solid.
These curved 3D lattices can be made with Profiler and require only the smallest amount of GDL tweaking to make them 3D. See the GDL Cookbook for a thorough explanation.
Summary of GDL in this section • The table example is so simple that you may feel that, by now, you are quite capable of scripting this in native GDL without needing
82
Introduction to Object Making
PART TWO: BEGINNERS' GUIDE TO GDL SCRIPTING
CHAPTER 8: BUILD ON THE POWER OF GDL As a GDL script gets more complex, you have to find ways to store frequently used routines. Subroutines and Macros are the answer. Open GL forces us to improve the appearance of objects – textures must be handled better. “If you want a golden rule that will fit everything, this is it: Have nothing in your houses that you do not know to be useful or believe to be beautiful.” William Morris.
8.1 Subroutines Subroutines are pieces of GDL code that we want to repeat. Even if we only want to use them once, we can package the code into a discrete bundle. We store subroutines at the end of the script, after the END statement, and give them a label number – just like a piece of luggage. We must never allow the script to run accidentally into the subroutines – they must only happen when required. Subroutines are at the heart of complex GDL scripting. Subroutines can be used in all the scripts except the Master Script (in which case if you used the END statement, the entire object would obey!)
Subroutines are used to avoid repetitive typing You can take a piece of text that will have to be repeated frequently, give it a number, and then perform the subroutine with a GOSUB command. In the case of our basic GDL chair earlier on, if your chair has an elaborate leg that takes a many lines to describe and you have four legs to do, you would not want to type that all out again, nor even copy and paste the leg four times. You could write a routine for all the legs thus: 100:!All the legs GOSUB 110:!One leg ADDX A GOSUB 110:!One leg ADDY B GOSUB 110:!One leg ADDX -A GOSUB 110:!One leg DEL 3
Subroutines are used to give structure to a long script The main script can consist of a number of GOSUB commands to a series of subroutines that build elements of the model. These are logically based on your 3D analysis. Introduction to Object Making
!Chair GOSUB 100:!All the Legs GOSUB 200:!Draw the Seat GOSUB 300:!Build the Back END !----------------------------100:!All the legs GOSUB 110:!One single leg ADDx A GOSUB 110:!One single leg ADDy B GOSUB 110:!One single leg ADDx -A GOSUB 110:!One single leg DEL 3 RETURN 110:!One single leg CONE sthit, lsec/3,lsec/2, 90,90 RETURN
In this case, you could refer to the first part of the script as the ‘executive script’, with most of the actual work being done by the subroutines that follow the END command. Subroutines can be hierarchical, and can be moved or rotated like objects (see the ROTx command for the window below). This is moving towards what we mean when we talk about ‘object oriented’ programming. We make every part of the model a discrete package that can be identified and made to perform or locate itself according to rules. In a human figure, the entire Arm object (which hinged at the shoulder) could GOSUB a subroutine for the Forearm (hinging at the elbow), and that could GOSUB the Hand (hinging at the wrist), and the hand could GOSUB each of the Fingers (each of which is correctly sized and hinging according to the rules). As the Fingernails are largely the same (with minor variations on size), each finger would
83
PART TWO: BEGINNERS' GUIDE TO GDL SCRIPTING
call the same fingernail subroutine, passing it a different value for length and width. Look at your object for every opportunity to make use of repetition – and if they do not repeat exactly, they may be close enough to repeat with minor variations, using this concept of hierarchy. Subroutines must have number labels and this helps with organisation. For example, in a cabinet design, everything to do with the cabinet itself can be numbered 100, 110, 120 etc. The drawer parts can all be numbered in the 200 family, e.g. 200, 210, 220 etc. Graphical hotspots can all start from 1000, and be numbered 1000, 1010, 1020 etc. Thus you can find everything easily. You do not have to write colons after the label number except when they are actually a label. However, it’s a good discipline to provide a comment with every subroutine, so I usually write the subroutine first line (as in the example above) then copy and paste the line to the place where it will be used with the GOSUB command – so the comment is the same as the subroutine title.
In this case the drawers can be in subroutines which get told their width, depth and height. Graphical hotspots which open and shut the drawers can also be put into subroutines.
Subroutines work well with flow control Subroutines have numbers that can be dynamically addressed. For example, you may have defined a flag, like ‘ws’ for window shape, to be valued 0, 1 or 2, as a result of a ValueList. Now, in the 3D Script,
84
you can issue a GOSUB command that includes the flag in the line number. For example: !Window object ROTx -90 GOSUB 100+ws !Window DEL 1 END:!----------------------------------100:!Rectangular window ........... RETURN 101:!Round topped window ........... RETURN 102:!Gothic window ........... RETURN
Subroutines help with error checking and maintenance When an object’s script gets extremely complex, it could resemble spaghetti. Quite simply, it can get to the point where you can no longer understand what you wrote only a short while ago. If you are a member of a team, or writing objects that will be maintained by others at a later date, the numbering of logical blocks of the script into subroutines is essential. When an error is occuring you can see where the error is, and go directly to the subroutine that covers that particular part of the object. As a project grows, subroutines can become standardised and can be copied and pasted into several objects. A range of furniture might share a common set of leg or door designs. A limitation is that only one person can edit a GDL object at a time, and when GDL gets to the level of commercial manufacturing – kitchens or doors – something even more powerful is required : macros.
Golden Rules for Subroutines Let’s summarize some easy-to-remember ‘must-do’ rules. The subroutines must all be written after the END command. Subroutines must start with a number label (followed by a colon and a comment), and must be closed with the command RETURN. Subroutines may call other subroutines (but not themself). Introduction to Object Making
PART TWO: BEGINNERS' GUIDE TO GDL SCRIPTING
In cursor movement, subroutines must be self contained; the number of DELs must exactly equal the number of cursor movements. Execution of the any script must never run accidentally into a subroutine – GOSUB must be the only entry ticket. You must avoid the risk of running from one subroutine to another by forgetting to close it with the RETURN.
8.2 Macros Macros are separate small GDL files which can be somewhere in your library and can be called in, like a subroutine, but exist outside the object you are currently writing. These are essential in manufacturing, for example kitchen and door design – they are much more powerful than subroutines. If you look at the kitchens or doors in the ArchiCAD library you will realise that if every kitchen unit had to carry identical subroutines for taps and inserted sinks, there would be an impossible maintenance problem. Everytime you updated the range of taps, you would have to open every kitchen cabinet and update the tap subroutine. Think about doors. There are a huge variety of doors and a huge variety of door ironmongery items, and the permutations of both become uncountable – all of which can fit into a door frame 900x2100mm. What happens when the range of doors needs to be updated? The mind boggles at the workload. The solution is to be found by making the primary GDL object a user interface with the main parameters offered to the user, much of it in the form of popdown or pictorial menus. A door object will do nothing much more in real GDL terms than cut the hole in the wall – the WALLHOLE command. It will then use the CALL command to call in a suitable door frame, call in architraves if they are required, call in a door (from a library of door types), call in the handle. Macros can be hierarchical – so the frame can call the architrave, the door can call the handle, the door can call the glazed panel. In each case information is passed down the chain to the macros, for example how big to be, and which material to use. If you do not pass information to the macro, it comes in using the parameters with which it was saved. Introduction to Object Making
Macros can be placed in the plan like any other object – or if the author wishes, they can be made ‘unplaceable’ using the little checkbox in the GDL dialog.
Subroutines versus Macros Ordinary GDL writers do not like macros because the main object is no longer self contained – especially if they are solo authors. If the macros get mislaid (not in loaded libraries) the object has chunks missing, or there is an outbreak of annoying error messages. If you propose to create objects for sale, you are advised to store all your subsidiary pieces of code in subroutines so that the object is singular and portable. Conversely, manufacturers love macros. Macros work better for teamwork where people can contribute parts to the overall project. Components like doors, handles, taps can be maintained independently. The manufacturer can build up a portfolio of parts. As long as naming conventions, and other rules (such as the naming of parameters, location of origins) are followed rigorously, the quality of the objects can be upgraded over time without requiring a major rewrite of the whole object. Objects can be specified from databases. If unauthorised use is made of the main object, they will not work because the macros will be missing.
Simple example of Macros As a simple example, let’s join together the sanitary fittings we made back in chapter 3. This could be another ‘MultiObject’. The Macros must have names without spaces (use ‘underscore’ if you like), and be in the loaded library.
!Bathroom fitting !Parameter Script
85
PART TWO: BEGINNERS' GUIDE TO GDL SCRIPTING
VALUES 'bthrm_part' 'Bidet','WC','WHB', 'Bath' !Bathroom fitting !2D Script !Macro Call using default values IF bthrm_part='Bidet' THEN CALL ‘bthrm_bidet’ IF bthrm_part='WC' THEN CALL ‘bthrm_WC’ IF bthrm_part='WHB' THEN CALL ‘bthrm_bath’ !Macro Call sending information IF bthrm_part='WHB' THEN CALL bthrm_WHB PARAMETERS A=0.45,B=0.35 ENDIF
The Chessboard has comparatively simple GDL (a FOR NEXT Loop) to form the squares. The board can be used on its own. A more interesting possibility is that the board might contain the starting layout, and a number of famous endgame positions and lay the pieces out itself. It could contain the pattern for these patterns in a dataset and summon up each chesspiece as a Macro, repeatedly placing it in the appropriate location, and specifying with the PARAMETERS command which rank and which colour it is to be. Theoretically, you could extend this to include higher levels of intelligence, e.g. getting it to play during animations.
If you set the Subtype to ‘drawing symbol’, you will not be asked for a ‘zzyzx’ value. If the objects have been saved with the correct A and B values, there is no need to specify further information – they will come in the correct size. In the case of the WHB, we can send it the correct sizes. In this case, it would be difficult to make the final object stretchy as they all have different A and B. Also, in listings, you would get 4 of the same object in one room whereas you might be better to keep them separate – but it is a fast drawing aid. Your choice.
Complex example of Macros
Another simple example would be this chess set. The chesspiece is a single GDL object that contains Subroutines, one for each ranked piece in the set – the user chooses from a popdown menu.
86
This Norwegian window looks domestic – but don’t be fooled into thinking it’s easy to write. Windows (and doors) are surprisingly difficult to write – perhaps the most difficult of all GDL objects. This window has a complex hierarchy, whereby the primary window object has most of its code devoted to the user interface – to finding out what the user wants. The window cuts the hole in the wall. It then calls the frame. The frame calls the sill, head and jambs. The window works out whether it needs transoms or posts, and calls them. From the user dialog, the window has to call the right number of casement or beading assemblies, and then position and size them correctly. It has to know everything about the wall – the thickness, how deep the window is set in the opening, the materials either side. There are so many permutations of casements and opening styles that the script for the User Interface script is more complex than for the Window itself. It is fully in Norwegian and in English. The ‘variables Introduction to Object Making
PART TWO: BEGINNERS' GUIDE TO GDL SCRIPTING
method’ for making ValueLists ensures that the language can easily be changed. Wood is to Norwegians what leather is to Argentinians or wine to the French. It has to be just right. Every small piece of wood has to have the correct texture direction, every mitred joint has to look authentic. The texture direction is calculated by every piece of timber – every macro containing a tiny piece of beading knows which way to push the woodgrain.
8.3 Textures – the big secret revealed It is not clear why directional texture mapping has been ArchiCAD’s best kept secret for so long. But it is not secret now – let’s open the box! Open GL has changed everything – you must get textures right – your mistakes with wood textures will glare at you from every 3D view. Anything that is new should be written with correct textures. Let’s provide you with an easy technique for getting them right here.
Keep your texture-making horizontal It’s important when making your own textures in ArchiCAD’s Options menu that you make them horizontal. Almost all bitmaps of textures already in ArchiCAD are horizontal in orientation – brickwork, timber. Any new ones that you make should respect this rule.
The secret partially revealed
You can see all the macros sitting in a tidy little heap in the distance, the architraves, grilles, casement, even the glass. Even in the 2D, the window uses macros, the same section outlines that are used to draw the 3D timbers. The window is scale sensitive – if the drawing is 1/50 this is how it will draw. It has other 2D outlines for when the drawing is 1/100, or 1/20. This is essential in good GDL or the object will just be a dense mass of ink if the 2D symbol has too much detail at 1/100.
The following routine is an complicated little piece of code that harks back to the early days of GDL. What it does is to ensure that a texture will go sideways, squirting the texture like toothpaste along the X-axis. There’s no space to explain it here in depth, you can consult the GDL Cookbook for that. The VERT commands define where the texture starts from and its direction, the COOR decides how the textures are to be coordinated (in this case it is ‘cubic’) and the BODY -1 actually wraps up the object with the texture included. Just use it in your work and you will get textures right. Let’s write it as a subroutine, copy and paste it to everything you do that uses textures and you will be a happy GDL writer! 999:!Texture Horizontal along X BASE VERT 0,0,0 !origin VERT 1,0,0 !X VERT 0,1,0 !Y VERT 0,0,1 !Z COOR 258,-1,-2,-3,-4 BODY -1 RETURN
Earlier in this chapter, it was said that you could use a subroutine like an object – swivel it, relocate it. Well this ‘toothpaste tube’ can be Introduction to Object Making
87
PART TWO: BEGINNERS' GUIDE TO GDL SCRIPTING
pointed and squirted. After you have written an object, you rotate as required, issue the texture GOSUB command, and it will be done. BLOCK A,B,zzyzx ROTy -90:GOSUB 999:DEL 1 !Texture vertical Above you can see an example of combining several statements on one line – separated only by a humble colon.
Let’s look at the chair Let’s suppose that the whole of the seat frame that we did earlier was now in subroutine 200. Revisit the chair if you need to.
A+f2, -f2, 15, A+f2, B+f2, 15, -f2, B+f2, 15, -f2, -f2, -1, f2, f2, 15, A-f2, f2, 15, A-f2, B-f2, 15, f2, B-f2, 15, f2, f2, -1 !Seatcushion !Chamfered with HPRISM_ HPRISM_ seatmat,framat,seatmat,seatmat, 5,frsec+0.010, 30,0.01,1, f2, f2, 15, A-f2, f2, 15, A-f2,B-f2, 15, f2,B-f2, 15, f2, f2, -1 DEL 1 RETURN
This worked in 3D form, but the texture would be the same on the side seat frames and on the front and back seat frames. Use the 999 subroutine that was printed earlier, and do 4 separate frames – these always come after the 3D statement.
Left, the chair without texture control in the woodgrain. Right, with textures working correctly. 200:!The Seat and upholstery ADDz sthit-frsec !Improved Mortice and tenon ft=0.03 f2=ft/2 PRISM_ 5+5, frsec-0.002, -f2, -f2, 15,
88
Introduction to Object Making
PART TWO: BEGINNERS' GUIDE TO GDL SCRIPTING
Everything here is getting the texture right – leg braces, arms, legs, seat frames. We cannot change pen lines at joints between cones. You need REVOLVE to control pen lines. !Chair with frame and textures 200:!The Seat and upholstery ADDz sthit-frsec !Do four prisms for seatframe ft=0.03 f2=ft/2 GOSUB 210:!Front to Back frame ADDx A GOSUB 210:!Front to Back frame DEL 1 GOSUB 220:!Left to Right frame ADDy B GOSUB 220:!Left to Right frame DEL 1 !Seatcushion HPRISM_ seatmat,framat,seatmat,seatmat, 5,frsec+0.010, 30,0.01,1, f2, f2, 15, A-f2, f2, 15, A-f2,B-f2, 15, f2,B-f2, 15, f2, f2, -1 GOSUB 999:!Paint Texture DEL 1 RETURN 210:!Front to Back frame PRISM 5,frsec-0.002, -f2,0, f2,0, f2,B, -f2,B, -f2,0 ROTz 90 GOSUB 999:!Paint Texture DEL 1 RETURN 220:!Left to Right frame PRISM 5,frsec-0.002, -f2,-f2, A-f2,-f2, Introduction to Object Making
A-f2, f2, -f2, f2, -f2,-f2 GOSUB 999:!Paint Texture RETURN
Look at the rest of the script in the object Space does not permit us to print the whole of the chair 3D script converted to subroutines with texture mapping, but you can look at the object off the CD or website and it will become quite clear to you.
You could do Texture mapping with a Macro As this subroutine does not require parameters, the texture routine can also be a Macro, a tiny 7 line text file that can be called. In my library, I call it ‘Paint_it.GDL’ a simple file written in NotePad or SimpleText, and stored in the Library. Simply, the command CALL ‘Paint_it’ is enough. In fact, as there are no parameters, you can just write Paint_it on its own, and it works. Type this into Notepad or SimpleText and save it into your library. !Paint_it.GDL BASE VERT 0,0,0 !origin VERT 1,0,0 !X VERT 0,1,0 !Y VERT 0,0,1 !Z COOR 2+256,-1,-2,-3,-4 BODY -1
More things to note on textures If you wish for spherical or cylindrical, or skewed texture effects, these are all possible, but you will need more study of GDL – you either modify the VERT statement, or you have to change the texture wrapping mode, or do both. If you are modifying existing library objects, especially autoscripted objects, you are welcome to copy and use the subroutine 999 in this chapter. Be sure to remove all the BODY -1 commands in the main script. These are now issued by the texture subroutine and if you have a BODY -1 coming before the subroutine, its effect will be cancelled.
89
PART TWO: BEGINNERS' GUIDE TO GDL SCRIPTING
Sadly... if you use Binary objects or Solid Geometry Commands (SGC) in GDL (see ch. 11), you may not be able to use this method of texture control.
Summary of GDL in this section • • • • • • • •
Subroutines avoid repetitive typing. Subroutines give structure to a long script. Subroutines work well with flow control. Subroutines help with error checking and maintenance. Subroutines: Observe the Golden Rules! Macros: small files in a loaded library. Macros: good for manufacturers, not good for singular objects. Textures: it is essential to get them right now that Open GL shows texture so clearly in 3D. • Textures: it is easy to get them right with a simple subroutine.
90
Introduction to Object Making
PART TWO: BEGINNERS' GUIDE TO GDL SCRIPTING
CHAPTER 9: BILLBOARD OBJECTS Sometimes, it is better not to model objects at all – they will either be too complex, or too wooden in appearance. Picturereality is the answer. Billboard objects are a way of using digital photography to give the appearance of solid form – as long as the objects face the camera! “While we all would prefer detailed and attractive 3D objects, an efficient visualization model uses photographic ‘billboards’ depicting foliage and figures to improve realism and reduce polygon count. It remains impractical and time-consuming to sculpt the nuances of organic matter such as clothing and leaves. Carefully selected photos applied to upright invisible panels serve to add dynamic action that existing 3D objects cannot provide. You’ll be astonished at how well picture objects work in all conditions.” Dwight Atkinson, Vancouver, author of Illustration in ArchiCAD 2002.
9.1 Billboard Objects – use picturereality! There are times when you recognise that an object may be too complex to do, even in GDL – either it will take too long, or will just look too ‘wooden’ for the purpose. People and trees are prime examples of this problem. It’s easier to attach a good photograph to a surface to simulate 3D reality than to build the entire object. Some artists advocate adding the people and trees and backgrounds with Photoshop later. This argument may apply for static photoreal images, but for flythroughs, and for timesaving on static views, there is a good case to use Billboard objects, surfaces with phototextures in 3D views. There are several ways to do these, and several pitfalls to get over. Third party Add-ons like ArchiPaint and ArchiFacade will make billboard objects for you, and the trees in ArchiTerra are also prime demonstrations of the art – the tree objects are accurate standup cutouts of the tree with a texture map matching precisely to the cutout shape. There are two types of object in this category: Picture based billboards which use the Alpha channel in the colour image on a rectangular shape; and Cutout based billboards which have a texture applied to them, fitting the cutout accurately. Open GL has made a big difference to the status of billboard objects – previously Picture based ones spent most of their life looking like large grey rectangles until photorendered, and Cutouts just looked like... grey cutouts – so people didn’t like using them. Now, they look good most of the time! It is possible with advanced GDL to animate the cutouts and the phototexture on them to simulate motion, RPC style. Introduction to Object Making
Piranesi and Artlantis (third party renderers for ArchiCAD) work well with cutouts, or you can use their own library of billboard objects for people and trees. But they are not your people and your signs, and you may want to do your renderings in ArchiCAD. The new Lightworks renderer will encourage people to use ArchiCAD for renderings and save you the worry about the wrinkles of exporting to third party renderers.
Existing Billboard objects There are two objects in the existing ArchiCAD Library, the Carpet and the Picture. The Carpet is a horizontal stretchy rectangle, and the Picture is a vertical stretchy rectangle with a fixed back panel, and options for a picture frame. We can write an adapted version of the Picture later in the chapter which enables you to have your own people and trees in a model.
91
PART TWO: BEGINNERS' GUIDE TO GDL SCRIPTING
oblivion). Save this cropped image into a loaded library and reload libraries. If you haven’t got a ‘straight-on’ view of your subject, you will first have to use Photoshop’s Edit>Free Transform>Perspective and Distort to adjust and straighten the image.
Here you see the ArchiCAD Carpet and Picture objects. To the left we see the Picture object adapted to allow a silhouette effect with alpha channels, and no back panel. You can also see two ‘Icepeople’, another good way of populating scenes. Anybody who has played computer games knows that the urban environments are mostly very simple in 3D but are made complex by having photographs mapped onto simple block shapes – and trees are usually planar cutout objects. Let’s look at three techniques for making our own objects, the Cutout Billboard, the Picture Billboard, and combination of the two. This chapter includes instructions on making the Alpha channel.
9.2 Make your own Billboards as accurate Cutouts You can make your own cutout shapes easily with the Slab tool, and if you also make a new Material with a Texture which is the correct size, you can make the two fit each other. We will do this as an exercise. Using Photoshop or a similar editor, crop carefully around the image, leaving only one pixel at most around the person, tree or car. You do NOT need to remove the background (when you make the cutout, any texture that does not rest on the cutout just disappears into
92
We use an image of Matthew Lohden, a prime contributor to ArchiCAD-Talk and to ArchiCAD University events. Now you can place it as a ‘Figure’ into the ground plan. Without losing the proportions, resize it till it’s the correct size. In this case, it’s 590mm x 1800mm (2 ft x 6 ft). From the Options > Attribute Settings >Materials in ArchiCAD make a new material. Take a material like “Whitewash”, hit the Duplicate button, rename the duplicate – in this case I called it “matthew_cutout”. Use the Texture button to bring in the Figure. Set the size of the Figure used for the texture to the same as the one in the plan – 590mm x 1800mm.
Introduction to Object Making
PART TWO: BEGINNERS' GUIDE TO GDL SCRIPTING
Now, back in the plan, select the Slab tool, set it to 10mm (3.8”) high and trace closely around the image – as in the illustration. Trace another rectangular slab over the cropped image. Set the material of both slabs to be “matthew_cutout”. Initially, you will find the texture will be starting from a random position, but at least you have the comfort of knowing it’s the right size – in fact it’s coming from the main origin of the project, a long way away. We need to use Align Texture to get this starting from the bottom left corner. Open GL is a great help here because you get instant display to changes of the texture alignment in the 3D View.
If your cutout fitted the Figure closely (to within one pixel) the 3D Script will have been written so that the bottom left corner is the origin of the new object. So if you set the texture to the bottom left, you will get a perfect alignment. If the Align Texture routine worked, 3D Script will end with:
Select both your slabs and view in 3D Axonometric. Use Edit>Align Texture>Set Origin and place the Origin at the bottom left corner of the rectangular slab. Now, try to set the direction, so use Edit>Align Texture>Set Direction to go from a point on the cutout slab in a horizontal direction (use shift key for constraint to go rightwards) – if it offers you a choice of graphical or numerical, set the angle numerically, to 0°. Select your cutout, view it in 3D Elevation view from 90° and save as an Object, Editable. Place it in the floor plan.
Introduction to Object Making
! The CPRISM will end, something like this..... -35.36420271267, 12.94639198852, 15, -35.35731157426, 12.90504515807, 15, -35.30677655926, 12.88720216694, -1 BASE VERT -35.45259415915, 12.88720216694, -0.0004516888204097 VERT -33.64050165154, 12.88720216694, -0.0004516888204097 VERT -35.45259415915, 13.53348955012, -0.0004516888204097 VERT -35.45259415915, 12.88720216694, 0.009096622359181 COOR 8468, -1, -2, -3, -4 DEL 1 BODY -1
If you have a problem with Align Texture, just save the object. Open the 3D Script and have a look.... ! The CPRISM will end, something like this..... -35.36420271267, 12.94639198852, 15, -35.35731157426, 12.90504515807, 15, -35.30677655926, 12.88720216694, -1
93
PART TWO: BEGINNERS' GUIDE TO GDL SCRIPTING
DEL 1 BODY -1
Just change this ending with a texture routine as follows: ! The CPRISM will end, something like this..... -35.36420271267, 12.94639198852, 15, -35.35731157426, 12.90504515807, 15, -35.30677655926, 12.88720216694, -1 DEL top ROTz 180 ROTx 90 BASE VERT 0,0,0 VERT 1,0,0 VERT 0,1,0 VERT 0,0,1 COOR 258,-1,-2,-3,-4 BODY -1
Now, the Open GL view works with the Cutout perfectly – with the Picture based billboard it betrays a telltale rectangle, and does not use transparency. In the Photorender, the shadows work, but not in the same way.
You can use Ice figures Cutouts can be used without any texture. People often look better in renderings as cutouts using ‘Ice’ or ‘Water’ than using realistic textures. If you start with accurate textures you have to continue. Ice Cutout figures work in ArchiCAD and external renderers, require less effort to make and do not distract from the architecture.
You can use a Rectangular Cutout This sounds like a contradiction in terms. It means that you can use the technology of a texture-based material mapped on to a surface, but use it on a rectangle instead of laboriously cutting out the shape with a slab. In 3D view, this will still be a rectangle, but if it uses an alpha channelled texture, it will cast shadows when photorendered. We will do this later in this chapter.
94
This illustration shows the comparison, left, an Open GL 3D View, and right, a Photorender with shadows, and below, the Plan, with the original slab and the billboards. Starting from the left, you have the author in a Cutout, Matthew in a rectangular cutout (casting shadows), then in a Picture object (casting a rectangular shadow), then two versions of the Cutout object both casting shadows.
Build in the Texture and Material It is possible to build in the texture and material so that you do not need to make the material in ArchiCAD each time. Make the object with the material set to something unimportant like ‘Whitewash’. Now you can use this easy script – copy and paste it into the Master Script of the object each time with minor modifications. It’s beyond the scope of the book to fully explain it, but you are welcome to use it. !Texture and Material routine !Write in the name of the Texture file and !its dimensions in metres DEFINE TEXTURE ‘biltexture’ ‘mathew_cutout.jpg’, 0.590,1.80, 1,0 Introduction to Object Making
PART TWO: BEGINNERS' GUIDE TO GDL SCRIPTING
DEFINE MATERIAL ‘bilmat’ 24, 1, 1, 1, 0, 61, IND(TEXTURE,’biltexture’)
Now go to the 3D Script and change the three materials of the CPRISM to ‘biltexture’, in quote marks. You must also insert a PROJECT2 3,270,2 into the 2D Script. The object will now be completely portable, and you will not need to make a new material in ArchiCAD.
9.3 Make your own Billboards using the Alpha Channel with PICTURE Billboard objects using the PICTURE command are actually GDL rectangles with a picture mapped on to them – for example the ‘carpet’ and the ‘picture’ in the ArchiCAD Library. They only become ‘outlined’ objects by virtue of the alpha channels in the bitmap file and only show correctly in photorenderings. In 3D views they remain as rectangles, and cast rectangular shadows. You do not need to make a Material and Texture definition – but you require a quick tutorial in Adobe Photoshop.
A quick run around Photoshop Adobe Photoshop is an incredibly valuable ‘companion’ to ArchiCAD users, and if you do not have it, see if the other bitmap editing software you have can support channels. The Alpha channel is a part of 32 bit colour – whereby 24 bits are taken up with three visible channels of Red, Green and Blue (8 bits each). The remaining 8 bits are available for ‘interesting things’ like transparency, special reflection effects, bump mapping etc. and we call this the Alpha Channel. This tutorial works for Photoshop 3, 4, 5, 6 or 7. Bitmap files with an Alpha channel must be rich in data, which means saving them as a .TIF format without compression. If you try to save one of these as a .JPG, the first thing that is omitted to achieve compression is the alpha channel. Material definitions in ArchiCAD allows you to use all of these special effects. The PICTURE command in GDL allows you to use the Alpha channel for transparency. The picture you wish to use must be saved in a loaded library (and then reload). Introduction to Object Making
Let’s make the Alpha channel. In Photoshop, surround Matthew carefully with the polygon-lasso. From the Select menu, Inverse, and delete (the backgound will be erased). Re-Crop the picture closely to the edges of the image, but do this: leave at least ONE white pixel all around the edges. Now use the Magic wand to pick up the white background. The whole white area should be shimmering.
95
PART TWO: BEGINNERS' GUIDE TO GDL SCRIPTING
It’s time to make the Picture billboard object If you simply apply a ROTx 90 in the 3D script of a copy of the ‘Carpet.gsm’ and replace the 2D with LINE2 0,0,A,0, you have a splendid upright billboard object. Better still, you can use this nice clean script.
Now hit the Select menu>Inverse, and the lasso will now be surrounding the image. Now Save that selection from the Select menu – the job is done, the Alpha channel is now created. You can see it in the illustration, added to the list of channels, under the Red, Green and Blue.
!!Billboard.gsm !!2D Script PEN cont_pen HOTSPOT2 0,0 HOTSPOT2 A,0 HOTSPOT2 A/2,0 CIRCLE2 0,0,A/100 CIRCLE2 A,0,A/100 CIRCLE2 A/2,0,A/100 LINE2 0,0,A,0 !AC8 and earlier !AC9 - use HOTLINE2 0,0,A,0
Billboard parameters, 3D view and 2D symbol. Save the bitmap file as a .TIF, into a loaded library and reload.
96
!!Billboard.gsm - 3D Script PEN cont_pen Introduction to Object Making
PART TWO: BEGINNERS' GUIDE TO GDL SCRIPTING
IF gs_shadow THEN SHADOW ON MATERIAL matl ROTx 90 PICTURE picture_file,A,zzyzx,mask DEL 1 HOTSPOT 0,0,0,1 HOTSPOT A,0,0,2 HOTSPOT A,0,zzyzx,3 HOTSPOT 0,0,zzyzx,4 HOTSPOT A/2,0,zzyzx/2,5
This is an ultra simple version of a Picture billboard object, and it’s possible to build in smarter features – for example the ability to turn to face the cameras. See the GDL Cookbook for a more extensive discussion of Billboard objects.
9.4 Rectangular ‘cutout’ – the combination object This is not really cutting out, it’s a rectangle that uses the technology of the Cutout object. This is the principle of mapping a texture to a surface with a texture definition, and using a routine to lock the texture to the bottom left corner. It can have an interface like the Picture object – where the user is asked for the name of the picture file – but it produces a stretchy rectangle that will cast shadows correctly.
A note on Shadows Alpha channel based material textures, if applied to ArchiCAD elements or objects will cast shadows correctly cut around the outline of the alpha channel. Picture based objects will cast only rectangular shadows in the ArchiCAD rendering engine, but cast shadows correctly in the Lightworks rebndering engine. To be sure of the best results, go to Image>Photorendering Effects> Options, ‘use transparency in shadow calculation’. f you want to cast perfect shadows, the Cutout billboard is the way to get the best result in both renders and 3D views – if you are prepared to make a material for each one. Open GL and the 3D view do not use transparency in the Picture object. If you want to control shadow casting, make a Boolean parameter ‘shad’ and start the 3D Script with the line: IF shad THEN SHADOW ON ELSE SHADOW OFF
A compromise of the two types is that you can save yourself all that tracing around objects in ArchiCAD and use a rectangular cutout (ie a thin upstanding wall) and apply a texture to it which uses alpha channels. This will look like a rectangle in 3D but look OK in Photorender, and will cast shadows correctly.
In its use (parameters and stretchiness) this is indistinguishable from the Picture object – but it’s better. We need to adapt the Master Script from the Cutout object. !Billboard Object rectangular Master Script DEFINE TEXTURE 'biltexture' picture_file,
Introduction to Object Making
97
PART TWO: BEGINNERS' GUIDE TO GDL SCRIPTING
A,zzyzx,1,0 DEFINE MATERIAL 'bilmat' 24, 1,1,1, 0,61,IND(TEXTURE,'biltexture')
The small difference here is that the name of the picture file is now a parameter and the dimensions of the picture are dynamically resized by the ‘A’ and ‘zzyzx’ dimensions. !Billboard Rectangular.gsm !3D Script PEN cont_pen IF shad THEN SHADOW ON ELSE SHADOW OFF MATERIAL bilmat ROTx 90 POLY_ 5, 0,0,1, A,0,1, A,zzyzx,1, 0,zzyzx,1, 0,0,-1 BASE VERT 0,0,0 VERT 0.1,0,0 VERT 0,0.1,0
VERT 0,0,0.1 COOR 258, -1,-2,-3,-4 BODY -1 DEL 1 We are not using a PRISM here. A POLY_ is one simple surface that will not reveal tell-tale edges showing in a render. We are using the texture mapping routine that was used in the previous chapter. Copy and paste! For the 2D Script copy the script from the Picture object in the previous section of this chapter. That’s all!
This is useful mostly for placing trees and plants into ArchiCAD in the floor plan. You can also place elevations of people, cars and trees into sections and elevations, giving the impression of upright billboard objects – all you need to do is whiten the background.
9.5 The Billboard idea in 2D? If you place a bitmap Figure into the floor plan and look at its Settings dialog, you may notice that there is a transparency button. Any completely white parts of the image (which have an RGB value of 255:255:255 or FFFFFF) will show as transparent.
98
You can now use the ‘Display Order’ menu option to organise how the figures will overlap. Introduction to Object Making
PART TWO: BEGINNERS' GUIDE TO GDL SCRIPTING
9.6 Billboard creation – the photograph If you apply this technique to building facades, one problem is that you can so rarely get squarely in front of a building. There is either a policeman telling you to move on, the sun is facing you, trees or a tourist bus parked in front, or simply, the building is too tall for a front-on photo. You may have to make do with a perspective looking upwards, or from the side. If you manage to get the photo in perspective, you can use Photoshop’s Edit>Free Transform>Perspective and Distort capability to straighten out a facade. But it is hard work and the proportions and the upper level windows may still be wrong. The serious billboarder will always carry either Cigraph’s ArchiFacade in their kitbag, or Abvent’s PhotoCAD.
Find out more at http://www.cigraph-store.com ArchiFacade is an API (Add-on) which uses the cutout method and generates a GDL object for each cutout. It is good at both the requirements, straightening and regularising the bitmap image. Its Introduction to Object Making
talents extend to making the billboard object for you including the GDL texture routines!
By giving ArchiFacade the required height and width of the facade, you will see it perform the Perspective and Distort action quickly and accurately, saving you much time. You can also look at the facade, and if you can get clean images of the entrance and some typical windows and cornice details, you might be able to reconstruct a facade by copying and pasting the bits that you managed to capture – even if the rest was obscured with trees! But this is going to be hard labour!
99
PART TWO: BEGINNERS' GUIDE TO GDL SCRIPTING
This view of West Bridgford Central Avenue near the author’s home was done by Bite Design in Nottingham. It uses billboard surfaces for the building elevations, 3D street furniture and a few billboard trees to fill in the spaces.
Summary of Billboarding in this section • Billboard Objects are an important skill in object making, and can give greater realism than fully crafted 3D objects. • Cutout billboards are better than Picture billboards, and they can carry their own texture and material. • Remember, you already have billboard objects in Artlantis and Piranesi, and you can add people and trees in Photoshop later. ArchiCAD Picture objects may not work in 3rd party renderers, although Cutouts are likely to work. But with Lightworks, your own cutouts should work splendidly. You decide. • Ice figures can populate a scene without distracting from the architectural qualities. • Straightening a building photo is more than de-skewing. The proportions need to be accurate. • 2D Objects for Plans or Sections can be done without objects, you can use Figures, with transparency activated.
100
Introduction to Object Making
PART TWO: BEGINNERS' GUIDE TO GDL SCRIPTING
CHAPTER 10: GDL WINDOWS AND DOORS This chapter will discourage you from hoping that you can write Windows or Doors from new due to their complexity, but it will encourage you to tinker with ones you make without GDL. You can also try building a Skylight..
10.1 GDL Windows and Doors The first edition of this book on 2000 had two Windows and one Door in it. Since then Windows and Doors have got much more complicated for several reasons, and the chapter will concentrate on helping you ‘tweak’ ones you make by autoscripting. A GDL Window or Door written as a new GDL product is so fiendishly complex that it has disappeared out of sight in the terms of reference of this humble book. Users expect far more from Windows and Doors (W&Ds) than ever before. The ones we already have in our standard library are all in need of a major overhaul. Industry Foundation Classes (IFC) standards have set standards that have made W&Ds vastly more complex than they used to be. Apart from cutting the hole in the wall (the easiest bit!) there are a host of complex variables such as linings, beading, architraves, grilles, casements, shutters, handles, realistic scale sensitive 2D symbols, opening oversizing. W&Ds need to know the materials and thicknesses of the walls, their position in the reveal. W&Ds depend on a host of macros to provide the right level of detail, such as handles and shutters. W&Ds need an excellent user interface dialog so that the user can cope with all the choices of door, shutter, handles and so much more. Windows need to have different materials inside and out, and need to have authentic looking textures on every part. Open a New Object, and look at the GDL dialog. Hit the ‘Select Subtypes’ button and select ‘Wall Opening’. Look at the list of parameters suddenly offered to you – formidable! This is only the beginning, there are more required.
The first rule of making a window/door is that it is made flat on the XY ground plane, with the Origin at the centre of the width of the sill and the zero ground plane being analogous to the external face of the wall, the inside face looking upwards. Doors in their initial state open outwards (downwards) and hinge on the right hand side. This mode can be modified by flipping and mirroring by the user, if your script permits. The second rule is to select the correct Subtype – when you saved from ArchiCAD, you found it magically made into a window by clicking an icon. In creative GDL, the way to define an object as a window is to select the ‘Wall Opening’ subtype. When it is brought back into ArchiCAD and placed in a wall, it will be the right way up and will be able to cut a wallhole. If you set the Subtype correctly, the window will be able to stand upright and cut a hole in the wall.
The Rules of Windows and Doors Take a look at the GDL dialog of one of the existing standard ArchiCAD doors. This shows how complex the parameters have become, but it also shows the basic orientation of the door relative to the origin. Introduction to Object Making
101
PART TWO: BEGINNERS' GUIDE TO GDL SCRIPTING
The third rule is that ‘A’ governs the width and ‘B’ governs the height. It is possible to override this later, but start this way. If you author a Window/Door from new, you write a WALLHOLE command which determines the wall cutting. If you fail to write a WALLHOLE command, you will get a default hole A wide and B high. It would be good if there were just three rules. Look at the parameters and try to imagine how many more rules there must be!
10.2 Revisit the Window Let’s revisit the window we created in chapter 2. It is capable of improvement with a bit of tweaking. Open the object in GDL and view the autoscripted 3D code. We cut the prism originally so that the jambs and the head and sill are different sections – so that texture can be directed separately for each one. We can now fix this using the texture orienting subroutine 999 in the previous chapter. With the subtype parameters, you could go through replacing the PEN parameter and all the references to materials in the cPRISM_ statements (as above). Remove all GLOB statements, and if textures are to work, remove all the BODY -1 commands. Paste in an END statement and the subroutine for textures.
Door and Windows can present such a variety of choices that they need a multipage visual User Interface.
102
Introduction to Object Making
PART TWO: BEGINNERS' GUIDE TO GDL SCRIPTING
MULXA/0.8775315255826 MULYB/1.249817627345 MULZZZYZX/ 0.16 ADDX 35.0009371729 ADDY -7.002659943499
Construct the Wallhole by combining extreme left, right upper and lower dimensions of head and sill pieces. WALLHOLE 5, AC_HoleSideMaterial, -35.4397-ac_left_oversize, 7.0026-ac_lower_oversize,15, -34.5261+ac_right_oversize,7.0026-ac_lower_oversi ze,15, -34.5261+ac_right_oversize,8.2524+ac_upper_oversi ze,15, -35.4397-ac_left_oversize, 8.2524+ac_upper_oversize,15, -35.4397-ac_left_oversize, 7.0026-ac_lower_oversize,-1
At this point, we had to add in the parameters for the oversizes from the Parameter Table. If you do not want to do this, don’t bother with the WALLHOLE and hit the ‘Hide’ button to the title of the group in the Table. Leave the MUL and ADD commands at the start – otherwise the window will not position or stretch correctly. The WALLHOLE is similar to a PRISM statement except that instead of thickness, we past in the parameter for the side material. WALLHOLE is very powerful – it can be repeated many times to make complex shapes, or it can be complex in its own outline. It can also be give the ROTx or ROTy treatment to make interesting chamfering effects to the wall. We could have remade this window over the main origin, but here we have accepted the window as it comes, to show that even if you lost the original slab parts, you can still tweak the script. It only causes problems if you want to write a script to drive a hole through the wall. We want to write in a WALLHOLE command as this will allow us to conform to one quality requirement, that of allowing oversize dimensions around the hole. It would have been so-o-o much easier to do this if the window is built symmetrically over the main Origin. ! Name : windo_2_omwac.gsm ! 3D Script PEN gs_frame_pen Introduction to Object Making
!!Glass ADDZ 0.04 cPRISM_ gs_glass_mat, gs_glass_mat, gs_glass_mat, 12, gs_glass_thk, -35.39981876463, 8.160415405712, 15, -35.38268901762, 8.166515355645, 79, -35.2645803879, 8.193436940666, 79, -35.14463324159, 8.210381032486, 79, -35.02368892174, 8.217228780474, 79, -34.90259576587, 8.213932152599, 79, -34.78220315544, 8.200514272335, 79, -34.66335555813, 8.177069256472, 79, -34.60512108129, 8.160415405712, 15,
103
PART TWO: BEGINNERS' GUIDE TO GDL SCRIPTING
DEL
-34.60512108129, 7.075050087223, -35.39981876463, 7.075050087223, -35.39981876463, 8.160415405712, 1
15, 15, -1
-34.56217141011, 7.047220207262, 15, -34.56217141011, 7.002659943499, 15, -35.43970293569, 7.002659943499, 15, -35.43970293569, 7.047220207262, -1 DEL 1 !!Horizontal Window head cPRISM_ gs_frame_mat, gs_frame_mat, gs_frame_mat, 14, 0.1, -34.56217141011, 8.160415405712, 15, -34.56217141011, 8.252477570844, 15, -35.43970293569, 8.252477570844, 15, -35.43970293569, 8.160415405712, 15, -35.39981876463, 8.160415405712, 15, -35.38268901762, 8.166515355645, 79, -35.2645803879, 8.193436940666, 79, -35.14463324159, 8.210381032486, 79, -35.02368892174, 8.217228780474, 79, -34.90259576587, 8.213932152599, 79, -34.78220315544, 8.200514272335, 79, -34.66335555813, 8.177069256472, 79, -34.60512108129, 8.160415405712, 15, -34.56217141011, 8.160415405712, -1
Sorry about all this script – it’s the usual autoscripted stuff. But it’s useful to see how the parameters can be inserted and the texture managed. You could try to insert ‘gs_frame_thk’ for the frame thickness, but you would need to script the 2D and it would get so complicated you might wonder why you didn’t make it parametric in the first place.
Note that we just have to hide the parameters we cannot make use of. If we script parametrically, we could design a window with frame thickness and width, and with sash details and make full use of all the parameters. If we leave them showing but inoperable, your poor user will be confused. !!Overhanging Sill ADDZ -0.06 cPRISM_ gs_frame_mat, gs_frame_mat, gs_frame_mat, 5, 0.06, -35.43970293569, 7.047220207262, 15,
104
!!Horizontal Sill cPRISM_ gs_frame_mat, gs_frame_mat, gs_frame_mat, 7, 0.1, -35.43970293569, 7.002659943499, 15, -34.56217141011, 7.002659943499, 15, -34.56217141011, 7.075050087223, 15, -34.60512108129, 7.075050087223, 15, -35.39981876463, 7.075050087223, 15, -35.43970293569, 7.075050087223, 15, -35.43970293569, 7.002659943499, -1 GOSUB 999:!Texture !!Vertical Jambs cPRISM_ gs_frame_mat, gs_frame_mat, gs_frame_mat, 5, 0.1, Introduction to Object Making
PART TWO: BEGINNERS' GUIDE TO GDL SCRIPTING
-35.39981876463, 7.075050087223, 15, -35.39981876463, 8.160415405712, 15, -35.43970293569, 8.160415405712, 15, -35.43970293569, 7.075050087223, 15, -35.39981876463, 7.075050087223, -1 cPRISM_ gs_frame_mat, gs_frame_mat, gs_frame_mat, 5, 0.1, -34.56217141011, 7.075050087223, 15, -34.56217141011, 8.160415405712, 15, -34.60512108129, 8.160415405712, 15, -34.60413858807, 7.075050087223, 15, -34.56217141011, 7.075050087223, -1 ROTz 90 GOSUB 999:!Texture DEL 1 DEL TOP END:!======================== 999:!Texture BASE VERT 0,0,0 VERT 1,0,0 VERT 0,1,0 VERT 0,0,1 COOR 258,-1,-2,-3,-4 BODY -1 RETURN
Introduction to Object Making
Left, with texture control, right without control. It is a pity that the Open GL implementation in ArchiCAD 8.1 makes the glass disappear or look totally solid.
10.3 You can make Skylights too You can also make Skylights by selecting the correct Subtype. They will cut a hole in roofs chamfering the roof opening correctly. You build the frame flat on the ground, window-style, and rotate it upwards by the roof angle. There is no equivalent of the WALLHOLE command, so you have to accept rectangular holes and the chamfering style. Let’s do a very simple one, accepting that there is a lot more work to make it fully swivelling and having parametric flashings – but it’s a lot easier to make than a Window or Door.
105
PART TWO: BEGINNERS' GUIDE TO GDL SCRIPTING
You can see how the Skylight API cuts the roof (left), better than 'vertical' hole cutting (right). If you want to modify the holeshape, build back parts of the roof, using the correct materials and thicknesses. We are going to use a smart little trick here. Skylights are usually wood framed with a metal top and outer surface, and the timber should be visible on the underside and inside edge. We cannot do this with a CPRISM_ or any other GDL statement directly. So we make the frame flat and solid on the floor. Work out the size of the glass, and drive a hole through the frame the same size as the glass. CUTPOLY is a wonderfully useful command similar to a PRISM (if you wish for holes with curved edges, you need CUTPOLYA). CUTPOLY will cut, leaving behind the material you specify – so we can state the frame material and get the authentic look!
!Glass MATERIAL gs_glass_mat ADDz fdep-gthk PRISM_ 5,gthk, -A/2+fwid,fwid,15, -A/2+fwid,B-fwid*2,15, A/2-fwid,B-fwid*2,15, A/2-fwid,fwid,15, -A/2+fwid,fwid,-1 DEL 1 !Frame MATERIAL gs_frame_mat CUTPOLY 5, -A/2+fwid,fwid, -A/2+fwid,B-fwid*2, A/2-fwid,B-fwid*2, A/2-fwid,fwid, -A/2+fwid,fwid !Actual frame cPRISM_ gs_upper_mat,gs_frame_mat,gs_upper_mat, 5,fdep, -A/2 ,0,15, -A/2 ,B,15, A/2 ,B,15, A/2 ,0,15, -A/2 ,0,-1 CUTEND DEL 1
After a CUTPOLY or other cutting command, we have to terminate the cutting with a CUTEND – even if it is at the end of the 3D Script. We have another smart little trick. The data about the roof is conveniently displayed to us in the subtype parameters – greyed out in the illustration. We can see the roof angle, thickness, materials. So by laying the window flat on the ground but applying a ROTx ac_roofang, it stands up at the correct angle! Knowing the materials of the roof enables us to build back little bits of roof or flashing detail if we have to modify the opening shape.
!Skylight simple, 3D Script PEN gs_cont_pen ROTx ac_roofang
106
Introduction to Object Making
PART TWO: BEGINNERS' GUIDE TO GDL SCRIPTING
The 2D script can be done with a PROJECT2, but we cannot avoid some thinking if we want the Hotspots to work. The dimensions of the hole at the slope of the roof are ‘A’ wide and ‘B’ high. So as seen vertically in plan, the dimensions will require some simple trigonometry using the roof angle parameter. !Skylight very simple !2DScript HOTSPOT2 0,0 HOTSPOT2 -A/2,0 HOTSPOT2 A/2,0 HOTSPOT2 -A/2,B*COS(ac_roofang) HOTSPOT2 A/2,B*COS(ac_roofang) HOTSPOT2 0, B*COS(ac_roofang)/2 PROJECT2 3,270,2
10.4 Try a very complex window!
Tidy up the Skylight We need some work in the Master Script and 2D Script. !Skylight very simple !Master Script gthk=0.02 !Glass Thickness LOCK 'ac_roofang','ac_roofthk','ac_type', 'ac_upper_mat','ac_lower_mat','ac_side_mat'
One reason you may make a window is because it’s too unusual to be likely to be found in any of the existing libraries. Let’s built a window that could go up alongside a staircase. It would be unlikely that you would need it to be parametric in dimensions – unless you had many similar but slightly different. But you can go some way to tune up the window with a bit of GDL knowledge, as with the table in the previous chapter. Lay it out as carefully as you can using small walls for the window sections and slabs for the glass. Build it over the main origin – bottom right in this example. The easiest method is to use the Fill tool to draw out the outline first. This might be drawn out in a section view through the stair, copied, then pasted into the ground floor plan. Move it to the origin.
The purpose of this LOCK command is that we do not confuse our user. These parameters are not editable – they are the equivalent of Global Variables. They are telling us and the Skylight what is going on in the model. We need to lock them so that they change colour to grey and the user isn’t confused into thinking that they can edit the roof pitch or materials. We can also set up a dimension for the glass thickness here. Introduction to Object Making
107
PART TWO: BEGINNERS' GUIDE TO GDL SCRIPTING
For the window sections, walls have the benefit of having a constant width and height, and in some way relate to actual window sections if you are computing the lengths. For the outer window sections, make sure the walls follow the Fill perfectly, touching the edges of the opening. You can ‘flip’ the wall reference line if you need to. You make a judgement now as to whether the internal mullions and transoms are centred or referenced to the edges. It also pays to set a small grid – in this example, I set it to 10mm (0.625”). Using the Wall tool, your textures will line up nicely along the frames. Do the glass for the window by applying the Magic wand to the whole fill – there is no harm in taking the glass right to the edge. If you have to be pedantic and make each piece of glass separately, then magic wand a dumb piece of Floorslab over the fill, make it Concrete and 300mm thick, Give it an object ID of ‘Wallhole’ in the settings dialog. When you are in the script later, you will know it’s not the glass and you can change it to a Hole cutting outline for the wall.
108
Unmodifed, the window will create a rectangle of A x B. The task is to shape the wall around the window frame. To make the window, you view it in 3D, in Plan, from 270°. Save as a Window, editable. Now place into the plan a new wall about 6m (20’) high, and place the window. This finished window is 6500x 4271mm and would be used in a 2 storey height wall. When it comes in, it will cut a rectangle of A and B of that size. We can tidy it up somewhat as we did for the table – it’s easier to identify the parts if all the frames are walls and the glass is a slab. Either the glass or that extra slab will act as your cutting outline. ! Name : window_complex2.gsm ! Date : May 2004 ! Version : 8.10 ! Written by ArchiCAD, modified by DNC MULXA/ 6.5 MULYB/4.271227780756 MULZZZYZX/0.08 ADDX 3.25 BODY -1 MODEL SOLID RESOL 36 Introduction to Object Making
PART TWO: BEGINNERS' GUIDE TO GDL SCRIPTING
!!First Window Frame PEN gs_frame_pen ADD -6.5, 4, 0 ROTZ 284.0362434679 xWALL_{2} gs_frame_mat, gs_frame_mat, gs_frame_mat, gs_frame_mat, 0.08, 8.61659632663E-016, 2.061552812809, 2.022513992489, 0.03792787368157, -2.154149081658E-016, 3.330669073875E-016, 0.05, 0.05, 0.05, 0, 0, 0, 15, 15, 15, 15, 0, 0 DEL 2
Many sections of window frames appear after this….. but all have been omitted for clarity. You only need to change the materials. You could change the thickness of the frame and the depth if you wish to, but in this situation, you are better advised to get it right in the original plan and only make the materials parametric, and to cut the wallhole. Lets pick up the 3D script near the end... !!Typical Window frame section up the side elevation ADD -4.055, 3.686666666667, 0 ROTZ 270 xWALL_{2} gs_frame_mat, gs_frame_mat, gs_frame_mat, gs_frame_mat, 0.08, 0.04342585459107, 2.256574145409, 2.289907478742, 0.0767591879244, 7.976936617858E-018, 4.145122554509E-016, 0.05, 0.05, 0.05, 0, 0, 0, 15, 15, 15, 15, 0, 0 DEL 2 BODY -1 !!Window and hole PEN gs_glass_pen ADDZ 0.04 cPRISM_ gs_glass_mat, gs_glass_mat, gs_glass_mat, 24, 0.02, 0, 0, 15, -0.5, 2, 15, Introduction to Object Making
-1.5, -4.5, -4.561310905493, -4.688716060937, -4.820255333372, -4.955258428817, -5.093037402443, -5.232890164181, -5.374104056416, -5.515959485522, -5.657733588747, -5.79870391776, -5.938152120077, -6.075367599624, -6.209651137769, -6.340318456382, -6.46670370476, -6.5, -6, -5, -2, 0,
2, 15, 4, 79, 4.035715090578, 4.098215535982, 4.151467757689, 4.195200394584, 4.229190595175, 4.253265153189, 4.267301390198, 4.271227780756, 4.265024316876, 4.248722609987, 4.222405729853, 4.186207781261, 4.14031322066, 4.084955916211, 4.020417956049, 4, 15, 2, 15, 2, 15, 0, 15, 0, -1
79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79,
The trick here is that you have a prism for the glass that exactly fits the desired window opening – point by point. So Copy and Paste a duplicate of it, exactly as done here, and retitle the start of the pasted prism statement with a WALLHOLE statement. Use the ‘AC_Holesidematerial’ parameter instead of the prism thickness. Have the two commands immediately next to each other. WALLHOLE 24, AC_Holesidematerial, 0, 0, 15, -0.5, 2, 15, -1.5, 2, 15, -4.5, 4, 79, -4.561310905493, 4.035715090578, -4.688716060937, 4.098215535982, -4.820255333372, 4.151467757689, -4.955258428817, 4.195200394584, -5.093037402443, 4.229190595175, -5.232890164181, 4.253265153189, -5.374104056416, 4.267301390198, -5.515959485522, 4.271227780756, -5.657733588747, 4.265024316876,
79, 79, 79, 79, 79, 79, 79, 79, 79,
109
PART TWO: BEGINNERS' GUIDE TO GDL SCRIPTING
-5.79870391776, -5.938152120077, -6.075367599624, -6.209651137769, -6.340318456382, -6.46670370476, -6.5, -6, -5, -2, 0, DEL DEL TOP
4.248722609987, 4.222405729853, 4.186207781261, 4.14031322066, 4.084955916211, 4.020417956049, 4, 15, 2, 15, 2, 15, 0, 15, 0, -1
79, 79, 79, 79, 79, 79,
1
This technique does not work on versions of ArchiCAD prior to version 8 – wallholes existed, but could not be complex in shape. Complex shapes could only be built up using several wallholes. It is an interesting command – you can rotate wallholes to create chamfered reveals. Another idea is that you can oversize the wallhole to leave enough space to insert a lintel, sill or sidelight.
Note for future versions of ArchiCAD This ‘wallhole trick’ is a built-in procedure in ArchiCAD 9. The method is to trace a Roof of 0° pitch or a Slab over the outline of the proposed window (magic wand to a fill, perhaps) trying to keep the baseline of the roof on the baseline of the window. Open the roof settings and write ‘Wallhole’ into the ID field (or ‘Wallniche’ if its a niche), and set the pitch to zero.
Objects can be better than Windows Don’t forget that ‘windows’ are things that you want to use to cut holes in walls. There are occasions when you are using technical solutions that are closer in idea to curtain walling than to windows – so these are ‘objects’ not ‘windows’. They are freestanding, set on a slab, or against but not in a wall. For this, you make them as ‘objects’, using mullions and transoms and frames. You could still lay them down in the plan view using small walls for the framing sections, and slabs for the glass.
110
This glass walling solutions is based on the Velfac 200 system. You would then autoscript these in 3D Elevation parallel view with the camera at 90°, and save as Object, Editable. You could then add in some parameters for materials. If you are scripting this fully in GDL, you build it upright. You might still make use of macros for the frames and casements, in fact you can use the same ones that work for ‘windows’. This prototype window system for Velfac uses objects. The same code, with a ROTx -90, a WALLHOLE, a change of subtype and a few small modifications can also make a conventional wall-cutting Window subtype.
Summary of GDL covered in this chapter • Windows and Doors are very very complex for full creative scripting – beware. • You can do a good job with a 50/50 approach: building the window without GDL then using some tricks to make the wallhole and the material parameters. • Skylights are easy to make, but can only cut rectangular holes. • WALLHOLE now supports very complex outlines. Use this neat trick with the slab to cut the complex outline. Introduction to Object Making
PART TWO: BEGINNERS' GUIDE TO GDL SCRIPTING
• Use a new trick with a roof outline to do the same cutting in future versions. • Windows are sometimes ‘objects’ if they are freestanding and not to be placed in a wall.
Introduction to Object Making
111
PART TWO: BEGINNERS' GUIDE TO GDL SCRIPTING
CHAPTER 11: GDL ROUNDUP There is a lot more to GDL than we have been able to cover in this slim volume. This section runs through some of the further possibilities in a brief form – of which LOOPS are the most important. But Graphical Hotspots and Solid Geometry Commands extend the power of GDL into new territory!
11.1 GDL Roundup This book is an introductory tutorial for GDL, a tour through the easy foothills. If your interest has been aroused, there is further reading for you and more experience to be gained. The best way to learn GDL is to attempt some practical tasks, which will be both useful to you in your work and will teach you additional techniques in GDL.
In GDL, there are four main areas of knowledge • We have to analyze the 3D nature of the object we wish to build. See how much of it can be done with simple blocks or cylinders, and then how much of it will require more complex commands such as PRISM, REVOLVE and TUBE. When you hit one of these commands (through necessity), do not give up, see it as a chance to advance further into a new area of GDL. • The GDL itself. The syntax of each command, which command to use under the circumstances, how to control polygons, how to define text style and materials – and much more. You will become conversant with 3D and 2D syntax as your experience grows. • The programming language of GDL. This has not been covered in full detail in this tutorial. Enough has been written to show you that it is possible to write long complex scripts in GDL using Loops and Subroutines. GDL is based on BASIC, a programming language that was devised in the 70s, became universally known to users of the AppleþII, Commodore Pet and Tandy TRS-80 machines of the early eighties; and now it has been rather forgotten. In GDL, it lives on! GDL can read and write data/text files, include complex calculation routines with a GDL script, such as structural calculations or predicting the outline points of a surface in 3D space. The multiple script mode of GDL means that it is capable of being really complex. Graphical hotspots extend the power of GDL enormously.
112
• GDL can react according to conditions in the main ArchiCAD model. Objects can know the current drawing scale, default drawing pen numbers and background pens. Doors and Windows can know the thickness and materials of the current Wall. With knowledge of the object’s position in 3D space and the location of the current camera, the object knows how far away the camera is, and in which direction. Thus, a billboard object can turn to face the camera; or a complex 3D object can simplify itself if it is too far away to require drawing in detail. This is done when GDL objects read the values of Global Variables, which exist in ArchiCAD. You saw all the GLOB statements in the autoscript in chapter 2. GLOB_SCALE is the current drawing scale. GLOB_NORTH the angle of the current north point. The GDL Cookbook covers all of these topics in greater detail, and provides practical working examples to help you learn.
The programming language of GDL You have discovered that you can write GDL without being a programmer. If you can issue a few GDL commands, move the cursor around, write some IF statements that make the object smarter and safer, then you have been programming. In fact, programming is an activity all of us do – ants do it when looking after their eggs, squirrels do it when hoarding their winter food, lions do it when hunting zebra, children do it when playing with their toys and developing social relationships. Adults do it whenever they get in their car and drive to work, or use their cellphone. Programming simply means the organization of a sequence of actions conditioned by a number of IF statements that decide which actions shall be taken. It also implies many repetitive actions – in real life, you could stack hundreds of books on a shelf and make decisions for each one as you proceeded to sort them by ISBN or size or by title or by author. To get further with GDL you will need to learn about Loops. Introduction to Object Making
PART TWO: BEGINNERS' GUIDE TO GDL SCRIPTING
11.2 Loops – FOR... NEXT Machines never tire of doing repetitive work. With a GDL object, you may have many spokes in a wheel, many shelves in a furniture system, many balusters in a handrail, many rungs on a ladder. If we have a means of telling GDL how many we want, and what spacing we want it at, we can get the work done for us.
ADD 0,0,0.6 ROTy 90 CYLIND 5*(pspac),0.03 DEL 2
The FOR... NEXT Loop We can make loops with FOR... NEXT. We can use FOR... NEXT in several ways, but the most common is to do it by counting numbers, by distance or by angle. Let’s show three simple examples.
Loop by counting numbers We want to plant a handrail at the racecourse and want to plant 6 x 1 metre high poles at 0.6 metre intervals, then cap it with a long rod. We assume an imaginary counter called ‘k’, and we increment it by 1 each time the program goes around the loop. So it starts with a value of 1, does one pole, advances to the position of the next pole, and waits. Then it meets the NEXT k command. As the job is not finished, it returns to the FOR line, increments ‘k’ again, and plants another pole. Eventually, it completes the task, and NEXT k recognizes that it has finished and allows the program to continue. We use DEL 6 to get back to the origin. !Long fence using numbers RESOL 10 MATERIAL 18: PEN 1 pspac=0.6 !Pole Spacing !Uprights FOR k=1 TO 6 STEP 1 CYLIND 1.0, 0.05 ADDx pspac NEXT k DEL 6 !Top rail ADD -0.05,0,1.0 ROTy 90 CYLIND 5*(pspac) +0.1,0.05 DEL 2 !Mid rail Introduction to Object Making
Top, Open GL makes it look smooth, no matter what you set for RESOL. Note that a trick is used to improve the look of the capping rail. By making it slightly longer (by one diameter) than the sum of the distances of the poles, it looks more authentic in the welded joint. We take advantage of ‘Z-buffering’ here. The Cylinders are actually colliding with the handrail although Open GL and the ArchiCAD 3D drawing engine makes them look as if they are joining smoothly. We can improve the way the loop is coded in two small ways. The first one worked fine, but we had to DEL all the cursor moves after the loop was complete. We also specified the stepping value. This method includes the DEL inside the loop, so that the loop is cleanly self-contained. FOR k=1 TO 6 ADDX pspac*(k-1) CYLIND 1.0,0.05 DEL 1 NEXT k
113
PART TWO: BEGINNERS' GUIDE TO GDL SCRIPTING
Now we place the ADDX command before the cylinder. The first time, the value of (k-1) is zero, so if you multiply ‘pspac’ by zero, the distance added is zero. So it plants the first pole. Then it DELs back to the origin. When ‘k’ is equal to 2, the distance moved is ‘pspac*1’ so it draws the next pole, then returns to the origin. Notice that in the first case, we specified the stepping rate to be ‘1’. If it is ‘1’, you can omit that STEP value, but if it is anything else at all, you must specify the STEP, or GDL will assume a value of 1 – which could be misinterpreted as 1.0 metres, or 1.0 degrees!
Loop by Distance – and optimise it! The next method is when you do not know how many will be needed, but you know their spacing. This says, “starting from point zero, advance a distance of ‘dist’ (which starts as zero) and plant a pole. Then return to zero. Then increment the value of ‘dist’ by ‘pspac’, then advance ‘dist’ (which by now has been incremented), plant another pole, then return to zero. Do this until you have covered the total distance required.” For this method, the stepping value must be clearly specified. Let’s make the length of the rail 3.3m (11’-0”). !Loop by distance - A=3.3 metres RESOL 12 pspac=0.6 !Pole spacing !Uprights FOR dist=0 TO A STEP pspac ADDx dist CYLIND 1.0,0.05 DEL 1 NEXT dist !Top rail ADD -0.05,0,1.0 ROTy 90 CYLIND A+0.1,0.05 DEL 2 !Mid rail ADD 0,0,0.6 ROTy 90 CYLIND A,0.03 DEL 2
114
The upper version has an overhang, the lower is corrected.
Smart way to recalculate spacing This is where GDL can become really smart. We could make GDL calculate the spacing of the uprights automatically. It’s clear that 0.6m does not divide cleanly into 3.3m, and there will usually be an overhang unless the length is perfectly subdivisible by 0.6m. We need a routine to get this right. You must either limit the length to a number divisible by ‘pspac’, or you must get GDL to recalculate the spacing of the uprights as closely as possible to the optimum spacing of 0.6m. !Loop by Distance with Calculation pspac=0.6 !Pole spacing optimum numbay=INT(0.5+ A/pspac) !Number of Bays numpol=numbay+1 !Actual number of poles pspac =A/numbay !Corrected value ‘pspac’ !Uprights Introduction to Object Making
PART TWO: BEGINNERS' GUIDE TO GDL SCRIPTING
FOR dist=0 TO A STEP pspac ADDx dist CYLIND 1.0,0.05 DEL 1 NEXT dist !Do the rails the same as before
We have here a calculation of the number of bays you would get by dividing ‘pspac’ into ‘A’. The INT(þ) function rounds this down to an integer number. The insertion of 0.5 makes it round up or down. Now you know the number of bays, you can calculate the number of Uprights and the true Bay Spacing ‘pspac’. No matter how you stretch it, the uprights will always fit the handrail nicely. This handrail could now be custom manufactured to fit any length.
Loop by Angle There are many occasions when your object has interesting circle geometry. Here is a similar handrail, but now it’s enclosing a curved running track. We use the FOR... NEXT loop to distribute the posts at an angular spacing of 15°. This brings the opportunity to introduce you to two more GDL commands: ELBOW and TOLER. ELBOW is like a cylinder but it is a cylinder which curves at a defined radius, to a defined sweep angle. ELBOW curve radius, alpha angle, tube radius Because elbows always grow upwards, you have to precede the command with a ROTX -90 and lift it to the height of the top of the posts.
Curvature control We want to control the number of polygons in the model, or the renderer will be too slow if there are too many of these rails. Open GL and Photorendering can smooth curved surfaces so it is not necessary to have a lot of polygons to get smooth effects. RESOL is code for ‘Resolution of Curvature’ and allows you to define how many polygons you want on a typical curve. RESOL 10 gives 10 polygons to all the cylinders. If you use this for something like the curved handrail, you will get a polygonal not curved rail, so you need something more sophisticated – TOLER. Poor old RESOL is too simple for complex objects. In any elbow, we have two curves, the main curve and the tubing curve. If we have a large resolution (we need at least RESOL 36) so that the rail looks Introduction to Object Making
right, and if we have a lot of rails in the project, the tubing will have too many polygons, and the computer could be crippled trying to shade all those surfaces. TOLER 0.005. This command sets the error to 5mm (3/16”) If you issue a TOLER dimension command, curvature is controlled in both small and large 3D shapes. TOLER stands for ‘tolerable error’ so you need to provide a dimension, like a few millimetres, a fraction of an inch, whatever you think is right. As the curve is traced, GDL measures the difference between the curve and a tangent to the curve. So small tubing will have only 6 or 8 faces (which is smoothed by Open GL), and on the large curve it will follow the curve smoothly. It is a very useful command.
!Circular racecourse rail !Loop by angle TOLER 0.005 crad=3.0 !Curve Radius angl=120 !Sweep angle ovra=360*0.05/(2*PI*crad) !Overhang angle !Uprights FOR ang=0 TO angl STEP 15 ROTz ang ADDx crad CYLIND 1.0,0.05 DEL 2 NEXT ang !Handrail ROTz -ovra ADD crad, 0 , 1.0 ROTx -90 ROTz 180 ELBOW crad, angl+ovra*2, 0.05 DEL 4
115
PART TWO: BEGINNERS' GUIDE TO GDL SCRIPTING
From the centre, you can run a FOR NEXT loop in which for each iteration you move out the the edge of the circle and draw an upright, and rotate slightly each time before the next upright. By using DEL within the loop, you have a nice tidy loop. For the rail, we start from the centre of the circle and move out to build the uprights and handrail. Rotate the rail slightly using the ROTZ command, move to the first upright with the ADD command, lay the ELBOW over on its side (with a sweep slightly longer than the required sweep angle) and draw the rail. In this case, we had do use a trick to make sure the weld detail would look good at the end posts. We calculate what fraction a single radius of the post would be of the total circumference. That becomes an internal parameter ‘ovra’ (overhanging angle) and it’s easy to get a good weld detail by rotating and extending the rail slightly.
116
This parametric model of the London Millennium Wheel (Marks Barfield, London 2000) allows you to model the wheel as built or in any other configuration you could wish for. All the tubing and spokes and cabins are recalculated using Angle based FOR... NEXT loops. If you want to make the circular rail self managing like the second version of the straight rail or the Millennium Wheel, we would have to divide the circumference by the optimum spacing, then work out the best stepping angle.
Other ways of Looping You have other methods of looping, • DO... WHILE: do an action while a condition applies, for example a dimension or an angle will eventually be equal to less than zero; until then, keep doing it. • WHILE condition DO... ENDWHILE: does the same as above. • REPEAT... UNTIL: go on doing something until a condition is met – for example, when a dimension or angle is equal to or less than zero, or the numbers in a memory buffer have been used up. The FOR... NEXT loop meets almost all your requirements. Most loops are based on counters, or incrementing until a distance or angle are achieved. You will know when a situation suitable for REPEAT or DO is the best way for you to loop.
Introduction to Object Making
PART TWO: BEGINNERS' GUIDE TO GDL SCRIPTING
11.3 Graphical Hotspots Graphical Hotspots allow you to click on and manipulate objects in 2D and 3D with amazing facility – objects can become like mechanisms. Furniture can be explored by opening doors and pulling out drawers. You are no longer confined to the limits of the ‘stretchy cuboid’ defined by A, B and zzyzx. In fact once you grasp the power of graphical hotspots you should no longer use the ‘ABzzyzx’ cuboid. When you stretch an object with the cuboid, you see nothing while it stretched except the cuboid. When you stretch an object using graphical hotspots, you see the object changing as it goes, including the recalculation of tubing if it’s required – and you see a readout of the changing value of the parameter, as it stretches.
This steel tube can be stretched and twisted and rotated in 3D You get the changes display visually as you work, both in the object and in a small dialog box above. Graphical hotspots (GHs) can control distance and angle. It seems that most objects can be manipulated successfully with these two. If you can think of another mode of action, put it on the Graphisoft wishlist. You can use GHs in 2D or 3D. The general rule is to use GHs that control X and Y dimensions in the 2D and use the 3D for heights or twisting motions. Another rule is that you should write all the hotspot routines before the bulk of either 2D Script or the 3D Script. This is so that the parameters resulting from the hotspot manipulation are swiftly passed on to the rest of the script. There is not space to cover the topic of GHs fully here, but let’s alert you to the possibilities of GHs here and try a simple exercise. You will Introduction to Object Making
117
PART TWO: BEGINNERS' GUIDE TO GDL SCRIPTING
find GHs very thoroughly covered in the ArchiCAD Help menu and the GDL Cookbook – there’s a lot more to them than this brief mention permits.
Let’s write some Graphical Hotspots Length based GHs are easy to do, but angled ones are more difficult – beyond the scope of this book. Let’s try a Length based one. We did this simple stretchy straight handrail earlier.
11.4 Solid Geometry Commands In the straight handrail, we looked at the idea of Z-buffering, whereby 3D objects that intersect are cleanly drawn in hidden line and shaded views. If you need good line drawings, you need to find a way to improve the appearance – you would like good pen lines at intersections, and you would like ‘waste material’ in the intersection to be removed in a wireline view. If you wanted a good wireline view, you could use Solid Geometry Commands (SGC) to make it look right. This would cut the uprights and rails to fit the each other nicely.
!Straight Handrail - 2D Script HOTSPOT2 0,0 !Base HOTSPOT2 A,0 !Move PROJECT2 3,270,1
Using the hotspots above, you can safely use the ‘ABzzyzx’ cuboid. Let’s try the GHs method instead. The syntax for a graphical hotspot is: HOTSPOT x,y,z, uniqueID, parameter, code !3D HOTSPOT2 x,y, uniqueID, parameter, code !2D
With GHs in length calculation you nominate the position of the starting Base spot (code=1), the Moving spot (code=2) and a third position, one that defines a Vector of movement (code=3). This can be anywhere behind the Base spot (in a negative direction). Graphical hotspots also require a unique ID number (to support associative dimensioning) and they need to know which parameter you are trying to change. So replace the hotspot routine above with: !Straight Handrail - 2D Script HOTSPOT2 0,0, 1001, A,1 !Base HOTSPOT2 A,0, 1002, A,2 !Move HOTSPOT2 -1,0, 1003, A,3 !Vector PROJECT2 3,270,1
118
We will have a brief excursion into this very important technology. SGC makes it possible to improve the 3D quality of solids by addition, subtraction or intersection. You will have to read more advanced books on GDL to cover this further, but let’s just improve the wireline view of the straight handrail. !Straight handrail with improved wireline view RESOL 12 MATERIAL 18: PEN 1 pspac=0.6 !Pole Spacing GROUP 'uprights' !Uprights FOR k=1 TO 6 STEP 1 CYLIND 1.0, 0.05 ADDx pspac NEXT k DEL 6 ENDGROUP GROUP 'rails' !Top rail ADD -0.05,0,1.0 Introduction to Object Making
PART TWO: BEGINNERS' GUIDE TO GDL SCRIPTING
ROTy 90 CYLIND 5*(pspac) +0.1,0.05 DEL 2 !Mid rail ADD 0,0,0.6 ROTy 90 CYLIND 5*(pspac),0.03 DEL 2 ENDGROUP handrail=ADDGROUP('uprights','rails') PLACEGROUP handrail
!Clear out the memory KILLGROUP handrail KILLGROUP 'uprights' KILLGROUP 'rails' In this procedure we define two groups, we create a new group with the ADDGROUP statement, and we then place it with a PLACEGROUP statement. KILLGROUP clears out the memory and allows us to use those group names again – it’s only really needed if this is part of a much longer script. The most important use of SGC is in subtraction, for example when you want to subtract a curved 3D shape from a another solid – something that you cannot do at all without SGC.
Here you can see the finished object near to. Behind you see the spheres which have been subtracted from the cylinder. Introduction to Object Making
Solid Geometry on the chair Looking at the chair we did earlier, we can improve the appearance in wireframe using the ADDGROUP function. Even in Hidden line, the appearance will be better, as intersecting circular forms can have clean ink lines at the joints.
The earlier chair on the right looks messy at the joints. SGC cleans it all up! Even subcomponents are tidied up, such as the junction of the braces relative to each other. We cannot get rid of the pen lines on the cone-ends except by using a REVOLVE instead of a CONE. !Chair 3D Script - With Solid Geometry !to improve the look of the joints PEN cont_pen TOLER 0.001 GROUP 'legs' GOSUB 100:!All the legs ENDGROUP GROUP 'seat' GOSUB 200:!Seat and upholstery ENDGROUP GROUP 'back' GOSUB 300:!Back ENDGROUP GROUP 'braces' GOSUB 400:!Braces ENDGROUP
119
PART TWO: BEGINNERS' GUIDE TO GDL SCRIPTING
GROUP 'arms' GOSUB 500:!Arms ENDGROUP chair=ADDGROUP('legs','seat') chair=ADDGROUP( chair,'back') chair=ADDGROUP( chair,'braces') chair=ADDGROUP( chair,'arms') PLACEGROUP chair KILLGROUP chair END:!____________________________
In the earlier chair script we had a number of IF statements in the executive script, like ‘IF bakon THEN’ and ‘IF arms THEN’. Move all these statements to the subroutines, to keep the executive script clean. Notice how the ‘chair’ value can be successively added to, line by line.
Minor disadvantage of SGC My caveat on SGC here is that you can lose the special texture mapping. When you ADDGROUP, it appears to try to apply the texture all as one, so you have to choose in the battle between best 3D appearance in Open GL and Photorendering against the best appearance in terms of pen lines and wireframe. If it really matters, you can have a popdown menu allowing the user to choose. You could use large IF statements to run one or the other version of the executive 3D Script.
11.5 Defining Text in 2D Let’s finish the book with one more technique that will help you with 2D. If you have any text labels in a 2D object, you cannot just use the TEXT2 command. You first have to tell GDL the attributes of the text, the size, the font, the style, the pen, etc. These are summed up as the STYLE. Imagine that you wish to letter the chair. We can use the string of characters from the ValueList describing the type of chair. Make a few parameters: ‘font’ for font name, and ‘fsiz’ for font size. ‘Fsiz’ must be a real number type of parameter because font size is measured in actual millimetres in plotting size.
120
Defining style is done in the form of the script here. The 1,0 mean that it is to be left-justified and normal (i.e. not bold or italic). See the Help Menu or GDL Cookbook for a more extended discussion of defining style. You must also SET STYLE before the text will recognise it. The TEXT2 statement includes the XY position of the text (just below the left chair leg) and the string. A normal string is in quotes, or in this case is a parameter from the ValueList.
Rich Text is available in ArchiCAD 9 Text entry is greatly improved in ArchiCAD 9 in the plan, detail and section views. It is now possible to have Bold, Italic etc., with variable colours. It is also greatly extended in the GDL, although to achieve equivalent variations in GDL requires some care with coding – TEXT2 has been too easy for too long. If you want to write rich text in GDL, you will have to grapple with STYLE{2}, PARAGRAPH, TEXTBLOCK, RICHTEXT2, RICHTEXT and REQUEST ('TEXTBLOCK_INFO'). These are beyond the scope of this humble edition.
Introduction to Object Making
PART TWO: BEGINNERS' GUIDE TO GDL SCRIPTING
11.6 Other possibilities Look at the GDL Reference Manual and the Help Menu This primer has been written in the hope that as your approach to GDL becomes more confident, you will be more willing to dip into the actual manual. The explanations may not be as dry or technical as you first thought. There’s plenty in this book to keep you busy if you are a GDL newcomer. There are many more capabilities in GDL than we have had space for in this primer. There are just too many to cover in one tutorial. But you can find out more by reading further or taking a course in GDL. If you made it this far the hard way – by reading and doing some of the exercises – you may be prepared to try some of these yourself. We have given you an insight into some of these already, but you can read up more on GDL – the GDL Cookbook takes you all the way with GDL.
Capabilities of GDL that this tutorial leaves for future investigation: • More powerful pop-up menus – with numbers and pictures. • Planar 3D GDL objects when they do not need to be solid. • Smart 2D symbols using FRAGMENT2, which combine drawn symbols with 2D scripting. • Applying ‘Polyline’ curves to the outlines of prism, poly, extrude, revolve and other objects. • Using ‘masking’ to control the way objects and surfaces look in 3D drawings and in photorendering. • Using a CUTPLANE, CUTFORM and CUTPOLY to carve and drill solid shapes, to make them more complex. • Macros – Calling other library objects (such as taps or door handles). • Billboard Objects – there is more to do with them yet! • Making Lamp objects with controllable light sources. • Doors, Windows, Skylights and Dormers – these are all subtypes which need a lot more explanation. • Curved, Corner, and more complex windows. Introduction to Object Making
• Using trigonometry to calculate the pathway of tubes and edges through curved and parabolic pathways. • Complex tubular lattice structures. • Making curvy skin-based surfaces using COONS or MASS. • Circle, parabolic, elliptical, catenary, sinwave curve maths. • Reading and displaying the system date, time, project name, and much more, using the REQUEST command. • Defining your own materials, line types and fill patterns. • Defining your own textures, and orienting them for greater authenticity, e.g. in Wood models. • Defining your own Line and Fill types, for better 2D. • Defining your own Text styles, including autosizing, setting styles and text positions for self labelling objects. • Storing numbers in memory and bringing them out later (Arrays and PUT & GET). • Solid Geometry Commands, in which parts of the model combine or cut each other. • Graphical hotspots allowing full manipulation of objects, including pulling/pushing, and twisting/rotation. • Parameter arrays and dynamic arrays. • Building a Graphical User Interface that replaces the normal parameter box and makes the GDL object look more professional. • Setting up animation possibilities by changing the object’s shape or position according to the frame number in the animation. • Knowing where the camera is, and changing accordingly. • Knowing which storey the object is on. • Reading and writing text based datafiles. • Making use of the Special menu. • Rich Text in 2D and 3D.
11.7 Advice for Newcomers to GDL Graphisoft asks: (Graphisoft Newsletter Sept 2000) What are the most important things you tell the people who attend your GDL classes about object making? DNC replies:
121
PART TWO: BEGINNERS' GUIDE TO GDL SCRIPTING
First thing is.... Don’t Panic!! It’s not as difficult as you expect once you are into it, and when you get an error message, read the message, look at the script; have you spelt the parameters right? Are your commas in the right place? Try excluding part of the script to see if other parts work. GDL has few bugs; for beginner level GDL there are none to speak of; so it’s a relief to know that the error will be found through hard logical thinking. Second thing is.... Always have pen and paper handy If you can’t draw it on paper, you can’t write it in GDL. Drawing it out on paper will put your mind at ease to concentrate on the logical process of actually building it. For many commands such as prisms and revolves, half the job is done if you have drawn it out, preferably marking the origin and numbering each point along the profile. Third thing is.... Think in parameters Always try to work (and think) in parameters not in numbers – it’s easy to develop your own lingo of 'wid', 'dep', 'len', 'hit' and 'thik', and easier to write in these terms knowing that a simple change in the parameter value will modify your object easily. Fourth thing is... Steal from ArchiCAD Some objects are so complex that the parametric method above is harder than beating your head against the wall. You may be better sketching them out in the ArchiCAD floorplan and then dragging them and dropping into the script. You may have to settle for making them parametric only by stretching and mirroring. Fifth thing is.... Structured GDL is best The moment it gets more complicated than one page full of script, convert the script to subroutines, so that each part of the model is a tiny object in its own right. This also saves on repetitive typing, and makes it easy to isolate errors.
122
11.8 Summary of ArchiCAD 9 changes Most of the GDL covered in this book is generic – it is good for GDL from ArchiCAD 6.5 onwards. However, it would help to summarise the ArchiCAD 9 changes that have been referred to at points in this book. There are many more small changes, but these go beyond the scope of the book. • Selection : Objects are easier to select if you have a FILL in the 2D Symbol. Scripted objects can have sensitive lines in the symbol. If you are scripting, you are advised to include POLY2 commands and follow LINE2 and ARC2 with HOTLINE2 and HOTARC2 statements wherever possible. • Naming : Now that you can search for objects by name, make sure that the objects have sensible names. • Subtypes : These have been important in AC8, but as the IFCs standards are more widely adopted and you make more use of the interactive scheduler you will be wise to select subtypes correctly. • Rich Text : You can now greatly improve the appearance of your text labels. • Graphical Hotspots : These will now have controllable pen colour (globally, not individually).
Introduction to Object Making
INDEX Numerics 2D Full View 43 2D Hotspots 51 2D Script 43 2D Symbol 25, 27, 31, 43, 79 2D symbol 24, 50 3D 112 ~ View 45 3D Cafe 13 3D Cursor 45 3D Cutaway 19 3D projection setting 25 3D Projection Settings 19, 22 3D projection settings 31 3D Script 43 3D script 72 3D View 43 3DS 13 3NF 14
A Abvent 99 AC_Holesidematerial 109 ADD 45 ADD2 45 ADDGROUP 119, 120 Add-on 99 Add-ons 13, 14, 19, 33, 37, 41, 82, 91 Adobe Photoshop 95 ADT 17 Align Texture 26, 93 Align texture 19 Alpha channel 91, 92, 97 animation 121 ARC2 52, 69, 122 ArchiCAD 9 12, 52, 110, 120, 122 ArchiCAD Library 13, 14, 20, 21, 40 ArchiCAD library 28, 36, 85 ArchiCAD Reference Guide 9, 18 ArchiCAD University 92 ArchiCAD-Talk 92 ArchiFacade 91, 99 ArchiFM 52, 75 Introduction to Object Making
ArchiForma 28, 34 Archiforma 14 ArchiPaint 91 ArchiRadar 13 ArchiTerra 10 Architerra 91 Arkiklub 13 Artlantis 91, 100 AutoCAD 13, 17 Autoscripted 10, 27 Autoscripted GDL 71 Autoscripting 19 autoscripting 101
B
banana truss 28, 29, 36 BASIC 17, 112 Basic Shapes 41 Basic Shapes library 36 bathroom fittings 20 BEAM 71 Billboard Objects 33, 91 Binary 14, 29, 32, 36, 90 binary 33 Bite Design 100 BLOCK 44, 47, 52 BODY -1 73, 87, 102 Boolean 54, 57, 79, 97 Bounding Box 31 bounding box 32, 72 BPRISM_ 62, 64, 68
C CADCAM 16 CALL 71, 85 Carpet 91, 96 Chair 24, 47 Check Script 45 Chesspieces 81 Chris Jones 38 Cigraph 13, 99 CIRCLE2 50, 71 Clean Wall Intersections 24
CNC 58 Column tool 21 Comma 66 Comment 43, 46, 60 CONE 44, 47, 52 Convert Mesh to Roof 33 Convert Roof to Mesh 37 COONS 121 COOR 87 Coordinates palette 19, 22, 27, 45 counterclockwise 63 CPRISM_ 62, 64, 71, 73 cPRISM_ 102 CSLAB_ 71, 79 curtain walling 110 Curvature 115 curvature control 81 CUTFORM 121 Cutout 91, 97 CUTPLANE 65, 121 CUTPOLY 106, 121 CUTPOLYA 106 CYLIND 44, 52
D David Sutherland 42 Default Translator 20 DEFINE MATERIAL 98 DEFINE TEXTURE 97 Defining Text 120 DEL 45 DEL TOP 46 Design Workshop 13 Dimensions 44 Display Options 24 Display Order 98 DNA 58 DO... WHILE 116 Door 15, 33 door 24 Doors 101 DXF/DWG 13, 18, 20, 82
123
Index
E
Editable 14, 25, 32, 72, 93 Eiffel Tower 21 ELBOW 52, 115 Elbow 28 END 83, 84, 102 ENDGROUP 119 Eureka Tower 10, 42 explode 15 EXTRUDE 64, 80
F
Fender Katsalidis 10, 42 Figure 92, 98 FILL 122 Fill tool 26, 64, 79 Find and Replace 65, 78 flow control 84 Flywheel 35 FOR... NEXT Loop 113 FPRISM_ 62, 65 FRAGMENT2 43, 121
G GDL Adaptor 13 GDL adaptor 17 GDL Alliance 13 GDL Central 13 GDL Cookbook 9, 61, 87, 97, 112, 121
18
GDL Dialog 42, 60 GDL dialog 101 GDL Reference Manual 9, 18, 66, 73, 121 GDL Toolbox 14, 28, 34 Geometric Description Language 15 GLOB 102 GLOB_ID 74 GLOB_NORTH 112 GLOB_SCALE 112 Global Variables 73, 107, 112 Golden Rules 84 Goodies 34, 36 Google 13, 21 GOSUB 83 Graphical Editing Hotspots 52 Graphical Hotspots 12, 112, 117, 122 Graphical hotspots 121
124
Graphisoft 11, 13, 17 grid 108 Grid Snap 22 Grids 19 groin vault 30 GROUP 118 GUID 11
H
Help Menu 9, 18, 121 HIDEPARAMETER 61 Hoshino 13 HOTARC2 52, 122 HOTLINE2 52, 122 HOTSPOT2 71 Hotspots 51, 74 HPRISM_ 62, 65 hyperbolic saddle 37, 38
I
Ice figures 94, 100 IF... ENDIF 55 IFC 11, 101 IF-Statement 54 Industry Foundation Classes 11, 101 Instant GDL 63, 64, 79 Internet 13, 15 internet 60 Investment Object 16
J Jodrell Bank 38
K
KILLGROUP 119, 120 Kimon Onuma 54, 58 kitchens 85
L label 84 Lamp 15 Lara Croft 33 Las Vegas 72 Le Corbusier 9 Libraries 10 Library Manager 40
Lightworks 12, 91 Line tool 26 line weight 20 LINE2 50, 52, 71, 74, 96, 122 loaded library 29 LOCK 61 Log setting 25 London 32, 116 London Millennium Wheel 116 Loops 112 Lovell Radio Telescope 38
M M.A.D. 13 Macro 89 Macros 85 Magic Wand 19, 24, 26, 27, 37 Magic wand 17, 30, 95, 108 magic wand 21 Manufacturers Rules 50 Marks Barfield 116 Marquee 17, 19, 30, 41 masking code 63 Masking codes 81 MASS 71, 121 Master Script 43, 54, 56, 58, 68, 77, 83 MATERIAL 44 Material 46, 92 Materials 75 materials 15 Matthew Lohden 92 Melbourne 42 Mesh tool 14, 37 Missing objects 29 MODEL SOLID 73 Module 15, 40, 41 MUL 45 MultiObject 58, 85 MULX 72 MULY 72 MULZ 72
N Naming 122 naming 40 Norwegian window 86 Nottingham 100 Introduction to Object Making
Index
O Object Genome 58 Object Genome Project 54 Object Making 9 Objects On Line 13 Open GL 12, 33, 87, 91, 93, 94, 97, 113 Options menu 87, 92 Orcutt Winslow 16 Origin 20, 21, 26, 44, 45, 47, 71, 77, 93, 101, 103
P PARAGRAPH 120 Parameter arrays 121 parameter naming 49 Parameter Script 43, 56 Parameter Table 42, 48, 49, 54, 60, 67, 78 PARAMETERS 54, 60, 61, 69, 77, 86 Parameters button 43 Parametric 74 parametric 10, 17, 34, 48, 66 PEN 44, 102 Pen 75 People 91 people 98 People and More 13 Pet Palette 19 Pet palette 21 PhotoCAD 99 Photorender 97 Photoshop 91, 92, 95, 100 PICTURE 95 Picture 91 picturereality 91 Piranesi 91, 100 PLACEGROUP 119, 120 POLY_ 98 POLY2 52, 74, 122 POLY2_B{2} 71, 79, 80 Polylines 80 Popdown Menus 56 Popdown menus 52, 60 popdown menus 54 Preview Picture 25, 41, 43, 60 primitive forms 16 PRISM 52 Prism syntax 64 Profiler 10, 14, 16, 19, 31, 33, 34, 35, 38, 41, 80, Introduction to Object Making
82
Programming 112 Project Framework 18 PROJECT2 43, 46, 50, 69, 72, 74, 78, 81, 118 Property Script 43 PUT & GET 121 PYRAMID 80
R racecourse rail 115 rapid prototyping 16 ray-tracing 12 RECT2 50 reflection 12 Rendering 12, 74 REPEAT... UNTIL 116 REQUEST 120, 121 RESOL 47, 53, 73, 82, 113, 115 Resolution of Curvature 47 RETURN 77, 84 REVOLVE 64, 80, 81, 112, 119 Rhino 13 Rich Text 120, 122 RICHTEXT 120 RICHTEXT2 120 Robert Luck 32 Roof tool 14, 19, 38 Roof Truss 25 RoofMaker 10, 14 Roofmaker 37 ROT2 45 RPC 91 RULED 80
S
Schedules 40, 75 Section/Elevation 23, 25 SEO 35, 36, 39 SET STYLE 120 Settings dialog 19, 98 SGC 12, 90, 118 Shadows 97 Silicon Graphics 12 Sketchup 13, 33 Skylights 105 Slab tool 14, 21, 23, 24, 26, 62, 92 Solid Element Operations 12, 19, 34, 35, 36, 39
Solid Geometry Commands 12, 36, 90, 112, 118,
121
Solid Operations 41 spaghetti 46, 84 SPHERE 44 SPLINE2A 71 SPRISM_ 62, 65 StairMaker 10 status codes 79 STEP 114 Stretchiness 19, 49, 72 students 41 Studio Arkada 13 STYLE 120 STYLE{2} 120 Subroutine 77 subroutine 102 Subroutines 58, 83, 85 Subtype 12, 15, 43, 101, 105 Subtypes 11, 52, 75, 101 SWEEP 64, 80
T Table 21 template 75 TEXT2 71, 120 TEXTBLOCK 120 Textures 41, 87 textures 16, 23 Theometrics 13 TOLER 53, 82, 115 Tools menu 35 Tools palette 10, 14, 15, 16, 17, 19, 22, 40 transparency 98 trees 91, 98 trigonometry 121 Trim to Roof 38 True Line Weight 51 Trussmaker 14, 16, 19, 27, 28, 34, 37, 38, 41, 82 TUBE 64, 73, 82, 112 typographical discipline 46
U Urban modelling 32 User Interface 61, 102, 121 User Interface Script 43 User Interface script 86
125
Index
V
ValueList 56, 84, 120 ValueLists 54, 61 VALUES 56 Velfac 110 VERT 87
W
Wall tool 14, 24, 30, 37, 108 WALLHOLE 85, 103, 109 Wallhole 108 wallhole 24, 101 Webscape 54 West Bridgford 100 WHILE condition DO 116 Window 15, 22, 33 window 86 Windows 14, 101
X XWALL 79 XWALL_{2} 71
Z
Z-buffering 113, 118 Zoom 13, 34 ZZYZX 72 zzyzx 49, 77, 86
126
Introduction to Object Making