Cavity Closure Macro
1. General Description
This macro is commonly used by ArchiCAD windows, doors and wallholes to draw cavity closure and turned wall skins in 2D.
The macro's output fulfils the following requirements:
- all wall geometries currently supported in ArchiCAD (straight, trapeze, curved) are handled well
- handles three reveal methods (no reveal, positive, negative) in all wall geometries
- handles curved panel windows in curved walls
- handles parallel openings 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 four brickwork skins per wall side in custom mode
- handles partial structure display option requirements
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
|
| gs_wallhole_geometry | Title | Wallhole Geometry |
| 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 |
| radSill | Length | Curved Wall - Sill Radius |
| radBoard | Length | Curved Wall - Board Radius |
| WOD | Length | Curved Wall - Wall Center Distance |
| offsetSill | Length | |
| offsetBoard | Length | |
| lineSections | Length Array[x][7] | |
| possibleSkinTurnIn | Integer | Number of plaster skins at the reference side |
| possibleSkinTurnOut | Integer | Number of plaster skins at the opposite side |
| maxSkinTurnIn | Integer | Number of possible turned plaster skins at the reference side |
| maxSkinTurnOut | Integer | Number of possible turned plaster skins at the opposite side |
| iRevealType | Integer | Reveal type
|
| AC_wido_sill | Length | Sill Depth |
| gs_reveal_type | String | "Reveal Type" |
| gs_reveal_double_innerType | String | "Inner Reveal Type" |
| leftRevealPnts | Length Array[1][2] | "Left Reveal Points" |
| rightRevealPnts | Length Array[1][2] | "Right Reveal Points" |
| iRevealPointsIdx | Integer Array[20] | "Reveal Points Index" |
| gs_reveal_left | Length | Reveal width on the left side |
| gs_reveal_right | Length | Reveal width on the right side |
| gs_reveal_double_innerLeft | Length | "Inner Left Jamb Depth" |
| gs_reveal_double_innerRight | Length | "Inner Right Jamb Depth" |
| gs_reveal_top | Length | "Head Depth" |
| gs_reveal_bottom | Length | "Sill Depth" |
| gs_reveal_double_innerTop | Length | "Inner Head Depth" |
| gs_reveal_double_innerBottom | Length | "Inner Sill Depth" |
| revealInnerLeft | Length | "Inner Left Jamb Depth" |
| revealInnerRight | Length | "Inner Right Jamb Depth" |
| gs_reveal_left_angle | Angle | Reveal angle on the left side (only for slanted reveal) |
| gs_reveal_right_angle | Angle | Reveal angle on the right side (only for slanted reveal) |
| gs_RevealTypeEnable | Integer | "Reveal and Closure Type Enable Mask" |
| gs_macro_control_parameters | Title | Macro Control Parameters |
| isWindow | Boolean | "Window or Door Type Object" |
| bWndCurved | Boolean | Is the window made of curved panels? |
| bParalellInCurvedWalls | Boolean | Parallel opening in curved walls |
| 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 |
| bForceContinousMode | Boolean | "Force Continuous Mode" |
| bCornerWindow | Boolean | Is the hole part of a corner window? |
| bLeftCornerFunction | Boolean | "Corner on Left" |
| bWindowSymbolAtMiddle | Boolean | "Window in the Middle of the Wall (CHI Special)" |
| ac_corner_angle | Angle | "Corner Angle" |
| ac_diff_con_wall_thk | Boolean | "Diff. Conn. Wall Thickness" |
| ac_con_wall_thk | Length | "Connecting Wall Thickness" |
| gs_opening_oversize | Title | "Oversize" |
| gs_left_oversize | Length | Left opening oversize (only for polygon walls) |
| gs_right_oversize | Length | Right opening oversize (only for polygon walls) |
| StackedWindow | Title | Ganging |
| gs_stack_left | Boolean | Connection on the left |
| gs_stack_right | Boolean | Connection on the right |
| gs_useWallFinishSkin | Boolean | Wall skin classification parameter. Use finish skin property of the composite stucture. |
| gs_maxPlasterThk | Length | Wall skin classification parameter. Consider skin as plaster if it is thinner than 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 |
| iClosureType | Integer | "Cavity Closure" |
| 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_showJoint | Boolean | "Show Insulation Strip" |
| 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 |
| gs_bDoorLining | Boolean | "Insert Door Lining" |
| gs_wdthDoorLining | Length | "Door Lining Width" |
| gs_thkDoorLining | Length | "Door Lining Thickness" |
| gs_DoorLining_side | Integer | "Door Lining Side" |
| gs_DoorLiningDir | Boolean | "Door Lining on Inside" |
| gs_penDoorLining | PenColor | "Door Lining Contour Pen" |
| gs_fillDoorLining | FillPattern | "Door Lining Fill Type" |
| gs_penDoorLiningFg | PenColor | "Door Lining Fill Pen" |
| gs_penDoorLiningBg | PenColor | "Door Lining Fill Background Pen" |
| gs_bForceHide_LeftWallCont | Boolean | "Hide Left Wall Contour Line" |
| gs_bForceHide_RightWallCont | Boolean | "Hide Right Wall Contour Line" |
| Prefabricated | Title | "Prefabricated" cavity closure method |
| gs_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 |
| CustomClosure | Title | "Custom" cavity closure method |
| gs_custom_cc_array_left | Length Array[8][4] | "Left Side Skin Data" |
| gs_custom_cc_array_right | Length Array[8][4] | "Right Side Skin Data" |
| gs_custom_cc_edit_jamb_side | String | "Edited Jamb Side" |
| gs_custom_cc_edit_wall_side | String | "Edited Wall Side" |
| gs_custom_cc_edit_skin | String | "Edited Skin Number" |
| gs_custom_cc_turn_in | Boolean | "Turn In Skin" |
| gs_custom_cc_thickness_type | String | "Turn In Thickness" |
| gs_custom_cc_thickness | Length | "Custom Thickness" |
| gs_custom_cc_orientation | String | "Hatch Orientation" |
| gs_custom_cc_separator | Boolean | "Separating Line at Turn In" |
| gs_custom_cc_separator_pen | PenColor | "Separating Line Pen" |
| gs_custom_cc_overhang | Length | "Skin Overhang to Frame Depth" |
| gs_custom_cc_last_sel_side | Boolean | "Last Selected Side" |
| idTab_RevealClouserSettings | Integer | "Tabpage ID" |
| gs_string_resources | Title | String Resources |
| stCavityClosureSide | String Array[3] | "gs_cavity_side" |
| stCavityClosureTurnDir | String Array[2] | "gs_nTurnDir" |
| stCavityClosureEditedJambSide | String Array[3] | "gs_custom_cc_edit_jamb_side" |
| stCavityClosureEditedWallSide | String Array[2] | "gs_custom_cc_edit_wall_side" |
| stCavityClosureEditedSkinNumber | String Array[4] | "gs_custom_cc_edit_skin" |
| stCavityClosureTurnInThickness | String Array[2] | "gs_custom_cc_thickness_type" |
| stCavityClosureHatchOrientation | String Array[2] | "gs_custom_cc_orientation" |
| stCavityClosureUI | String Array[32] | "" |
| stRevealClosureTypes | String Array[12] | One dimension Array parameter for receiving locale strings |
| stSubTabpageClosure | String Array[2] | One dimension Array parameter for receiving locale strings |
| gs_ui_sub_tab_closure | String | "Sub Tabpage Selector for Closures" |
| stRevealClusureUITips | String Array[13] | One dimension Array parameter for receiving locale strings |
Geometry Parameters
To clear the meaning of the geometry specific parameters used in CavityClosure 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 following parameters.
stCavityClosureSide parameter for the value list of the gs_cavity_side
| Row | Default value | Description |
|---|---|---|
| 1 | Both | Value list item |
| 2 | Left | Value list item |
| 3 | Right | Value list item |
stCavityClosureTurnDir parameter for the value list of the gs_nTurnDir
| Row | Default value | Description |
|---|---|---|
| 1 | Reference side | Value list item |
| 2 | Opposite side | Value list item |
stCavityClosureEditedJambSide parameter for the value list of the gs_custom_cc_edit_jamb_side
| Row | Default value | Description |
|---|---|---|
| 1 | Edit Both Jambs | Value list item |
| 2 | Edit Left Jamb | Value list item |
| 3 | Edit Right Jamb | Value list item |
stCavityClosureEditedWallSide parameter for the value list of the gs_custom_cc_edit_wall_side
| Row | Default value | Description |
|---|---|---|
| 1 | Reference Side | Value list item |
| 2 | Opposite Side | Value list item |
stCavityClosureEditedSkinNumber parameter for the value list of the gs_custom_cc_edit_skin
| Row | Default value | Description |
|---|---|---|
| 1 | 1. Skin | Value list item |
| 2 | 2. Skin | Value list item |
| 3 | 3. Skin | Value list item |
| 4 | 4. Skin | Value list item |
stCavityClosureTurnInThickness parameter for the value list of the gs_custom_cc_thickness_type
| Row | Default value | Description |
|---|---|---|
| 1 | Original | Value list item |
| 2 | Custom | Value list item |
stCavityClosureHatchOrientation parameter for the value list of the gs_custom_cc_orientation
| Row | Default value | Description |
|---|---|---|
| 1 | Original | Value list item |
| 2 | Turned in | Value list item |
stCavityClosureUI parameter for the static texts on the user interface
| Row | Default value | Description |
|---|---|---|
| 1 | Cavity Closure | UI string - static text (title of the lower left pane) |
| 2 | Closure Method | UI string - gs_closureMethod |
| 3 | Cavity Side | UI string - gs_cavity_side |
| 4 | Number of Outside Skins | Obsolete |
| 5 | Number of Turned Skins | UI string - gs_nTurn |
| 6 | Number from | UI string - gs_nTurnDir |
| 7 | Turn at Reveal | Obsolete |
| 8 | Insulation Strip | UI string - gs_bJoint (title of the right pane) |
| 9 | Thickness | UI string - gs_thkJoint |
| 10 | Contour Pen | UI string - gs_penJoint and gs_penPlug |
| 11 | Line Type | UI string - gs_ltJoint and gs_ltPlug |
| 12 | Fill Type | UI string - gs_fillJoint and gs_fillPlug |
| 13 | Fill Pen | UI string - gs_penJointFg and gs_penPlugFg |
| 14 | Fill Background Pen | UI string - gs_penJointBg and gs_penPlugBg |
| 15 | Profile | UI string - static text (title of the right pane) |
| 16 | Width | UI string - gs_widthPlug |
| 17 | Turn Plaster | Obsolete |
| 18 | Reference-Side | Obsolete |
| 19 | Opposite-Side | Obsolete |
| 20 | Auto | Obsolete |
| 21 | Number of Skins to Turn | Obsolete |
| 22 | Consider Skin as Plaster if it is thinner than: | Obsolete |
| 23 | Use Wall Finish Skins | Obsolete |
| 24 | Select Skin to Edit | UI string - gs_custom_cc_edit_wall_side and gs_custom_cc_edit_skin |
| 25 | Turn In Skin | UI string - gs_custom_cc_turn_in |
| 26 | 1. Turn-In Thickness | UI string - gs_custom_cc_thickness_type |
| 27 | Custom Thickness | UI string - gs_custom_cc_thickness |
| 28 | Hatch Orientation | UI string - gs_custom_cc_orientation |
| 29 | Separating Line at Turn In | UI string - gs_custom_cc_separator |
| 30 | Separating Line Pen | UI string - gs_custom_cc_separator_pen |
| 31 | 2. Skin Overhang to Frame Depth | UI string - gs_custom_cc_overhang |
| 32 | Consider Skin as Plaster if Thinner Than or Equal To | Obsolete |
stRevealClosureTypes parameter for the value list of the gs_reveal_closure_type
| Row | Default value | Description |
|---|---|---|
| 1 | No Reveal | Value list item |
| 2 | Reveal | Value list item |
| 3 | Negative Reveal | Value list item |
| 4 | Slanted Reveal | Value list item |
| 5 | Splayed Reveal | Value list item |
| 6 | Historic Reveal | Value list item |
| 7 | Traditional Cavity Closure | Value list item |
| 8 | Prefabricated Cavity Closure | Value list item |
| 9 | Custom Closure | Value list item |
| 10 | Studwall | Value list item |
| 11 | Studwall with Siding | Value list item |
| 12 | Brick Veneer | Value list item |
stSubTabpageClosure parameter for the value list of the gs_ui_sub_tab_closure
| Row | Default value | Description |
|---|---|---|
| 1 | Closure Settings | Value list item |
| 2 | Reveal Geometry | Value list item |
stRevealClusureUITips parameter for the tooltips on the user interface
| Row | Default value | Description |
|---|---|---|
| 1 | Sill Depth | UI tooltip string - AC_wido_sill |
| 2 | Left Jamb Depth | UI tooltip string - gs_reveal_left |
| 3 | Right Jamb Depth | UI tooltip string - gs_reveal_right |
| 4 | Inner Left Jamb Depth | UI tooltip string - gs_reveal_double_innerLeft |
| 5 | Inner Right Jamb Depth | UI tooltip string - gs_reveal_double_innerRight |
| 6 | Head Height | UI tooltip string - gs_reveal_top |
| 7 | Sill Height | UI tooltip string - gs_reveal_bottom |
| 8 | Inner Head Height | UI tooltip string - gs_reveal_double_innerTop |
| 9 | Inner Sill Height | UI tooltip string - gs_reveal_double_innerBottom |
| 10 | Left Side Angle | UI tooltip string - |
| 11 | Right Side Angle | UI tooltip string - |
| 12 | Upper Side Angle | UI tooltip string - |
| 13 | Bottom Side Angle | UI tooltip string - |
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_useWallFinishSkin = gs_useWallFinishSkin, 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[32] = "" 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] = `Plaster Thickness Limit` gs_stCavityClosure[32] = `Use Wall Finish Skins` call "CavityClosure" parameters gs_macro_version = 11, gs_useWallFinishSkin = gs_useWallFinishSkin, gs_closureMethod = gs_closureMethod, gs_bJoint = gs_bJoint, gs_stCavityClosure = gs_stCavityClosure, idTab_CavityClosureSettings = 1 ! ui_page index
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.
Custom mode



