Windows and Doors in GDL
Index
1. Introduction
The scripting of doors and windows has extreme importance since these objects are visualized far more times than any other object type. This implies increased quality and optimality requirements.
To fulfill these requirements the GDL programmer should follow all general instructions presented in the previous sections and he has to pick some more information.
2. Review of requirements
- 2D and 3D representations of doors and windows have to be based on national standards (opening line, plan symbol in different scales, nominal opening, etc.).
- Doors and windows have to work error free in straight, trapeze and curved walls as well.
-
Openings are important in section drawings, correct model is required
according to the specification
(use
GLOB_CONTEXTglobal variable to distinguish between models). Sections may need a hollow model of the door/window - to omit filling polygons, don't recode the model for this, usemodel SOLIDmodifier if needed. - The result of rotating, mirroring and flipping has to be considered in scripting.
- Doors and windows have to be optimized for speed.
- Adoptation of scale-sensitivity defined in the specification is needed (2D and section!).
3. Positioning
There are general placing conventions for windows and doors. The library parts' coordinate system is in a special rotated position: the origin is placed in the bottom center of the wall opening, on the exterior side of the wall, and the x-y plane is vertical. Door/window zero level is on the external surface of the wall. What is outside of this is in the negative (-Z) range in 3D, and in the positive (+Y) range in 2D. A door is well defined if when inserting it in the wall, clicking to the right of the insertion point means that the door leaf is opening to the same side on the right. When a window is placed in the same way, the side that it is clicked to indicates the outer side.
The positioning of an opening can be one of 8 states. These are represented by three global variables in GDL:
-
mirroring to the Y-Z plane in 3D or to the Y axis in 2D (
SYMB_MIRRORED) -
mirroring by the longitudinal axis of the wall (rotation by 180 degrees:
SYMB_ROTANGLE) -
flipping (
WIDO_REVEAL_SIDE)
Usually each part of the window should react in a different way to these conditions. The specification must be clear on deciding how the parts of the object should, or should not, react to these conditions. E.g. a door leaf moves with this transformations, but the cavity closure does not. To keep the library part consistent, several transformations should be used for these combinations.
Illustration of the 8 states with a simplified door - the little circle flags the origin.
| Global variables | Example drawing |
|---|---|
| WIDO_REVEAL_SIDE = 0 SYMB_MIRRORED = 0 SYMB_ROTANGLE = 0 |
![]() |
| WIDO_REVEAL_SIDE = 0 SYMB_MIRRORED = 1 SYMB_ROTANGLE = 0 |
![]() |
| WIDO_REVEAL_SIDE = 1 SYMB_MIRRORED = 0 SYMB_ROTANGLE = 180 |
![]() |
| WIDO_REVEAL_SIDE = 1 SYMB_MIRRORED = 1 SYMB_ROTANGLE = 180 |
![]() |
| WIDO_REVEAL_SIDE = 1 SYMB_MIRRORED = 0 SYMB_ROTANGLE = 0 |
![]() |
| WIDO_REVEAL_SIDE = 1 SYMB_MIRRORED = 1 SYMB_ROTANGLE = 0 |
![]() |
| WIDO_REVEAL_SIDE = 0 SYMB_MIRRORED = 0 SYMB_ROTANGLE = 180 |
![]() |
| WIDO_REVEAL_SIDE = 0 SYMB_MIRRORED = 1 SYMB_ROTANGLE = 180 |
![]() |
Sample code undoing the automatic transformations done by ArchiCAD:
! 2D script bRotated = round_int (SYMB_ROTANGLE) = 180 if bRotated then rot2 180 endif if SYMB_MIRRORED then mul2 -1, 1 endif if WIDO_REVEAL_SIDE exor bRotated then add2 0, WALL_THICKNESS endif
! 3D script bRotated = round_int (SYMB_ROTANGLE) = 180 if bRotated then roty 180 endif if SYMB_MIRRORED then mulx -1 endif if WIDO_REVEAL_SIDE exor bRotated then addz -WALL_THICKNESS endif
Note that though flipping and mirroring is possible for all doors and windows, it is incorrect in manufacturer libraries where a library part models a real window - which, of course, cannot be turned inside out. In this case the script should undo the mirroring done by ArchiCAD.
4. Usage of the Detail window
General information
The edit boxes accept only 256 characters. This can be circumvented using a parameter here which gets its value in the parameter script.
These edit boxes represent one GDL code line. This implies the following:
- In the definition for oversize and wall inset values, only parameters and global variables can be used as variables, since the definition of variables is impossible.
-
Control flow statements cannot be used;
you can use logical functions for such purposes.
Clause conversion tips Original clause → Compressed clause if a < 100 then value = c + x
→ c + (a < 100) * x
if a < 100 then value = x else value = y endif
→ (a < 100) * x + not(a < 100) * y
if a < 100 then value = x else value = -x endif
→ (2 * (a < 100) - 1) * x
Nominal frame thickness
This value is used in the following contexts:
- When changing the reveal side (flipping), the library part is mirrored and dragged back by the value of the nominal frame thickness.
- When the 'Update zones' option is activated, the value for parapet wall inset should contain nominal frame thickness to have a correct result (see picture below).
-
Inserting an opening in a curved wall:
nominal frame thickness effecs the placing.
Parapet wall inset
The value set here will define the behavior of the zone fill when the 'Update zones' option is activated.
-1- It will have no effect on zones
-
(WIDO_REVEAL_SIDE * (WALL_THICKNESS - WIDO_SILL - WIDO_FRAME_THICKNESS) + not(WIDO_REVEAL_SIDE) * WIDO_SILL) * (2 * (abs(GLOB_ELEVATION) < 0.0001) - 1) -
The zone will show up on both sides of the frame (see picture below), even in the case of flipping.
For windows, it can be used when they are inserted in the wall without any parapet height
(
GLOB_ELEVATION = 0).
Oversizing
The oversize values have an effect on the size of the rectangular holes cut in the containing wall automatically by ArchiCAD for doors/windows. It can be used, for example, for placing a sunshade's box above the window; using scripted jambs instead of ArchiCAD jambs and so on. These values must be carefully designed during the specification phase to have a satisfactory result.
5. Special issues
Special opening shapes
When special shaped openings are requested try to avoid using filling bodies;
use wallhole and wallniche commands instead.
Using these, you should be able to crate any wall opening and delve shape.
If you still need a filling body, mind the following:
- Use all attributes of the wall (material, color, pen number etc.)
- Suit the segmentation of the containing wall.
-
Care for correct texture mapping (
coor). - Special care must be paid to the positioning problems: as the wall filling body should never react to the mirrored, rotated, flipped positions in the same way as the window/door itself, these transformations must be neutralized in the 2D/3D scripts.
Building a special window you cannot use the macros contained in the Basic Library, you have to model your own trim or shading devices. Doing this pay extra attention to correct segmentation and positioning.
Composite windows and doors
A window or door consists of many standard elements, like trim, shutter, sill, board, treshold, shading device, frame, sash, etc. The models and control logics of them may not be coded in all openings.
For structures built in the window, you should write a macro and use it in each window/door of your library. You can use the macro set of the Basic Library, too. This solution is needed when there is interaction between the window panel and the special structure - this is the typical case.
For elements which are not in close interaction with the window, you can write an independent object which can be placed on the according point of the opening by the user. F.ex.: shaders, separator columns for window stacking.
Scripted reveal
A scripted reveal is needed when the one created by ArchiCAD doesn't fulfill the needs. This way this functionality is an option of the library part in a parameterized form. This may be needed, for example, when the specification orders to omit the jamb in 1:100 scale. The scripted reveal must function for composite wall structures as well, and must react correctly to all positioning, even in asymmetric cases, both in 2D and 3D.
You have two main choices for the user interaction:
- use the built-in reveal parameters of ArchiCAD
- omit the built-in reveal parameters and use additional parameters.
In both cases you have to hide the reveals placed by ArchiCAD.
In 3D it can be simply done by using a proper wall_niche command,
while in 2D you have to use patching fills.







