Cavity Closure Macro
1. General Description
This macro is commonly used by ArchiCAD windows, doors and wallholes to cut hole in the wall, draw cavity closure and turned plasters in 2D.
The macro's output fulfils the following requirements:
- all wall geometries currently supported in ArchiCAD (straight, trapeze, curved or polygonal) are handled well
- handles four reveal methods (no reveal, positive, negative, slanted) in all wall geometries
- handles curved panel windows in curved walls
- uses the composite line structure of the wall
- avoids overlapping polygons for DXF/DWG export using
wallhole2 - handles contour / inner status of lines for DXF/DWG export
- all display modes (solid modes also) are concerned and handled well
- can turn any number of brickwork skins in traditional mode
- can turn any number of plaster skins
2. Parameters
| Name | Type | Description | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| gs_macro_version | Integer | Version of the macro | ||||||||||||
| AC_Hole_Display_Option | Integer | Floor plan display option | ||||||||||||
| AC_WallType | Integer | Wall type
|
||||||||||||
| AC_WallContourPolygon | Length, Array[x][3] | Wall contour polygon definition (only for polygonal walls) | ||||||||||||
| AC_Wall_Direction_Type | Integer | Wall direction type
|
||||||||||||
| refWidth | Length | Reference width, used to place the hole in curved walls | ||||||||||||
| leftWidth | Length | Hole left side from the origin | ||||||||||||
| rightWidth | Length | Hole right side from the origin | ||||||||||||
| bWndCurved | Boolean | Is the window made of curved panels? | ||||||||||||
| bDrawObjContourIn | Boolean | Draw wall contours with LINE2 lines at the board (inner) side | ||||||||||||
| bDrawObjContourOut | Boolean | Draw wall contours with LINE2 lines at the sill (outer) side< | ||||||||||||
| bDrawFrameContourLeft | Boolean | Draw wall contour with LINE2 lines at the left side. Only at the window frame | ||||||||||||
| bDrawFrameContourRight | Boolean | Draw wall contour with LINE2 lines at the right side. Only at the window frame | ||||||||||||
| bCornerWindow | Boolean | Is the hole part of a corner window? | ||||||||||||
| fillWallHole | Fill | Wallhole cover fill type (only for polygonal walls) | ||||||||||||
| penWallHoleFg | Pen | Wallhole cover fill pen (only for polygonal walls) | ||||||||||||
| penWallHoleBg | Pen | Wallhole cover fill background pen (only for polygonal walls) | ||||||||||||
| penWallContour | Pen | Wall contour pen (only for polygonal walls) | ||||||||||||
| iWallContourLine | Integer | Wall Contour Line (only for polygonal walls)
|
||||||||||||
| gs_wcont_line_in | LineType | Wall contour line type inside (only for polygonal walls) | ||||||||||||
| gs_wcont_line_out | LineType | Wall contour line type outside (only for polygonal walls) | ||||||||||||
| gs_oversize_left | Length | Left opening oversize (only for polygon walls) | ||||||||||||
| gs_oversize_right | Length | Right opening oversize (only for polygon walls) | ||||||||||||
| - | - | Reveal parameters | ||||||||||||
| iRevealType | Integer | Reveal type
|
||||||||||||
| gs_reveal_left | Length | Reveal width on the left side | ||||||||||||
| gs_reveal_right | Length | Reveal width on the right side | ||||||||||||
| gs_reveal_left_angle | Length | Reveal angle on the left side (only for slanted reveal) | ||||||||||||
| gs_reveal_right_angle | Length | Reveal angle on the right side (only for slanted reveal) | ||||||||||||
| StackedWindow | Title | Stacked Window | ||||||||||||
| gs_stack_left | Boolean | Connection on the left | ||||||||||||
| gs_stack_right | Boolean | Connection on the right | ||||||||||||
| gs_maxPlasterThk | Length | Wall skin classification parameter. Consider Skin as Plaster if it is thinner this. | ||||||||||||
| gs_turn_plaster | Title | Turn Plaster | ||||||||||||
| gs_bAutoTurnOut | Boolean | Auto turn skins at opposite-side | ||||||||||||
| gs_bOverOut | Integer | Number of turned skins at opposite-side | ||||||||||||
| gs_bAutoTurnIn | Boolean | Auto turn skins at reference-side | ||||||||||||
| gs_bOverIn | Integer | Number of turned skins at reference-side | ||||||||||||
| - | - | Cavity Closure parameters | ||||||||||||
| gs_closureMethod | Title | Cavity Closure method
|
||||||||||||
| gs_cavity_side | String | Only effective in the Parameter script
|
||||||||||||
| bCavityCloserLeft | Boolean | Cavity Closure on the left side | ||||||||||||
| bCavityCloserRight | Boolean | Cavity Closure on the right side | ||||||||||||
| gs_nTurn | Integer | Number of turned skins in Traditional mode | ||||||||||||
| gs_nTurnDir | String | Direction of the turned skins
|
||||||||||||
| Traditional | Title | "Traditional" cavity closure method | ||||||||||||
| Strip | Title | Insulation strip (available only in traditional mode) | ||||||||||||
| gs_bJoint | Boolean |
Is there an insulation strip at the front side of the turned skins?
|
||||||||||||
| gs_thkJoint | Length | Thickness of the insulation strip. | ||||||||||||
| gs_penJoint | Pencolor | Contour pen of the insulation strip. | ||||||||||||
| gs_ltJoint | Linetype | Contour line type of the insulation strip. | ||||||||||||
| gs_fillJoint | Fillpattern | Fill pattern of the insulation strip. | ||||||||||||
| gs_penJointFg | Pencolor | Fill foreground pen of the insulation strip. | ||||||||||||
| gs_penJointBg | Pencolor | Fill background pen of the insulation strip. | ||||||||||||
| Insulated | Title | "Prefabricated" cavity closure method | ||||||||||||
| widthPlug | Length | Width of the insulation plug. | ||||||||||||
| gs_penPlug | Pencolor | Contour pen of the insulation plug. | ||||||||||||
| gs_ltPlug | Linetype | Contour line type of the insulation plug. | ||||||||||||
| gs_fillPlug | Fillpattern | Fill pattern of the insulation plug. | ||||||||||||
| gs_penPlugFg | Pencolor | Fill foreground pen of the insulation plug. | ||||||||||||
| gs_penPlugBg | Pencolor | Fill background pen of the insulation plug. | ||||||||||||
| gs_stCavityClosure | String | One dimension Array parameter for receiving locale strings |
Geometry Parameters
To clear the meaning of the geometry specific parameters used in Cavity Closure macro, see the following picture.
Fitting to curved and straight windows with the bWndCurved parameter.
3. Usage
Localization
The macro's default language is the English, but you can localize it with the gs_stCavityClosure parameter.
| Row | Default value | Description |
|---|---|---|
| 1 | None | Value list item - gs_closureMethod |
| 2 | Traditional | Value list item - gs_closureMethod |
| 3 | Prefabricated | Value list item - gs_closureMethod |
| 4 | Reference side | Value list item - gs_nTurnDir |
| 5 | Opposite side | Value list item - gs_nTurnDir |
| 6 | Both | Value list item - gs_cavity_side |
| 7 | Left | Value list item - gs_cavity_side |
| 8 | Right | Value list item - gs_cavity_side |
| 9 | Cavity Closure | UI String - tabpage name |
| 10 | Cavity Closure | UI String - static text (title of the lower left pane) |
| 11 | Closure Method | UI String - gs_closureMethod |
| 12 | Cavity Side | UI String - gs_cavity_side |
| 13 | Number of Outside Skins | Obsolete |
| 14 | Number of Turned Skins | UI String - gs_nTurn |
| 15 | Number from | UI String - gs_nTurnDir |
| 16 | Turn at Reveal | Obsolete |
| 17 | Insulation Strip | UI String - gs_bJoint (title of the right pane) |
| 18 | Thickness | UI String - gs_thkJoint |
| 19 | Contour Pen | UI String - gs_penJoint and gs_penPlug |
| 20 | Line Type | UI String - gs_ltJoint and gs_ltPlug |
| 21 | Fill Type | UI String - gs_fillJoint and gs_fillPlug |
| 22 | Fill Pen | UI String - gs_penJointFg and gs_penPlugFg |
| 23 | Fill Back. Pen | UI String - gs_penJointBg and gs_penPlugBg |
| 24 | Profile | UI String - static text (title of the right pane) |
| 25 | Width | UI String - gs_widthPlug |
| 26 | Turn Plaster | UI String - static text (title of the upper left pane) |
| 27 | Reference-Side | UI String - static text |
| 28 | Opposite-Side | UI String - static text |
| 29 | Auto | UI String - gs_bAutoTurnOut, gs_bAutoTurnIn |
| 30 | Number of Skins to Turn | UI String - gs_bOverOut, gs_bOverIn |
| 31 | Consider Skin as Plaster if it is thinner than: | UI String - gs_maxPlasterThk |
Example scripts
The following example scripts demonstrates the usage of this macro:
Master Script
The window object has to define the string tables for the gs_closureMethod, gs_cavity_side and gs_nTurnDir parameters.
EPS = 0.0001 dim gs_stCavityClosure[] gs_stCavityClosure[ 8] = "" gs_stCavityClosure[ 1] = `None` gs_stCavityClosure[ 2] = `Traditional` gs_stCavityClosure[ 3] = `Prefabricated` gs_stCavityClosure[ 4] = `Reference side` gs_stCavityClosure[ 5] = `Opposite side` gs_stCavityClosure[ 6] = `Both` gs_stCavityClosure[ 7] = `Left` gs_stCavityClosure[ 8] = `Right`
2D Script
In the 2D script the window has to contain the following code portion. In addition it has to empty the transformation stack before calling this macro (eg. with a del top command)
drawindex 40 ! Draw LINE2 wall contour lines at the top refWidth = A leftWidth = A / 2 + gs_left_oversize rightWidth = A / 2 + gs_right_oversize if iRevealType = 1 then ! Positive Reveal if SYMB_ROTANGLE > EPS exor SYMB_MIRRORED then gs_reveal_left = WIDO_RIGHT_JAMB gs_reveal_right = WIDO_LEFT_JAMB else gs_reveal_left = WIDO_LEFT_JAMB gs_reveal_right = WIDO_RIGHT_JAMB endif endif bCavityCloserLeft = (gs_cavity_side = gs_stCavityClosure[6] | \ ! Both Sides gs_cavity_side = gs_stCavityClosure[7]) ! Left Side bCavityCloserRight = (gs_cavity_side = gs_stCavityClosure[6] | \ ! Both Sides gs_cavity_side = gs_stCavityClosure[8]) ! Right Side call "CavityClosure", parameters all refWidth = refWidth, leftWidth = leftWidth, rightWidth = rightWidth, bWndCurved = gs_IsCurved, bCavityCloserLeft = bCavityCloserLeft, bCavityCloserRight = bCavityCloserRight, bDrawObjContourIn = 0, bDrawObjContourOut = 0, bDrawFrameContourLeft = 1, bDrawFrameContourRight = 1, bCornerWindow = 0, fillWallHole = gs_wallhole_fill, penWallHoleFg = gs_wallhole_pen_fg, penWallHoleBg = gs_wallhole_pen_bg, iWallContourLine = iWallContourLine, gs_wcont_line_in = gs_wcont_line_in, gs_wcont_line_out = gs_wcont_line_out, penWallContour = gs_pen_2D, iRevealType = iRevealType, gs_reveal_left = gs_reveal_left, gs_reveal_right = gs_reveal_right, gs_reveal_left_angle = gs_reveal_left_angle, gs_reveal_right_angle = gs_reveal_right_angle, gs_stack_left = 0, gs_stack_right = 0, gs_bAutoTurnIn = gs_bAutoTurnIn, gs_bOverIn = gs_bOverIn, gs_bAutoTurnOut = gs_bAutoTurnOut, gs_bOverOut = gs_bOverOut, returned_parameters thkSkinTurnInLeft, ! Thickness of turned plaster skins thkSkinTurnInRight, ! at the opposite side thkSkinTurnOutLeft, ! Thickness of turned plaster skins thkSkinTurnOutRight,! at the reference side penSkinContourIn, ! Skin contour pen opp. side penSkinContourOut, ! Skin contour pen ref. side ltSkinContourIn, ! Skin contour line type opp. side ltSkinContourOut ! Skin contour line type ref. side drawindex 30 ! Draw Window below Cavity Closure
Parameter Script
For implementing the parameter logic of the Cavity Closure, you have to call this macro passing the following parameters.
! ============================================================================= ! Do Cavity Closure Parameter Logic ! ============================================================================= call "CavityClosure" parameters gs_macro_version = 11, gs_bAutoTurnIn = gs_bAutoTurnIn, gs_bAutoTurnOut = gs_bAutoTurnOut, gs_bOverIn = gs_bOverIn, gs_bOverOut = gs_bOverOut, gs_maxPlasterThk = gs_maxPlasterThk, gs_closureMethod = gs_closureMethod, gs_nTurnDir = gs_nTurnDir, gs_nTurn = gs_nTurn, gs_bJoint = gs_bJoint, ! --- String Resource --- gs_stCavityClosure = gs_stCavityClosure
UI Script
For implementing the user interface page in your object, just call the macro from the UI script.
! ============================================================================= ! Cavity Closure Settings Tabpage ! ============================================================================= gs_stCavityClosure[31] = "" gs_stCavityClosure[ 9] = `Cavity Closure` gs_stCavityClosure[10] = `Cavity Closure` gs_stCavityClosure[11] = `Closure Method` gs_stCavityClosure[12] = `Cavity Side` gs_stCavityClosure[13] = `Number of Outside Skins` gs_stCavityClosure[14] = `Number of Turned Skins` gs_stCavityClosure[15] = `Number from` gs_stCavityClosure[16] = `Turn at Reveal` gs_stCavityClosure[17] = `Insulation Strip` gs_stCavityClosure[18] = `Thickness` gs_stCavityClosure[19] = `Contour Pen` gs_stCavityClosure[20] = `Line Type` gs_stCavityClosure[21] = `Fill Type` gs_stCavityClosure[22] = `Fill Pen` gs_stCavityClosure[23] = `Fill Background Pen` gs_stCavityClosure[24] = `Profile` gs_stCavityClosure[25] = `Width` gs_stCavityClosure[26] = `Turn Plaster` gs_stCavityClosure[27] = `Reference-Side` gs_stCavityClosure[28] = `Opposite-Side` gs_stCavityClosure[29] = `Auto` gs_stCavityClosure[30] = `Number of Skins to Turn` gs_stCavityClosure[31] = `Consider Skin as Plaster if it is thinner than:` call "CavityClosure" parameters gs_macro_version = 11, gs_closureMethod = gs_closureMethod, gs_bJoint = gs_bJoint, gs_stCavityClosure = gs_stCavityClosure, idTab_CavityClosureSettings = 1 ! ui_page index
Wall skin classification
The gs_maxPlasterThk parameter helps to identify the wall wrapper (plaster) skins. The macro starts to evaluate the wall skins from the sides of the wall. A skin is considered as wrapper (plaster) if it is thinner than the gs_maxPlasterThk's value and is not a core skin. The evaluation stops when the first skin is reached which doesn't fulfill these requirements.
The classified wrapper (plaster) skins affect both the Turn Plaster and the Cavity Closure functions.
Turned plasters
The macro can turn all skins classified as wrapper (plaster) skins automatically depending on the gs_bAutoTurnIn and gs_bAutoTurnOut parameters.
If manual turn was selected the macro can turn any number of skins given with the gs_bOverIn and gs_bOverOut parameters. The number of turned skins is limited to the number of skins classified as wrapper (plaster).
The Turn Plaster function is independent from the cavity closure mode being used inside the wall. The turned part of the plaster has the same thickness as the normal part in the composite structure (marked with T in the following figure). Note, that the plaster is turned to the window frame.
The second image displays the contour lines only which are used in DXF/DWG export.
Traditional mode
The turned skins are continuous if the insulation strip is turned off and the turned brick skin meets a skin with same fill attributes.
Prefabricated mode
This is the newer approach of cavity closure done in Archicad.
The plug fits between the first and the last skin that has no wrapper (plaster) classification.




