18. Advanced door/window functions

Example files for this lesson can be downloaded here.

Door and window objects can be placed into not just straight walls with parallel faces, but trapezoid, curved, slanted or double slanted walls as well.
To be able to handle all placing and dimensioning challenges, one must get familiar with a new set of relevant global variables and fix named optional parameters.

Trapezoid walls

The sill-side is always on the perpendicular face of the wall, so not all possible placing combinations are available in this case:
The WALL_THICKNESS global is measured in the middle line of the wallhole.
The angle of inclination can be accessed via WALL_INCL global.
Using the wall angle and wall thickness values all necessary sizes can be calculated to create the window.

Curved walls

You need the distance of the wall’s origin for correct geometry calculations. This distance is always measured from the object origin (not wall face!), and can be accessed in WIDO_ORIG_DIST global.

The side cut of the opening can be parallel or radial: the automatic cut is always radial, while the WALLHOLE and WALLNICHE commands can create parallel sides as well.
Another thing you need to consider is whether you need a curved object for the curved wall or not. To fit a straight window into a curved wall one needs to set the window sizes carefully in order to stay within wall dimensions.

Slanted walls

Slanted walls can cause problems only if you want to keep the sill and the wallhole cuts horizontal. To be able to calculate with the slant angles, you need a way to access them first.
Add the following fix named optional parameters (angle type) to your door/window object, so ARCHICAD can fill out the data:

The default, vertical value is 90°.
If you do not use WALLHOLE or WALLNICHE commands, just rely on the extra subtype function, your object will look like this:
Every door and window object has a setting to decide between the 2 possible cutting types:
This value can be accessed in GDL via the ac_hole_direction_type fix named optional parameter (add it to the object’s parameter list).

You can manipulate the wallhole cutting angles using the wall slant angle values, to make the wallhole horizontal:

See the following code in the Window – Slanted Wall example AC19 object:

if ac_hole_direction_type = 1 then
	! normal hole for A-B size
	wallhole 5, 1,
		-a/2, 0, 15,
		 a/2, 0, 15,
		 a/2, b, 15,
		-a/2, b, 15,
		-a/2, 0, -1

	_ang = ac_wall_slant_angle2 - 90

	addz WIDO_FRAME_THICKNESS		! move to the outer side of frame

	wallniche 5, 1, 1,					! horizontal cut under sill:
        0, sin(_ang), cos(_ang), WIDO_SILL * 2 / cos(_ang),	! create a longer niche with the proper angle to cut the bottom
		-a/2, 0, 15,
		 a/2, 0, 15,
		 a/2, b, 15,
		-a/2, b, 15,
		-a/2, 0, -1

	del 1

WALLHOLE command is very similar to the PRISM-type commands, while WALLHOLE2 resembles POLY2_B{2} command regarding input parameters.
As for WALLNICHE, many similarities apply with CUTFORM.

To get more information about door-window special commands, visit this page of the GDL Manual.