ruby macro


ChiefuserMathews
 Share

Recommended Posts

If I am understanding your question you are trying to remove the window frame and sash from the window width and height to get unobstructed glass area.

 

%((width-6.in)*(height-6.in)).round(1)% will give you the result in sq ft rounded to 1/10th of a sq ft.

If you are using a window schedule, be sure to turn off using a call out for the window schedule dialog box.

In that case you should add something like

[%schedule_number%]

%width% x %height%

Glazing Area

%((width-6.in)*(height-6.in)).round(1)%

 

And that would give you

 

2021-10-12_15-25-52.thumb.jpg.47bc85a2f7dde13a12bf382fbae1480b.jpg

 

 

Link to comment
Share on other sites

The macro %(width-6.in)*(height-6.in)% will only work if you never change the frame or sash parameters.


If you want it to work for even if the frame or sash is changed use the following macro:

%(width-2*frame_side_width-2*sash_side_width-2*sash_depth/8)*(height-frame_top_width-frame_bottom_width-sash_top_width-sash_bottom_width-2*sash_depth/8)%


If you want it to subtract the middle sash you'll have to set up the following user defined macro:

# currently gets the area where light can pass through the window
# remove sash_edging_width from this macro to get the total glass area
# currently doesn't account for:
#  - pass through windows do not have a sash
#  - louvered and glass louvered windows do not have shash edging
#  - shaped windows, corner windows, etc.
obj = owner
obj = referenced unless referenced.nil?

is_sliding_wind = (obj.type_code == "SH" or obj.type_code == "DH" or obj.type_code == "LS" or obj.type_code == "RS" or obj.type_code == "TS")
is_wind_components_vertical = (obj.type_code == "SH" or obj.type_code == "DH" or obj.type_code == "AW" or obj.type_code == "FA" or obj.type_code == "TA" or obj.type_code == "HO" or obj.type_code == "FH" or obj.type_code == "TH")

num_wind_components = 1
if obj.type_code == "SH" or obj.type_code == "DH" or obj.type_code == "LS" or obj.type_code == "RS" or obj.type_code == "DC" or obj.type_code == "FA" or obj.type_code == "FH"
    num_wind_components = 2
elsif obj.type_code == "TS" or obj.type_code == "TC" or obj.type_code == "TA" or obj.type_code == "TH"
    num_wind_components = 3
end
num_sash_middle_components = num_wind_components - 1

sash_edging_width = obj.sash_depth / 8 #this is how far the glass is inset into the sash (angled section of the sash)

actual_sash_side_width = obj.sash_side_width + sash_edging_width
actual_sash_top_width = obj.sash_top_width + sash_edging_width
actual_sash_bottom_width = obj.sash_bottom_width + sash_edging_width
actual_sash_middle_width = obj.sash_middle_width * (is_sliding_wind ? 1 : 2)  + 2 * sash_edging_width

total_sash_h_width = 2 * actual_sash_side_width + (is_wind_components_vertical ? 0.in : actual_sash_middle_width * num_sash_middle_components)
total_sash_v_width = actual_sash_top_width + actual_sash_bottom_width + (is_wind_components_vertical ? actual_sash_middle_width * num_sash_middle_components : 0.in)

result = (obj.width - 2*obj.frame_side_width - total_sash_h_width) * (obj.height - obj.frame_top_width - obj.frame_bottom_width - total_sash_v_width)
result

 

  • Upvote 3
Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share