Object Making With ArchiCAD
Object Making With ArchiCAD
ArchiCAD
GDL for Beginners
by David Nicholson-Cole
i
Object Making with ArchiCAD: GDL for Beginners
© 2000. Written by David Nicholson-Cole. All rights reserved. Reproduction, paraphrasing or
translation without express prior written permission of Graphisoft is strictly prohibited.
Back 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., http://www.graphisoft.com
First printing.
Printed in Hungary.
The version of GDL described in this manual is compatible with ArchiCAD 6.5 and ArchiFM 2000.
ArchiCAD and ArchiFM are registered trademarks and StairMaker and GDL are trademarks of
Graphisoft. All other trademarks are the property of their respective holders.
ii
About this Book
Object Making with ArchiCAD is designed to help you get more
enjoyment and productivity from ArchiCAD by taking you beyond
the confines of the Toolbox (the tools palette) into the realm of
object making with GDL (Geometric Description Language).
Objects – such as furniture, doors and windows, lamps, building
components – can be made using the existing tools – wall, roof,
floor, mesh, etc. They can be made with native GDL, scripted from
start to end; or they can be made with a combination of the
ArchiCAD tools and scripting. ArchiCAD users have long asked for
a book that will lead users from tool using to object making, and
we hope that this little primer will open up new worlds for each
user. The book is not just about GDL; it starts with object making
using the existing tools, and by progressive stages, leads you into
GDL, but we hope you will find the transition enjoyable.
Some of the examples used in the book will be available from the
support website.
Acknowledgements
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. It contains
easy to follow exercises in object making, and pulls together
wisdom about object making from other sources, including the
reference manuals, for which all the authoring team should be
thanked.
iii
iv
Chapter 1: Introduction to Object Making
Chapter 1
Introduction to Object
Making
An introduction to the possibilities of object making in ArchiCAD,
with or without GDL.
When you bring the 3D DXF into ArchiCAD as a library part, you
can opt for:
– Don’t Process: The object does not get converted to 3D. Only
the 2D parts will get imported. This is the default setting.
– Binary 3D: The object comes in as 3D, but it is encapsulated
into an uneditable block of machine code that is neat, tidy and
stretchy (and more reliable when rendering), but leaves you
no opportunity for further editing or parametric modifications.
– GDL Script: With this option, all the 2D and 3D data will be
imported, but you will be faced with a colossal quantity of
script. Nothing brought in from DXF is solid; it is 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
are Material names, and a simplified 2D symbol.
You may be disappointed with the result. You will have to spend a
lot of time learning the new applications. 3D objects made in other
applications will leave you with little or no control over the
materials and parametric properties. In particular, 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. With such an excess of polygons, you may
find it difficult to export your ArchiCAD model to a 3rd party
renderer such as Art•lantis Render.
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 save the resulting varied
forms as separate DXFs.
Add-ons that make Objects
There are a number of third party programs that can create or edit
ArchiCAD library parts, for example, StairMaker and ArchiSite. You
will also find a growing number of object-making Add-ons
provided by Graphisoft such as RoofMaker and Profiler.
Objects created by these Add-ons contain GDL scripts as well as
other, application-dependent data.
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.
For the more experienced object maker, it is possible to combine
the Toolbox 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
are drawn out in the floor plan with the wall, roof or slab tool,
saved as little chunks of GDL and 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 out standard symbols, select them, and
‘save special’ as a library part. If you already have a 3D object that
you wish to use purely as 2D, you could select it, ‘explode’ it, and
save the resulting lines as a new 2D library part. This does not
damage 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. You can go on to re-
open the object and resave it as a Lamp.
Assemblies built with the Toolbox do not have to be saved as
library parts. They can be grouped or saved as modules and
reused; but if you wish them to behave properly as objects and
allow further editing, they must be saved as library parts.
‘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.
Another object may be required to be totally accurate, so that you
can derive accurately dimensioned sections and plans from it. It
may be required to drive a 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.
Chapter 2
Making Objects without
GDL
Before learning GDL it is wise to become fully conversant with
object making using ArchiCAD own tools.
Getting Started
Before making your first object with the Toolbox, ensure that you
are conversant with the use of the Magic Wand (for transforming a
Fill to a Slab, or a Slab to a Roof), setting Grids, using the
Coordinate Box, and with using the Settings boxes for the various
tools in the Toolbox. Open a new ArchiCAD file, load a new folder
to use as your library and save the new file to that folder or to
somewhere convenient. Set the grid to 1’-0” or to 300 mm. 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. Make sure this is the real Origin, not a
temporary one.
If you have made a temporary origin somewhere else and cannot
find the main origin, just click on the temporary origin and hit the
delete key. The main origin will blacken.
If you do not place any hotspots, you will get what is called ‘the
bounding box’ around the object, as illustrated (right), and it will
be stretchy. If you place hotspots, even as few as one, you get no
bounding box, but the hotspot that you placed will be visible (it
will no longer be stretchy). So if you place one hotspot, you
should place more. If you use the Fill tool instead of the Line tool,
you will find that ArchiCAD places the hotspots for you at all the
significant nodes. If you want it to be stretchy, then place hotspots
at the extreme left, right, top and bottom edges (unless the Fill tool
reaches these extremities).
You could try another method. You can use File menu>New
Library Part>Object, and open the object master window, with a
range of buttons allowing you to display scripts or graphical
windows. You can draw in the 2D symbol window with the same
2D tools as in the main ArchiCAD floor plan. Save the object into
your loaded library. Use this method only when you have become
more familiar with this palette.
Remember also that you need to set the materials of the tabletop
and legs using the Slab Settings dialog box.
To make sure that each leg is consistent, make one correctly, then
Edit>Drag a Copy to each corner of the table. If you use the grid,
you can make the table reasonably accurate in dimensions. If you
keep an eye on the Coordinate Box and type in your X and Y
locations, you can make the table extremely accurate. You can
make it even more accurate by setting Grid Snap to ON, and using
a small grid of say 10 mm or 1/2”.
If you use the Arc/Circle tool’s ellipse line option and then ‘magic
wand’ a slab to it, you could make a more stylish and elegant
table. This table will be stretchy, but if you stretch it, the section
sizes will deform.
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. This is where a little knowledge of GDL comes in.
The illustration above shows how the window should sit on the
XY ground plane. Check that the frame/casement/glass
relationships are working correctly.
In this case, the project origin is neatly positioned at the centre of
the sill. This is not absolutely necessary because ArchiCAD will
make 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 from the direction that you would need to
see them if the finished window in the floor plan. Select Image>3D
Projection Settings. You can use either shaded view or wireframe
view.
The camera should be positioned at 90˚ and the view type should
be Parallel Views>Side view.
The 3D view will look like this, and if you ask for it to be
Wireframe, you will be able to see the frame and glass outlines.
This is as it will appear in the floor plan, when set into a wall.
Save that view as a Library Part 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.
If you clicked the window or door icon, ArchiCAD forces the
camera view to be 90˚ Parallel>Sideview even if you got the 3D
view incorrect!
Now, back in the floor plan, build a wall, and then select a
window to put into it. The window you have just saved will be the
first one that ArchiCAD offers you. 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.
The technique of making windows is similar with door
construction. But you would need GDL to change the door style,
to make it open and shut and to select a choice of glazing or
ironwork styles.
Snap the Wall tool to the lines with the space bar depressed; this
causes the little walls to follow the lines. Select and group the
walls; drag a copy of the wall group to one side. Now use the
Elevate command to raise that wall group by 700 mm. Now move
that wall group back until it is exactly over the first. You now have
the steel frame of the chair.
For the upholstery, change the wall settings to 750 mm high and
60 mm thick, and made of “Textile” (or “Leather” or “Asphalt”).
Draw the walls for the upholstery yourself; the seat is flat, and the
back is slightly curved using the curved Wall tool option.
When you have something like the Barcelona chair in the diagram,
set the cameras exactly as you did for the Window – 90˚ position
for camera with Parallel Side view (elevation) selected. Save the
3D view as a library part into your loaded library; this time, click
the object icon, not the window or door.
Place the chair into your project and enjoy!
You can make use of the Line tool to set up guidelines to make
sure that your timbers lie at the right angles and have the right
depths
When you have the section in the foreground, the 3D tools go grey
because you cannot use 3D tools in the section. But you can draw
with the 2D tools, Text, Lines, Fills and Hotspots. 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, and
you will be able to cut holes. Thus you form the outline of the
whole truss.
Now select the fill, copy it, move to the floor plan and paste it.
Move it so that one end corner of the truss is over the Origin –
preferably one of the truss bearings. The hotspots will help you.
Now you can magic-wand-click the Slab tool to follow the outline
of the Fill.
Make sure before you use the Slab tool that it is close to the
ground – set the thickness to 40 mm, the top of the slab to 20 mm
and the material to timber. Thus the truss is nicely centered above
and below ground zero.
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. Then select
the slab (making sure it is the slab and not the fill that you have
selected) and then snap-click each of the holes in the fill. This will
drill holes in the slab. You should finish with a small truss like the
one above. If you get a lot of slab bits and no holes, 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.
Now view the truss from the same angle as you used for the
window and the chair – 90˚ position for camera with parallel
elevation view selected. Save the 3D view as a library part, click
the object icon, and you have your truss.
Now bring this truss into the floor plan, and space the new trusses
along the building. Use the section view first, to make sure your
truss aligns perfectly with the original fill pattern. The hotspots will
help. Autoscripted objects are automatically stretchy so be careful
This little oval cocktail table has been built entirely from the
‘Cone65’ object in the existing ArchiCAD Library. Try building
something using the same or other objects in that directory. Some
of these are somewhat confusing to manipulate, but the library
parts settings dialog box makes it easy to play with the parameters
if you display the 3D view of the object.
Toolbox icon of the Marquee tool with the polygon and rectangle
variants
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.
The marquee can be a rectangle or it can be a polygonal shape,
like a fill. First draw one 2D line along the end edge of the vault,
between the end hotspots. Now when you hover the cursor over
the end of the vault, you 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˚.
Now select the Marquee tool and select the polygonal variant of
the marquee. Draw along the 2D lines as accurately as possible
and then encircle the rest of the vault that you intend to retain.
Plan of the shimmering marquee over the vault object. Note that
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 view this in 3D axonometric and you will be delighted to 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. Now use the 3D projections to
set the camera position to 270˚ and the view type to Parallel>Plan.
Using method 2, save this as a library part and you can call it
“vault_groin.GSM”. Return to the floor plan, click on the Object
tool icon, click in the plan, and your new object arrives.
Plan View of the four vaults in plan view, alongside the original
wall piece
You can now add in the 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 to take a
sideways ‘bite’ out of a large vault and have a pair of smaller vaults
intersecting. 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.
through windows) and hide the site on which it sits. Then select
the entire building using the fat marquee, or 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>Select Image
Items and you can decide which stories to omit. Save as a Library
Part.
Chapter 3
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!
When you have the Parameters button pressed, you get a ‘New’
button at the top – enabling you to create new parameters for
length, materials, pen colors and more.
Before starting with some easy exercises, let’s look at the function
of the scripts and windows available to you. Bear in mind that for
the beginner in GDL, the only scripts that you really need are the
3D and the 2D scripts.
The Parameter table is where you can build the Object Settings
dialog box that the user will see when they use your object. This
3D Entities
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, and r1 the Radius at the base and r2 the
Radius at the top. The 90, 90 are the angles at which you cut
off the top and bottom. You can vary these numbers to get
interesting effects.
!Back
MATERIAL ’Pine’
ADD 0,0.4,0.45
BLOCK 0.05,0.05,0.45
ADDx 0.4
BLOCK 0.05,0.05,0.45
DEL 1
MATERIAL ’Textile’
ADD 0.05,0,0.15
BLOCK 0.35,0.05,0.30
DEL 1
DEL 1
To complete this, you will want to see this in your floor plan. You
must write a 2D Script if it is to be visible. Open the 2D script
window and write the single line ‘PROJECT2 3,270,2’. Close
the object, return to the floor plan. Click the Object tool in the
Toolbox, click in the plan, and your chair will appear, with its own
hotspots provided by ArchiCAD.
The chair may not win a design award, but it is your first GDL
object – so reward yourself and then try another task.
parameter name box of the first one and write in a name for the
leg thickness parameter. Call it ‘tsec’ which is a 4-letter shorthand
for timber section. Write in the larger field something like ‘Timber
sectional size’ or equivalent. This is what the user will read when
they open your object – so make your description a model of
clarity. Then enter a starting value, such as 0.05 meters. If your
system settings are in another unit system, write in 50 mm, or 2” or
whatever suits you.
Add in more parameter names. Try ‘seathit’ for Seat height,
‘legmat’ for Leg material and so on. Think about the parameters
you might want to change. You will find a button in the same
parameter building box that you can pop-up to reveal a palette to
tell GDL whether the parameter is a Dimension, a Material, Pen
color or whatever. This palette will be covered in more detail as
the exercises develop.
The commands for the seat and legs follow the logic of the 3D
model. You can use DEL to cancel cursor movements, just as in
3D. Unfortunately, you do not have a visible 2D cursor to tell you
where it is – you just have to keep a mental track of its location.
The command for the back upholstery sits in one place and issues
the RECT2 command by exact XY locations. We can keep the
PROJECT2 command in the script, but make it inactive by turning
it into a comment line.
Save the object and place it on the floor plan. You will find that it
generates the symbol instantaneously. It will also have hotspots.
You will also find (to your delight?) that the chair is stretchy.
Write your own hotspots
If you wish to guarantee that hotspots are where you want them to
be and that the object will be stretchy, you are better off writing
them yourself. Open the chair object again, and add the following
lines to the script you have written. Place the lines BEFORE the
ones that contain the rectangle commands. Hotspots only need the
X and Y location.
HOTSPOT2 0,0 !4 Corner stretch spots
HOTSPOT2 A,0
HOTSPOT2 A,B
HOTSPOT2 0,B
HOTSPOT2 A/2,B/2 !Pick up 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). Design and place your
hotspots as and where you need them.
Later in 2D GDL you can try commands like CIRCLE2, LINE2 and
ARC2.
Chapter 4
Practical Uses for GDL
Even in the early dawn of your GDL knowledge you can apply it
to useful tasks. It’s the best way to learn.
GDL in 2D
It is possible to build objects entirely as 2D, but for many building
components and furniture items, it is not so necessary. These can
usually be built with the 2D tools and saved as objects – as
previously demonstrated. In other cases, you can drop a 3D object
from the ArchiCAD Library into the floor plan, and ‘explode’ it –
making it a 2D group of lines. However, if you can think of
something that offers parametric properties, or you are scripting
something that you have already built in 3D, then there is a good
reason to learn scripting in 2D.
Let’s remind you of some of the common commands in 2D. Cross
reference the corresponding section of the GDL Reference Guide.
HOTSPOT2: allows you to post hotspots where you want them to
be. Normally GDL will give you ‘bounding box’ hotspots, but it is
far more powerful to place them where they will be useful – to
make objects stretchy, to mark out points along a circle, or to
make objects easier to pick up.
LINE2 x1,y1, x2,y2: draws a line from point x1,y1 to x2,y2.
RECT2 x1,y1, x2,y2: draws a rectangle from point x1,y1 to
x2,y2.
CIRCLE2 x, y, r: draws a circle at point x,y, of radius r.
ARC2 x, y, r, alpha, beta: draws part of a circle on
point x,y, of radius r, starting with angle alpha and ending at angle
beta – moving in an counterclockwise direction.
POLY2 and POLY2_ (underscore) are more powerful than any of
the above. You can draw any of the above shapes, plus many
other shapes, including ones with drilled holes and with a variety
of fill patterns.
ADD2, MUL2, ROT2, DEL are concerned with cursor movement,
and you have already seen them in use with the simple chair
example.
These last few hotspots are placed at the actual corners of the bed
as a result of the IF statements. Next, it is time to draw the actual
bed object.
RECT2 0,0, wid,len !Main Bed shape
!Pillows
IF bed=11 OR bed=12 THEN !Single
ADD2 wid/2, 0.2
RECT2 -0.35,-0.15, 0.35, 0.15 !pillow
DEL 1
ENDIF
IF bed=21 OR bed=22 THEN !Double
ADD2 wid/4, 0.2
RECT2 -0.32,-0.15, 0.32, 0.15 !pillow
ADD2 wid/2, 0
RECT2 -0.32,-0.15, 0.32, 0.15 !pillow
DEL 2
ENDIF
We use the flag (11, 12, 21, 22) to decide how to lay out the pillows.
Notice that by using OR, we can make the IF statement more
interesting. We use the parameter of ‘wid’ to know where to place
the pillow. In this case, we have a fixed size for pillows. Check by
clicking on the 2D view frequently to see how the script is working.
You will notice that some lines of the script are indented. This
makes it easier to read. Two good rules are to indent cursor
movements, and to indent the lines following an IF... THEN line.
If you haven’t saved already, this is a good time to save.
Boolean choices – let the user decide
We could add sophistication and user friendliness such as some
turned down sheets and a head board. So create two parameters,
and make them of the sort ‘Boolean’. This governs the making of a
binary choice, an On/Off, Yes/No question. You get a tick box.
Tick them in the ON condition. GDL sends the script a result of
zero (OFF) or one (ON).
!Sheets
IF shbk=1 THEN
POLY2 4,1, !Poly2 is an alternative
wid-0.4,0.4, !to the cluster of LINE
wid,0.8, !commands below
wid-0.4,0.8,
wid-0.4,0.4
! LINE2 wid-0.4,0.4,wid,0.8
! LINE2 wid-0.4,0.4,wid-0.4,0.8
! LINE2 wid-0.4,0.8,wid,0.8
LINE2 0,0.4,wid-0.4,0.4
LINE2 0,0.6,wid-0.4,0.6
ELSE
LINE2 0,0.4, wid,0.4
LINE2 0,0.6, wid,0.6
ENDIF
!Headboard and Hotspots
IF hdbd THEN
RECT2 0,0, 0.05,-0.05
RECT2 wid,0, wid-0.05,-0.05
RECT2 0.05,-0.01,wid-0.05,-0.04
HOTSPOT2 0,-0.05
HOTSPOT2 wid,-0.05
ENDIF
In the case of the ‘shbk’ flag, you ask if it equals one. Since these
two flags ‘shbk’ and ‘hdbd’ can only be 0 or 1 (false or true), you
can write in a simpler way as shown for ‘hdbd’. ‘IF hdbd THEN’
means that anything other than zero will be regarded as true.
The outline of the turned sheet could either be written with a
series of LINE2 statements, or you could try your hand at a
POLY2 statement. You have to write the XY coordinates of the
points of the polygon using parameters where possible, and you
need to repeat the first point at the end of the XY list. This ensures
that the polygon closes up. The POLY2 statement is followed by
the number of points in the list, and a control code of 1 (to draw
the lines). A POLY2 is cleaner code in that it can write many or all
of the lines you need in the one command.
If curiosity has not already driven you to try this, save the bed
object, place it in the floor plan, and practice stretching it,
backwards and forwards. See how it snaps from one size to
another. You could elaborate it further, giving the mattress
rounded corners (with ARC2), adding a footboard, and perhaps
!Simple Door
!Frame
MATERIAL fmat
ADDx -A/2
BLOCK fwid,B,fdep !left frame stile
DEL 1
ADDx A/2-fwid
BLOCK fwid,B,fdep !right frame stile
DEL 1
ADD -A/2,B-fwid,0
BLOCK A,fwid,fdep !door head
DEL 1
If you know precisely what door you want and how big it is, you
may be tempted to write it out in dimensions, not parameters. But
when you get more committed to the idea of your objects being
‘investment objects’, you will always prefer to write in parameters
than in dimensions.
BLOCK is always built from the near left corner, so when you
move the 3D cursor, you need to make adjustments, by deducting
the frame width. It is easier if you make each part of the frame and
use DEL to get back to the origin before doing the next part.
!Door
IF dang3<0 THEN dang3=0
IF dang3>90 THEN dang3=90
LET dwid=A-fwid*2 !Door width
LET dhit=B-fwid !Door height
MATERIAL dmat
ADDx dwid/2 !Move to right hand frame
ROTy 180-dang3 !Rotate door
ADDz -dthk !Settle it into rebate
BLOCK dwid,dhit,dthk
DEL 3
It is a good idea to keep the BLOCK command simple by defining
the value of Door width and Door height beforehand. This is not
important for the simple flush door – but it makes life much easier
if you want to make a panelled door later.
The use of the LET command is voluntary. If you write ‘dwid=A-
fwid*2’ that is not a matter of fact – it is a Command for ‘dwid’ to
have a new value. By putting LET in front of it, you are making it
plain that you are issuing a command. The GDL interpreter is not
worried whether you use LET or not – but it is easier for the
human reader to understand it. If you were to read the script
aloud, you would pronounce the equal sign (=) as ‘become’, as in
‘LET dhit become B-fwid’.
The door needs to hinge off one frame. It is a house rule in GDL
that doors hinge off the right-hand frame unless they are mirrored.
For the door to hinge correctly, you must move the 3D cursor to
the right hand frame and build the door from that point. This is
much more complicated than doing it from the left frame because
the BLOCK command always grows in a rightward direction. To
hang correctly, this door needs to appear to be growing in a
leftward direction. Therefore, rotate it by ‘-dang3’, and it will grow
out through the frame in diametrically the wrong direction. Now
add 180˚ to the angle so it becomes a rotation of ‘180-dang3’ and it
Object Making with ArchiCAD
55
Chapter 4: Practical Uses for GDL
finishes in the right direction. You have to learn little tricks like this
when using GDL. Play with the angles to understand this process.
You need one small ADDZ to let the door ‘sink’ into the rebate.
When the door is in a wall, you will be able to use the Mirror or
Rotate function to change the way it will turn. In a later chapter,
we will make elements using PRISM, and you would not have to
do such mental gymnastics with PRISM – because you can make it
grow in a leftward direction from the hinging edge.
It is the IF statement that allows GDL to be smart, so for a door, the
first smart thing we can do is to stop the door being turned so that
the hinge would break. GDL models do not have gravity or
collision protection, so some error correcting IF statements will
save your door from ‘breaking’. Below is the door in 3D, half open.
It is still on the ground, but will be upright when placed in a wall.
!Door
IF dang2<0 THEN dang2=0
IF dang2>90 THEN dang2=90
dwid=A-fwid*2 !Door width
ADD2 dwid/2,0
ROT2 180-dang2
RECT2 0,0,dwid,dthk
ARC2 0,0,dwid,0,dang2
DEL 2
Whenever you can, use the same algorithm as in the 3D script – it
may make the script longer, but it’s easier to write. Start with the
frames, and finish with the script for the door – using the same
little 180˚ trick used to get the door to swing the right way.
Because we want to be sure this is correct, we keep the
PROJECT2 command working and visible. Indeed, if you write in
a temporary Pen color (e.g., PEN 1 in front of the PROJECT2 and
PEN 10 in front of the rest of the script), the different pen colors
will show the 2D symbol building up. Because we are looking at
the door from the 90˚ camera angle, the frames end up in the
‘negative-Y’ side. So, most Y values in the script are minus. Where
you had BLOCK, you replace it with RECT2. Where you had ADD,
you replace it with ADD2. Where you had ‘dang3’ you replace with
‘dang2’.
When you have finished working, you can convert the PROJECT2
routine into a series of comments. Remove the PEN commands.
Leave these to the user to supply in the settings box of the door.
Save the Door object, return to the floor plan and admire your
handiwork. You should now be able to set different opening
angles for 2D and 3D.
Scale Sensitive 2D symbol – with Global Variables
Architects also like 2D objects to be scale sensitive. At 1:100, the
door may be a line, and the frame a simple shape, at 1:20, the door
should be shown in detail, with a rebated doorframe. It is possible
for the GDL object to know the current scale of the drawing and to
change accordingly.
ArchiCAD keeps an active memory of everything that is going on
in the current project. GDL can interrogate this memory and make
use of it. The current Drawing Scale, the current Northpoint, the
object’s position in the Floor plan, the current Story, the current
Wall thickness, etc. These ‘Global Variables’ are described in
Appendix A of the GDL Reference Manual.
As you work through this, have the 2D View window open, and
keep checking that the frames are turned the right way. You can
change the current scale by activating the scale button at the
bottom left of the 2D View window. You can now finish by
providing an alternative symbol for the door itself – the rectangle
can now be used for 1:50 or larger, and a simple line for smaller
drawing scales.
!Door
IF dang2<0 THEN dang2=0
IF dang2>90 THEN dang2=90
dwid=A-fwid*2 !Door width
ADD2 dwid/2,0 !Move to right hand frame
ROT2 180-dang2 !Hinge the door
IF GLOB_SCALE>51 THEN
LINE2 0,0,dwid,0 !Simple line
ELSE
RECT2 0,0,dwid,dthk !Rectangle
ENDIF
ARC2 0,0,dwid,0,dang2 !Door swing
DEL 2
Master Script is useful here
Notice again that you have to tell it again what ‘dwid’ (door width)
is. This is because 2D and 3D scripts do not talk to each other. If
you placed values for ‘rb’ (rebate), ‘dwid’ (door width) and the
error correcting routines into the Master Script, this could save you
some typing, centralize some of your fixed parameters, and inform
both the 2D and the 3D scripts of the correct values.
Build a pop-up menu with the VALUES command
For the 3D object door object, you would like to have a choice of
door styles, but how does one ask the user? In the days of
ArchiCAD 5.0, one had to have style 1, style 2, etc. Now you can
create a pop-up menu that allows the user to choose by name.
You can even have a visual display that shows each door as a
picture. You must have noticed this in the new Door objects in the
ArchiCAD 6.5 door library.
We can make a start here by offering a simple choice of a solid or
a panelled door.
First make a new parameter. Let’s call it ‘doortyp’. As the pop-up
menu will offer a choice of door styles in words, select the
parameter type ‘Abc’ which will be for text. Make a new parameter
for panelling material, called ‘panmat’.
It may take a few seconds for GDL to notice, but after a while,
‘doortyp’ will realize that it has a pop-up menu and will allow you
to choose one or the other. The little triangular symbol will appear
at the right of the parameter entry. As the choice of door style is
one of the most important parameters of the door, you could click
on the ‘Bold’ button to make the font heavier, and you could use
the little arrows at the left to push the parameter to the top of the
list. Then you should make a parameter for Panelling Material.
This pop-up menu brings two major benefits – the object is more
user friendly and it is impossible for the user to make a spelling
error or choose a silly option. Before we get too confident, we
have to put this pop-up menu to good use. Return to the 3D script
and make the choice work.
Chapter 5
The Power of PRISM
We discover a 3D command that adds real power to GDL.
This prism has been drawn out with the Slab tool in the ArchiCAD
floor plan. To illustrate how prisms work, the nodes have been
numbered in the order in which they were clicked. There are 13
points if you include the first point twice – the idea being that you
fully close the prism by returning to the start.
Now draw out a prism yourself of roughly the same shape (no
need to number the nodes). 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. Draw it so that one of
the points coincides with zero – the global origin.
Instant GDL
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 library part – and find out what its GDL code is by
dragging and dropping it into a GDL script window. 3D objects
should be dragged into a 3D script window, and 2D into 2D.
The first task is to make a prism for the outline of the window,
using A and B. You have to use PRISM_ (underscore) because
you are planning to drill a hole in the prism to form the window
frame. Work in a counterclockwise direction. Click in the 3D View
window when you have finished. Do not click until you have
finished – an incomplete Prism statement will result in an error.
Start with a Label and Material statement.
!Window Frame
MATERIAL frammat
PRISM_ 5,fdep,
-A/2,0,15,
A/2,0,15,
A/2,B,15,
-A/2,B,15,
-A/2,0,-1
Now you add the XY locations of the hole – based on the frame
width. End each XY with a 15. The number of nodepoints will be
increased because the number that make up the hole are added to
the number for the outline. You need 5 points to form a 4-sided
prism. So you will have to add another 5 points for the hole. We
recommend that you write the number of nodes as an expression
‘5+5’. This way, you can always remember how you arrived at the
final number. Here, this might seem elementary, but when you get
onto more complex prism shapes you will find this a useful tip.
As you work your way round the prism, make appropriate
additions and subtractions of the frame width ‘fwid’. If you finish
with something silly, then you may have put your plus and minus
signs in the wrong place. If you get an error you may have
Now you can add the Glass. For a fixed light, this will be the same
outline as the inside line of the hole in the frame. Therefore, to
build your glass easily, you can simply copy and paste the list of
points for the hole. Assume that the glass is at the midpoint of the
frame so lift the glass, and assume that the glass is 6 mm thick.
!Glass
MATERIAL glasmat
ADDz fdep/2
PRISM_ 5,0.006,
-A/2+fwid,0+fwid,15,
A/2-fwid,0+fwid,15,
A/2-fwid,B-fwid,15,
-A/2+fwid,B-fwid,15,
-A/2+fwid,0+fwid,-1
DEL 1
We have assumed that the frame is rectangular in section. This is
quite adequate for general 3D visuals and general arrangement
drawings for a building. If you wanted to include highly detailed
information about the frame profile, including rebates, etc., you
would have to use another command called TUBE. With TUBE,
you define a profile and pull that profile through a series of points
– the outline of the window – to form the frame. TUBE is beyond
the scope of this book, but when you have more experience with
Object Making with ArchiCAD
73
Chapter 5: The Power of PRISM
GDL, try it! For construction drawing purposes, you could put this
level of detail into the 2D symbol script, including scale sensitivity.
Add the Sill
This is more difficult. So far, the whole frame has been safely on
the ground, and we have only had to define its outline, and it was
produced in the right place. Prisms only grow upwards from the
XY ground plane. So the sill has to be made on end with the
PRISM command; then turned over and aligned with the window.
Make it at the origin first.
!Sill
MATERIAL frammat
PRISM 5,A,
0,0,
silproj,0,
silproj,fwid/2,
0,fwid,
0,0
This basic sill sticks up in the air. But you can see that by rotating
it 90˚ around Y and recessing it to the corner of the main frame, it
will be an easy job. Put the ROT and ADD commands in front of the
Sill prism, and remember to DEL afterwards. The right-hand image
shows the sill finally positioned, just before the DEL command is
issued.
!Sill
MATERIAL frammat
ROTy 90
ADDz -A/2
PRISM 5,A,
0,0,
silproj,0,
silproj,fwid/2,
0,fwid,
0,0
DEL 2
You can see at a glance that the use of PRISM leads to a clean 3D
image, whereas the use of BLOCK (as for the door) left a number
of untidy lines on the 3D view.
Try WALLHOLE
We all know that GDL windows and doors automatically cut a
rectangle based on A (width) and B (height). If this is too
simplistic for you, it is possible to dictate exactly what shape the
window should cut in the wall, irrespective of the actual window
frame that will fit. WALLHOLE is a command that is like a cookie
cutter – punches a hole in the wall, yet is easy to use - having the
same syntax as PRISM_. In fact, if you take the outline of the
window frame, that perfectly defines the list of XY locations for
the hole. It is not required for a simple window like this, but it is
valuable to know about WALLHOLE so that you are able to provide
a complex window shape when you need it.
The major limitation of WALLHOLE is that you cannot have indents
in the shape. A ‘D’ shape is acceptable, but an ‘L’ shape is not. If
you wanted to make a twin arch window, which requires a ‘B’
shape, you could overlap two ‘D’-shaped WALLHOLEs together.
Have a look through the Windows and Doors Specials chapter of
the GDL Reference Manual for more detailed explanation. Copy
and paste the original outline prism command, and then change its
label and the title.
!Cut the Hole!
WALLHOLE 5,1,
-A/2,0,15,
A/2,0,15,
A/2,B,15,
-A/2,B,15,
-A/2,0,-1
In place of the Prism thickness, you have a status code. This can
be either 0 or 1. If you make it 0, the reveal to the window will
adopt the color of the window frame (or whatever was the most
recent Material statement.) If you make it 1, the reveal will display
the characteristics of the wall.
Give it a curvy window head – Flags and Polylines
This is too early to go into the matter of polylines, but you might
like a glance at the future – and decide you like it. If you add a
masking value of 1000 to the 15 you can make the PRISM_ outline
follow a tangential curve. Let’s try this.
First you need to make a small pop-up menu. Make a new
parameter ‘winshape’, and write a short VALUES statement in the
Parameter Script.
Now, at the top of the 3D script write a short routine to parse the
result. This generates a value for a flag, ‘ws’.
IF winshape='Rectangular' THEN ws=0
IF winshape='Round-topped' THEN ws=1
We introduced the idea of flags earlier, in chapter 4, to remember
which sort of bed was required.
Final 3D script – we see the power of WALLHOLE
Let’s run through the whole of the 3D script from start to end.
!Window Frame
IF winshape='Rectangular' THEN ws=0
IF winshape='Round-topped' THEN ws=1
!Cut the Hole!
WALLHOLE 5,1,
-A/2,0,15,
A/2,0,15,
A/2,B,13,
-A/2,B,13+1000*ws,
-A/2,0,-1
Now you see why you need WALLHOLE. When you want a non-
rectangular window opening, WALLHOLE is essential. If you add
1000 to the mask value at the END of the curve, it will fly round
from the previous location forming a tangential curve. By
multiplying 1000 by ‘ws’ you can switch the curve ON and OFF.
Do the same thing to the actual frame.
!Window Frame
MATERIAL frammat
PRISM_ 5+5,fdep,
-A/2,0,15,
A/2,0,15,
A/2,B,13,
-A/2,B,13+1000*ws,
-A/2,0,-1,
-A/2+fwid,0+fwid,15,
A/2-fwid,0+fwid,15,
A/2-fwid,B-fwid+fwid*ws,13,
-A/2+fwid,B-fwid+fwid*ws,13+1000*ws,
-A/2+fwid,0+fwid,-1
There is a problem with the inside line of the hole. Because the
XY points at the inside head of the rectangular window are where
they are, a pure tangential curve will not run smoothly parallel to
the external outline. So you have to raise those two points to the
same height as the highest point on the external outline. Use the
flag ‘ws’ again to do this. The changes in the script are marked in
bold. If you are typing this, try it without the modification and you
will see the difference in quality.
Another point is that you do not want the curve to be interrupted
by many edge lines. Change the 15 to 13 at the start and end of the
curve; do this for the WALLHOLE and for the PRISMs for the Frame
and the Glass. If you check the section on prisms in the 3D Shapes
chapter of the GDL Reference Manual you will see that a masking
value of 13 removes the vertical lines. Leave them at 15 first, then
change them to 13, and compare the result in 3D.
!Glass
MATERIAL glasmat
ADDz fdep/2
PRISM_ 5,0.006,
-A/2+fwid,0+fwid,15,
A/2-fwid,0+fwid,15,
A/2-fwid,B-fwid+fwid*ws,13,
-A/2+fwid,B-fwid+fwid*ws,13+1000*ws,
-A/2+fwid,0+fwid,-1
DEL 1
As the internal line of the frame is the same as the outline of the
glass, you are able to copy and paste the list of XY locations. The
Sill does not change.
!Sill
MATERIAL frammat
ROTy 90
ADDz -A/2
PRISM 5,A,
0,0,
silproj,0,
silproj,fwid/2,
0,fwid,
0,0
DEL 2
This is just a start. Now you have worked through this example,
you may be willing to try more adventures on your own with
PRISM.
Chapter 6
Looking into
Autoscripted GDL
It is valuable to look into the scripts of objects generated without
GDL and know how to modify them.
with the pointer tool the object you have made from these 3D
tools. Then:
1. If the object has been made the right way up, use the
ArchiCAD File menu to Save Special as an ArchiCAD Object.
Save it into one of your loaded libraries.
2. If the object has been made the right way up, or on its side,
view in the 3D window in plan or elevation, Save the resulting
view as a library part – a .GSM object. Save it into one of your
loaded libraries.
Examine the 3D script of a typical autoscripted object
Open the table that was used as an example in Chapter 2, or make
yourself a quick table now using method 1 above. We will run
through explaining what is contained in the script, and then look
at ways of shortening and modifying it. Try to make it approx 1.5
m wide by 0.9 m deep.
The 3D script starts out with some labelling. It’s good to have date
and title and author at the start of the script. Do likewise when you
write creative scripts.
! Name : table_01.GSM
! Date : Monday, May 1, 2000
! Version : 6.50
! Written by ArchiCAD
MULX A/ 1.521409
MULY B/ 0.919806
MULZ ZZYZX/ 0.7
ADD 0.771409, 0.45, -0.0
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 1.5 meters by 0.9 meters, and the height was
0.7 meters.
ZZYZX is what GDL denotes for the height. This rather curious
name arises from the need to call it something related to Z. But it
could not be called Z as many older objects from ArchiCAD 4.5
and earlier used Z for other purposes and might no longer work in
5.0 and later. The GDL development team chose ‘zzyzx’ after a
small town in Arizona, the last town in the US telephone directory.
Because the autoscript is accurate to a millionth of a meter, you get
a vast number of trailing decimals.
Now you can see how stretchiness work in autoscripted objects. If
you stretch the table to 2.0 meters, the MULX command will
‘multiply everything in the X direction by A/1.521409’. As ‘A’ has a
newly stretched value of 2.0, the multiplication will be 2.0/
1.521409. This will make it slightly wider. If you stretch the height
to be 1.2 meters, the vertical components will all be multiplied by
1.2/0.7. The MULY command works in the same way.
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 meters from
the project origin. If you build very close to the project origin (it
must be the main project origin, not a temporary one) then this
offset will be very small. This offset will place the object’s own
origin within its own curtilage, usually, the bottom left-hand corner.
As this table was built centrally over the project origin, you can see
that the offset is approximately half the width and depth of the
table – so that it is putting the table’s own origin at one corner.
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.
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.
GLOB_SCRIPT_TYPE = 3
GLOB_CONTEXT = 3
GLOB_SCALE = 100
GLOB_NORTH_DIR = 90.0
GLOB_FRAME_NR = -1
GLOB_EYEPOS_X = -0.780905
GLOB_EYEPOS_Y = -0.557944
GLOB_EYEPOS_Z = 0.3
GLOB_TARGPOS_X = -1.26576
GLOB_TARGPOS_Y = -0.292552
GLOB_HSTORY_HEIGHT = 4.7
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 in the 90˚ direction, there was no animation taking place
(so the Frame number is set to -1), the camera eye and target
positions were noted, the drawing scale was 1:100. 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. Meanwhile, you can cheerfully delete
all lines beginning with ‘GLOB’.
!!Slab-016
PEN 1
ADDZ 0.67
GLOB_LAYER = " Library Constructions"
GLOB_ID = "Slab-016"
GLOB_INTID = 14
BODY -1
CPRISM_ "Limestone, shiny", "Limestone, rough",
"Limestone, rough",
5, 0.03,
-0.771409, 0.469806, 15,
0.75, 0.469806, 15,
0.75, -0.45, 15,
-0.771409, -0.45, 15,
-0.771409, 0.469806, -1
BODY -1
DEL 1
This is the first real 3D element in the script. It is obviously the
tabletop as it is only 3 cm thick and is 0.67 meters off the floor.
The tabletop was made with a Slab tool, and this always translates
into a ‘CPRISM_’. The syntax for CPRISM_ was explained in
chapter 5. The prism is lifted by 0.67 and drawn; then the DEL
command returns the cursor to the origin.
!!Slab-016
ADDZ 0.57
GLOB_INTID = 15
BODY -1
CPRISM_ "Limestone, shiny", "Limestone, rough",
"Limestone, rough",
10, 0.1,
-0.642659, 0.337009, 15,
0.615665, 0.337009, 15,
0.615665, -0.322618, 15,
-0.642659, -0.322618, 15,
-0.642659, 0.337009, -1,
-0.616168, 0.307869, 15,
0.583876, 0.307869, 15,
0.583876, -0.288179, 15,
-0.616168, -0.288179, 15,
-0.616168, 0.307869, -1
BODY -1
DEL 1
MULX A/ 1.50
MULY B/ 0.90
PEN pcol
!Tabletop
ADDZ zzyzx-tthik
cPRISM_ topmat, framat, framat,
5, tthik,
-0.75, 0.45, 15,
0.75, 0.45, 15,
0.75,-0.45, 15,
-0.75,-0.45, 15,
-0.75, 0.45, -1
DEL 1
For the tabletop, change the ADDZ command to be the total table
height minus the tabletop thickness. Then change the tabletop
thickness to our new parameter of ‘tthik’. Then clean up all the
‘millionth of a meter’ decimals to clean rounded dimensions. As
the CPRISM allows you to specify top material, bottom material
and side material within the command, replace all that Limestone
with your new material parameters of ‘framat’ and ‘topmat’.
Although it takes a bit more thinking about, you can do the same
thing to the frame under the table top, simplifying all the
dimensions down to two decimal places, and making it so that the
frame has a thickness of 30 mm. Accepting that the height of the
frame is 0.1 meters, you can work out how high it has to be raised
by the ADDZ command.
Notice that after the tabletop and the table frame commands are
complete, the GDL returns the cursor to the origin. This is good.
!Tableframe
ADDZ zzyzx-tthik-0.1
cPRISM_ framat, framat, framat,
10, 0.1,
-0.64, 0.34, 15,
0.64, 0.34, 15,
0.64,-0.34, 15,
-0.64,-0.34, 15,
-0.64, 0.34, -1,
-0.61, 0.31, 15,
0.61, 0.31, 15,
0.61,-0.31, 15,
-0.61,-0.31, 15,
-0.61, 0.31, -1
DEL 1
If you have followed thus far, you have momentum and you can
push this process to completion. Label and change the table legs in
the same way. Alter the height of the legs to the height of the table
minus the tabletop thickness. Change the materials to ‘legmat’.
!Legs
CPRISM_ legmat, legmat, legmat,
5, zzyzx-tthik,
-0.658554, 0.355553, 15,
-0.597624, 0.355553, 15,
-0.597624, 0.286676, 15,
-0.658554, 0.286676, 15,
-0.658554, 0.355553, -1
CPRISM_ legmat, legmat, legmat,
5, zzyzx-tthik,
0.567981, 0.355553, 15,
0.62891, 0.355553, 15,
0.62891, 0.286676, 15,
0.567981, 0.286676, 15,
0.567981, 0.355553, -1
CPRISM_ legmat, legmat, legmat,
5, zzyzx-tthik,
-0.658554, -0.269636, 15,
-0.597624, -0.269636, 15,
-0.597624, -0.338512, 15,
-0.658554, -0.338512, 15,
-0.658554, -0.269636, -1
CPRISM_ legmat, legmat, legmat,
5, zzyzx-tthik,
0.567981, -0.269636, 15,
0.62891, -0.269636, 15,
0.62891, -0.338512, 15,
0.567981, -0.338512, 15,
0.567981, -0.269636, -1
DEL TOP
To finish, you can issue a DEL TOP command. This is similar to
the DEL command, but it DELs everything, including all the MUL
commands at the beginning. If you write DEL 2, this will work
just as well. DEL 2 is better because it requires you to count the
cursor commands at the start of the script, which means that you
are in full control of the process – DEL TOP is just a guess.
Find and Replace, to clean up the script
Finally, you could use the Find and Replace command to weed out
all 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. Your text will
be cleaned up nicely.
Copy the prism command that produces one of the legs, and adapt
the XY locations as shown. Do a little sketch like this, and number
each corner. You can see that the prism starts from the top right,
and works its way anti-clockwise around the tableleg. It is
important to make sure the start point [1] is the same as the end
point [5]. Use the diagram to make sure you get your minus signs
in the right place.
You can simplify it even further. The only point in using CPRISM
is if the materials of top, bottom and sides are different. For
creative GDL with a solid prism that is all one color, you can use
plain PRISM, and declare the Material value beforehand. You can
remove the 15s and the underscore. Make sure you also remove
the trailing comma.
!One Leg - simplest statement
MATERIAL legmat
PRISM 5, zzyzx-tthik,
0.035, 0.035,
-0.035, 0.035,
-0.035,-0.035,
0.035,-0.035,
0.035, 0.035
Now that you have a single leg, you can use the ADD command
and post a leg to each corner of the frame. Now that the frame and
leg are defined precisely, you will have a precise connection of
frame and leg that will look good close up. If you remember, the
internal line of the table frame was defined in meters. So you can
use the same dimensions.
!All Leg - simpler statement
MATERIAL legmat
ADD -0.61, 0.31, 0
PRISM 5, zzyzx-tthik,
0.035, 0.035,
-0.035, 0.035,
-0.035,-0.035,
0.035,-0.035,
0.035, 0.035
DEL 1
ADD 0.61, 0.31, 0
PRISM 5, zzyzx-tthik,
0.035, 0.035,
-0.035, 0.035,
-0.035,-0.035,
0.035,-0.035,
0.035, 0.035
DEL 1
ADD 0.61,-0.31, 0
PRISM 5, zzyzx-tthik,
0.035, 0.035,
-0.035, 0.035,
-0.035,-0.035,
0.035,-0.035,
0.035, 0.035
DEL 1
ADD -0.61,-0.31, 0
PRISM 5, zzyzx-tthik,
0.035, 0.035,
-0.035, 0.035,
-0.035,-0.035,
0.035,-0.035,
0.035, 0.035
DEL 1
As each leg is built, you use DEL 1 to get back to the origin, and
wait for the next command.
The table legs now have a clean relationship with the frame – as
in a mortice and tenon joint
Object Making with ArchiCAD
91
Chapter 6: Looking into Autoscripted GDL
You are probably getting worried by this time about the amount of
typing involved. If you make the maximum use of Copy and Paste,
the amount of typing is not huge as most of your effort is in
modifying commands rather than typing from new.
You might also want the option to change the leg shape from
square to cylinder or cone. For this you would need to reorganize
the script so that the legs are capable of having different shapes.
The key to this is the SUBROUTINE. This is where a group of code
is used often. Instead of retyping it again and again, it is better to
give it a number, and just call it by number with a GOSUB
command when a leg needs to be drawn. This tableleg is the ideal
opportunity to illustrate the use of the subroutine. See chapter 7
for more on subroutines.
!All Leg - simpler statement
MATERIAL legmat
ADD -0.61, 0.31, 0
GOSUB 100:!Draw one leg
DEL 1
ADD 0.61, 0.31, 0
GOSUB 100:!Draw one leg
DEL 1
ADD 0.61,-0.31, 0
GOSUB 100:!Draw one leg
DEL 1
ADD -0.61,-0.31, 0
GOSUB 100:!Draw one leg
DEL 1
Somewhere, further down in the script, after an END command,
you can have a subroutine numbered 100 that contains the PRISM
statement.
Cautionary note for modifying objects in this way
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.
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.
PEN 1
SET FILL "25 %"
POLY2_B 22, 3, 1, 91,
-0.000071, 0.06026, 1,
0.048921, 0.06026, 1,
0.048921, 0.051348, 1,
0.055658, 0.217545, 900,
0.0, 25.2526, 4001,
0.120465, 0.064357, 1,
0.13148, 0.020407, 900,
0.0, -80.7543, 4001,
0.173089, 0.03834, 1,
0.180185, 0.036271, 900,
0.0, -147.4796, 4001,
0.18728, 0.03834, 1,
0.229512, 0.016782, 900,
0.0, -74.8857, 4001,
0.239313, 0.063174, 1,
0.327746, 0.331473, 900,
0.0, 17.8153, 4001,
0.325639, 0.048983, 1,
0.325639, 0.059626, 1,
0.374715, 0.059626, 1,
0.179133, -0.056834, 1,
-0.000071, 0.06026, -1
HOTSPOT2 -0.000071, 0.06026
HOTSPOT2 0.048921, 0.06026
HOTSPOT2 0.048921, 0.051348
HOTSPOT2 0.120465, 0.064357
HOTSPOT2 0.173089, 0.03834
HOTSPOT2 0.18728, 0.03834
HOTSPOT2 0.239313, 0.063174
HOTSPOT2 0.325639, 0.048983
HOTSPOT2 0.325639, 0.059626
HOTSPOT2 0.374715, 0.059626
HOTSPOT2 0.179133, -0.056834
HOTSPOT2 -0.000071, 0.06026
Copy only the list of XY points across to the 3D script window,
and delete the hotspots and all the rest.
Delete the last point in the list (which is simple a repeat of the first
point). Delete the second last point (which is the ‘silly’ point).
Now add the REVOLVE command above the list of points. The
word REVOLVE is followed by the number of points (was 22, now
20), the angle through which the profile should be revolved (360˚)
and finally a masking value, which you can assume to be 63.
PEN 1
MATERIAL 'Whitewash'
RESOL 16
REVOLVE 20,360,63,
-0.000071, 0.06026, 1,
0.048921, 0.06026, 1,
0.048921, 0.051348, 1,
0.055658, 0.217545, 900,
0.0, 25.2526, 4001,
0.120465, 0.064357, 1,
0.13148, 0.020407, 900,
0.0, -80.7543, 4001,
0.173089, 0.03834, 1,
0.180185, 0.036271, 900,
0.0, -147.4796, 4001,
0.18728, 0.03834, 1,
0.229512, 0.016782, 900,
0.0, -74.8857, 4001,
0.239313, 0.063174, 1,
0.327746, 0.331473, 900,
0.0, 17.8153, 4001,
0.325639, 0.048983, 1,
0.325639, 0.059626, 1,
0.374715, 0.059626, 1
If this lathed shape is a stone baluster, you only have to precede the
command with a ROTY -90 command and it will stand upright.
The RESOL command is most important. 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 stone
balusters 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 or Art•lantis.
The benefit of being a GDL user is that you can control the
number of polygons with a simple RESOL command.
Chapter 7
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.
7.2 Subroutines
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 call the subroutine with a
GOSUB command. For example, in the case of our basic chair in
Chapter 3, if your chair has an elaborate leg that takes a hundred
lines to describe and you have four legs to do, you would not
want to type that all out again, in fact you would not even want to
copy and paste the leg four times.
!All the legs
GOSUB 100:!One leg
ADDX A
GOSUB 100:!One leg
ADDY B
GOSUB 100:!One leg
ADDX -A
GOSUB 100:!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.
!Chair
GOSUB 200:!All the Legs
GOSUB 300:!Draw the Seat
GOSUB 400:!Build the Back
END !-----------------------------
100:!One single leg
BLOCK tsec,tsec,seathit-tsec
RETURN
200:!All the legs
GOSUB 100:!One leg
ADDx A
GOSUB 100:!One leg
ADDy B
GOSUB 100:!One leg
ADDx -A
GOSUB 100:!One leg
DEL 3
RETURN
In this case, you would 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. 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 and a label, and end with
the command RETURN. Subroutines may call other subroutines.
Subroutines must be self contained; the number of DELs must
exactly equal the number of cursor movements.
Subroutines are used to help with decision making
When you have defined a flag, like ‘ws’ for window shape, to be
valued 0, 1 or 2, you can issue a GOSUB command that includes
the flag in the line number. For example:
GOSUB 100+ws !Window
END:!-----------------------------------
100:!Rectangular window
...........
RETURN
101:!Round topped window
...........
RETURN
102:!Gothic window
...........
RETURN
7.3 Loops
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.
!Capping piece
ADD -0.05,0,1.0
ROTY 90
CYLIND 3.1,0.05
DEL 2
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.
We can improve the way the loop is coded in one small way. The
first one worked fine, but we had to DEL all the cursor moves
AFTER the loop was complete. This method includes the DEL
inside the loop, so that the loop is cleanly self-contained.
FOR k=1 TO 6 STEP 1
ADDX pspac*(k-1)
CYLIND 1.0,0.05
DEL 1
NEXT k
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 both cases, we specified the stepping rate to be ‘1’. If
it is ‘1’, you can omit that STEP command, 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 meters, or 1.0 degrees!
Loop by Distance
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 ‘d’ (which is zero) and plant a pole.
Then return to zero. Then increment the value of ‘d’ by ‘pspac’,
then advance ‘d’ (which by now has been incremented), plant
another pole, then return to zero. Do this until you have covered a
total distance of 3.0 metres.’
pspac=0.6 !Pole spacing
FOR d=0 TO 3.0 STEP pspac
ADDx d
CYLIND 1.0,0.05
DEL 1
NEXT d
Loop by Angle
There are many occasions when your object has interesting circle
geometry. Here is the same handrail, but now it’s on a curved
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 RADIUS. ELBOW is like a cylinder but it
curves at a defined radius, to a defined angle.
ELBOW curve radius, alpha angle, tube radius
In this case, it is a 180˚ curve angle. 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.
RADIUS small radius, large radius
RADIUS does something similar to the RESOL command.
However, RESOL is too simple. In this elbow, we have two curves,
the main curve and the tubing curve. If we have a large resolution
so that the rail looks right, the tubing will have too many
polygons, and the computer could be crippled trying to shade all
those surfaces.
If you issue a RADIUS command, all radii equal to or less than the
small radius will have a RESOL 6, and all radii equal to or greater
than the larger one will have a RESOL of 36. All radii with in
between values will have in between values of RESOL. It is a very
useful command.
!Circular racecourse rail
RADIUS 0.05,0.3
crad=3.0 !Curve Radius
ADDz 1.0
ROTx -90
ELBOW crad,180,0.05
DEL 2
ADDx crad
FOR ang=0 TO 180 STEP 15
ROTz ang
ADDx crad
CYLIND 1.0,0.05
DEL 2
NEXT ang
DEL 1
We have to move to the centre of the circle first. Turn to face in
one direction using the ROTZ command, move out to the rail with
an ADDX command, and draw the post. Withdraw to the centre
again, increment the value of ‘ang’ by 15˚, then do the next one.
One final DEL returns you to the starting place.
Other possibilities
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.
Index
2D 13
2D Script 38, 49
First steps with ~ 44
"killer command" 38
3D 14, 98
~ Cursor 35
~ Entities 34
~ Pixel 43
~ Projections 16
~ Script 34
~ Space 35
~ View 36
A
ADD 36
Add-ons 5
add-ons 3
ADD2 44, 48
ARC2 45, 48
ArchiSite 5
Art•lantis Render 5, 95
Autoscripted GDL 82
B
BASIC 9, 98
Binary 5
Binary 3D 23
BLOCK 34, 39
Boolean choices 51
BPRISM_ 69
C
Chair 18, 39
CIRCLE2 45, 48
Commas 71
Comment 33
CONE 34 L
Cones 22
CPRISM 6 Label 37
CPRISM_ 69 Lamp 7
CSLAB 6 LET 55
CUTPLANE 69 Libraries
CYLIND 34, 102 ArchiCAD ~ 4
Complementary ~ 4
D DXF and DWG ~ 4
listing ~ parts 10
DEL 38 loading ~ 3
Door 53 LINE2 45, 48
DWG 4 Location awareness 58
DXF 4, 95 Loops 101
DXF/DWG Conversion 4 DO... WHILE 104
FOR... NEXT 104
REPEAT... UNTIL 104
E WHILE 104
ELBOW 46, 103
Error checking 43
M
Magic Wand 12, 21
F Manufacturers' Rules 43, 63
Fill tool 13 Marquee 25
Find and Replace 70, 89 Masking codes 68
Flags 50, 76 MASS 6
FPRISM 69 Master Script 33, 60
Master window 32
G MATERIAL 34
MUL 36, 83
GDL Cookbook 2, 98 MUL2 48
GDL Object Web Plug-in 4
Global Variables 58, 85 O
H Object Factory 4
Objects On Line 4
hotspot 13
HOTSPOT2 48 P
Hotspots 45
Parameter Script 33
I Parameter table 32
Parametric 7, 40, 87
IF... ENDIF 50 POLY2 48, 52
IF… ENDIF 62 POLY2_ 48
Instant GDL 67, 93 Polylines 76
Internet Pop-up menu 60, 76
Objects on the ~ 4 Preview Picture 33
Investment object 9 Preview picture 63
PRISM 66, 69
PRISM_ 69
Prisms 66, 69
Profiler 5 Z
PROJECT2 38, 44, 56, 75
Properties Script 33, 63 Zoom 4
ZZYZX 84
R
RADIUS 103
RECT2 48
RESOL 95, 103
REVOLVE 93
Roof Truss 20
Roof vault 25
RoofMaker 5
ROT 36
ROT2 48
S
Scale
drawing ~ 58
Slab tool 14, 18
SPHERE 34
SPRISM_ 69
StairMaker 5
Status code 76
Stretchiness 41, 49, 83
stretchiness 12
SUBROUTINE 92
Subroutines 99
T
Table 14, 83
U
User Interface Script 34
V
VALUES 60, 76
W
Wall tool 18
WALLHOLE 57
Window 15, 71
X
XWALL 6
Contents
Chapter 1: Introduction to Object Making 1
1.1 About Object Making _____________________________________________________ 2
Library Parts in ArchiCAD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
Sources of Library Parts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
1.2 Making your own Library Parts ___________________________________________ 6
Without GDL – using ArchiCAD’s Tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
Making Objects with GDL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
How do you make an Object? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
Does it need to LOOK right, or BE right? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
The Idea of an ‘Investment object’ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
Can you learn GDL? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
Object Making in the ArchiCAD Manuals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10