Macro for window square footage?


VHampton
 Share

Go to solution Solved by Renerabbitt,

Recommended Posts

Is there a way to create a macro for the square footage of a window or door?

 

A local building department requires a glass to wall ratio.

 

If the window label could indicate square footage vs. width and height that would be quite a time saver. 

 

Thanks in advance if there is such a thing.  

 

 

 

image.png

Link to comment
Share on other sites

@VHampton
this works on walls..up to you to figure out how to implement

# Copyright Rabbitt Design 2024

# This script calculates the ratio of thermal opening area to thermal envelope area
# and rounds the result to two decimal places.

# Directly divide thermal_opening_area by thermal_envelope_area to get the ratio.
ratio = thermal_opening_area / thermal_envelope_area
# The last line outputs the ratio, rounded to two decimal places.
"#{ratio.round(2)*100}%"

 

Link to comment
Share on other sites

2 hours ago, Renerabbitt said:
#{ratio.round(2)*100}%

 

Thank you so much Rene.

 

I have the macro for width x height, and figured that it should be straightforward enough for a label to indicate  "15 sq. ft."

 

Unfortunately I'm not adept enough at the macro process to fully grasp how to make this work.

 

But I will keep at it!   Really appreciate the tip. 

 

image.thumb.png.8e27368761cb13c9c3f4517cab264952.png 

Link to comment
Share on other sites

  • Solution
2 minutes ago, VHampton said:

Really appreciate the tip. 

 

oh you want it fo each window as opposed to a total. then there is a built in macro:
image.thumb.png.0fbf4d724926151c31031e06d8031f0f.png
but you would have to put it in the window label which would not be all that desirable if you were trying to show it in elevation.
Better to just put it in the window schedule

Link to comment
Share on other sites

I believe he's after glazing area not thermal envelope.

This gives glass area for fixed, awning and casement windowsGlazing.json. Does not account for center sashes in double hung or lites. You could get Alaskan son to put something all purpose and more accurate.

gw=width-(sash_side_width*2)
gh=height-(sash_top_width+sash_bottom_width)
glass=gh*gw
glass.round(2)

Unfortunately placed in a schedule I can't get the columns to add up. IF grouped items in schedule it only shows qty but area is for only one. So would have to export to spreadsheet.

Glazing.json

  • Upvote 2
Link to comment
Share on other sites

Thank you as well Mark.  

 

For years I've been ignoring the value of "rubies" and macros.

 

Somehow I wound up going down the rabbit trails of our old forum and there were some posts circa 2010. 

 

Thank you both once again. This is a great help. 

Link to comment
Share on other sites

Thank you Mark.

 

I've tried adding "glazing" a variety of different ways within the macro, and glass area doesn't appear.  

 

Having said that, I realize that the sashes are resulting in a larger surface total.

 

In any event, this macro provides a rather helpful approximation. Again, this is new to me, even with the many years of Chief experience. 

 

%thermal_envelope_area%

 

Link to comment
Share on other sites

one thing to be careful of, the wall thermal_envelope_area does not work for walls which are partially below grade (i.e. basements). It is easier to draw a polyline on the elevation, and use its area.

 

As well, if I remember correctly wall thermal_envelope_area  does not include rim joists, and excludes some other things. i.e. a 109.125 plate height times a 20' wall with no openings does not give 109.125 * 20 

Link to comment
Share on other sites

8 hours ago, VHampton said:

 

I've tried adding "glazing" a variety of different ways within the macro, and glass area doesn't appear.  

Don't know what you did. You need to:

Import macro,image.thumb.png.c4ab221d320511cd8bf3e25ad2ed5238.png

select all windows in plan, open, go to OIP, pick an unused field or create one, macro drop down/user defined/glazing.

image.thumb.png.89e01e753ce5281c0650dc3a4c3760d3.png

Sample plan attached.

Glaze sample.zip

  • Like 1
Link to comment
Share on other sites

10 hours ago, SHCanada2 said:

one thing to be careful of, the wall thermal_envelope_area does not work for walls which are partially below grade (i.e. basements). It is easier to draw a polyline on the elevation, and use its area.

 

Thanks Jason. This observation is spot on.  The wall surface label isn't anywhere near the actual square footage of the wall. 

I probably have the wrong macro, but that said, thank you.

 

And thanks again Mark.  I was monkey typing with the label designations.

 

The glazing input was something which I was trying to show elevation view.

 

It does however appear in the schedule, where the surface area can be done with a high degree of accuracy. 

 

Really appreciate the tips.  

 

 

 

Snip20240222_25.png

Link to comment
Share on other sites

  • 3 weeks later...
  • 4 weeks later...
On 3/14/2024 at 5:59 PM, Doug_N said:

I have been working on this for a while and with a but of progress have come up with this.

image.thumb.png.e153c74c1d1320adaf39a9149af973bd.png

 

 

 

Window_Glass_Area.json 416 B · 27 downloads

Thank you Doug.

 

Please excuse the delay in getting back.

 

Your post was greatly appreciated. This is going to be a huge help in the future. 

 

The project which I started the thread with got the ok by the municipality, but your precision script is all the better particularly since it hones in on the exact glazing.

 

Much appreciated! - Val  

Link to comment
Share on other sites

38 minutes ago, VHampton said:

Thank you Doug.

 

Please excuse the delay in getting back.

 

Your post was greatly appreciated. This is going to be a huge help in the future. 

 

The project which I started the thread with got the ok by the municipality, but your precision script is all the better particularly since it hones in on the exact glazing.

 

Much appreciated! - Val  

That script wasnt quite all the way there, it was missing a lot of calcs. The following script is far more accurate but still wont work for shaped windows or custom muntins:
 

Quote
# Copyright Rabbitt Design 2024

# Option to include a detailed breakdown as the very first line
include_breakdown = true # Change this to false if the breakdown is not needed

# Define a method to calculate the true area of glass considering the correct frame dimensions and muntin adjustments
def calculate_true_glass_area_with_option(include_breakdown, width, height, frame_side_width, sash_side_width, sash_bottom_width, sash_top_width, muntin_width, num_lites_horizontal, num_lites_vertical, type)
  # Start building the breakdown explanation if required
  breakdown_explanation = "Detailed Breakdown:\n" if include_breakdown

  # Adjust for frame width for net dimensions
  net_width = width - (2 * frame_side_width)
  net_height = height - (frame_top_width + frame_bottom_width)
  
  if include_breakdown
    breakdown_explanation += "Adjusted net width: #{net_width}, Adjusted net height: #{net_height}\n"
  end

  # Initialize additional sash reduction variables as Measurement objects for consistent operation
  additional_sash_reduction_width = 0.in
  additional_sash_reduction_height = 0.in

  # Adjust for sash dimensions based on window type
  case type
  when 'Left Sliding', 'Right Sliding'
    additional_sash_reduction_width = sash_side_width
  when 'Single Casement', 'Double Casement', 'Triple Casement'
    extra_sashes = type == 'Single Casement' ? 0 : type == 'Double Casement' ? 1 : 2
    additional_sash_reduction_width = sash_side_width * extra_sashes
  when 'Double Hung', 'Single Hung'
    max_sash_width = [sash_bottom_width, sash_top_width].max
    additional_sash_reduction_height = max_sash_width
  end

  # Apply additional sash reductions
  net_width -= additional_sash_reduction_width
  net_height -= additional_sash_reduction_height

  if include_breakdown
    breakdown_explanation += "After sash adjustment - Width: #{net_width}, Height: #{net_height}\n"
  end

  # Calculate the initial glass area
  initial_glass_area = net_width * net_height

# Adjust for muntins if applicable, correcting the unit compatibility issue
if num_lites_horizontal > 0
    # For horizontal muntins, calculate the total reduction in area
    # The height adjustment for each muntin is its width; this needs to be multiplied by the total width it spans
    effective_width = width - (2 * frame_side_width)  # Total width spanned by the muntin
    if ['Left Sliding', 'Right Sliding', 'Double Casement'].include?(type)
        # Adjust for additional side sash width in certain window types
        effective_width -= sash_side_width
    end
    total_muntin_area_horizontal = muntin_width * effective_width
    # Instead of subtracting from net_height, we calculate area reduction directly
    net_area_reduction_horizontal = total_muntin_area_horizontal * num_lites_horizontal
    breakdown_explanation += "Area reduced by horizontal muntins: #{net_area_reduction_horizontal}\n" if include_breakdown
else
    net_area_reduction_horizontal = 0.in * 0.in  # No reduction if no horizontal muntins
end

if num_lites_vertical > 0
    # For vertical muntins, calculate the total reduction in area
    effective_height = height - (frame_top_width + frame_bottom_width)
    if ['Double Hung', 'Single Hung'].include?(type)
        # Adjust for the larger of the top or bottom sash widths in hung windows
        effective_height -= [sash_bottom_width, sash_top_width].max
    end
    total_muntin_area_vertical = muntin_width * effective_height
    # Calculate area reduction directly
    net_area_reduction_vertical = total_muntin_area_vertical * num_lites_vertical
    breakdown_explanation += "Area reduced by vertical muntins: #{net_area_reduction_vertical}\n" if include_breakdown
else
    net_area_reduction_vertical = 0.in * 0.in  # No reduction if no vertical muntins
end

# Calculate the initial glass area without muntin adjustments
initial_glass_area = net_width * net_height

# Adjust the initial glass area by subtracting the muntin area reductions
adjusted_glass_area = initial_glass_area - net_area_reduction_horizontal - net_area_reduction_vertical

# The corrected approach ensures compatibility by calculating area reductions directly and subtracting them from the total glass area
if include_breakdown
    return breakdown_explanation + "Final adjusted glass area: #{adjusted_glass_area.round(2)}\n"
else
    # If no breakdown is required, just return the adjusted final area
    return adjusted_glass_area.round(2)
end

  if include_breakdown
    breakdown_explanation += "Final glass area: #{initial_glass_area}\n"
    return breakdown_explanation
  else
    # If no breakdown is required, just return the final area
    return initial_glass_area
  end
end

# Usage of the function with all needed parameters plus the include_breakdown option
# Remember to replace the placeholders with actual values/measurement objects for width, height, etc.
result = calculate_true_glass_area_with_option(include_breakdown, width, height, frame_side_width, sash_side_width, sash_bottom_width, sash_top_width, muntin_width, num_lites_horizontal, num_lites_vertical, type)

# 'result' will either be a detailed breakdown (as a string) or the final glass area (as a measurement), depending on the include_breakdown flag.

 

Link to comment
Share on other sites

  • 9 months later...
On 2/22/2024 at 8:43 AM, SHCanada2 said:

I have a fairly complicated macro in a the window label, plus a macro in the polyline which does it all. the polyline sits in my template file on the elevation

 

If CA could publish schedule totals to a macro it would greatly simply the macro...pretty please CA

 

X16 schedules can do quite a bit as Rene indicates in another thread. After some fiddling, I also got the schedule to work for the window area as a percentage of wall area (required in Canada). Wall area still needs the polyline. But this eliminates the need to store the windows in a global variable.

 

So the request to publish the schedule total as an NVP is not actually required. The attached shows my original macro solution in the label, where the schedule shows similar output...except it does not have the "largest unprotected window"...not sure if that could actually be done in a schedule...maybe I will try. I'm thinking if one was creative one could essentially use the OIP to store variables, rather than use global variables...something to try and see.

 

Link to comment
Share on other sites

11 hours ago, SHCanada2 said:

 

X16 schedules can do quite a bit as Rene indicates in another thread. After some fiddling, I also got the schedule to work for the window area as a percentage of wall area (required in Canada). Wall area still needs the polyline. But this eliminates the need to store the windows in a global variable.

 

So the request to publish the schedule total as an NVP is not actually required. The attached shows my original macro solution in the label, where the schedule shows similar output...except it does not have the "largest unprotected window"...not sure if that could actually be done in a schedule...maybe I will try

 

 

Why are you using a polyline for this?

Link to comment
Share on other sites

8 minutes ago, Renerabbitt said:

Why are you using a polyline for this?

 

I did have a post on it somewhere, but too lazy to look for it today.

 

There is a table in the building code for the amount of glazing you can have on the side of an exposed building face near a property line which abuts another residential building's property. The further you are away, the move you can have

 

Exposed face is from grade to under the soffit, so this typically includes a couple feet of basement

 

example where you can see the blue of the polyline defining the area. Its more of an opinion than a science when you start to consider what all gets included. But you have to do it for additions that have windows to ensure you are not over the limit

 

image.thumb.png.b332eafe984407cdb5c7f37a1eb4e078.png

Link to comment
Share on other sites

4 minutes ago, Renerabbitt said:

Why are you using a polyline for this?

I have exactly the same issue with window areas.  As previously posted in the forum, the Canadian Building Code, limits that size of a window if it is within certain prescribed distances to the property line.  The exposed wall surface is specified under the code as the area of the wall above the grade, and this stops at the highest ceiling (Not the roof).  Then, consulting the tables, that wall area determines the maximum "unprotected opening" allowed for that wall assembly, as a percentage of the wall area.  That wall area can only be determined at the time of this posting by tracing the prescribed wall area with a closed polyline.  Jason, please correct me if I am not describing this correctly. 

Link to comment
Share on other sites

1 minute ago, Doug_N said:

and this stops at the highest ceiling (Not the roof).

my understanding is it stops at the soffit...but that is why I say it is an "opinion" and not a science. :)

 

All I know is I submit it this way and the DA never complains, but when I first did this macro I had an error and they caught it so for all I know they do it themselves everytime as well and may do it slightly differently

Link to comment
Share on other sites

1 hour ago, SHCanada2 said:

my understanding is it stops at the soffit...but that is why I say it is an "opinion" and not a science. :)

 

All I know is I submit it this way and the DA never complains, but when I first did this macro I had an error and they caught it so for all I know they do it themselves everytime as well and may do it slightly differently

From the Ontario Building Code definitions:

Exposing building face
means that part of the exterior wall of a building that faces one direction and is located between ground level and the ceiling of its top storey or, where a building is divided into fire compartments, the exterior wall of a fire compartment that faces one direction.
Link to comment
Share on other sites

2 hours ago, Doug_N said:

exterior wall of a building

so is the part of the wall still considered "Exterior" that is above the soffit as it is enclosed. :) or is it part of the attic, or roof, or soffit ...

 

black art of building code interpretation.... which for the 2015 edition (out of force now) had a "companion guide" to help with a consistent interpretation:

 

image.thumb.png.7e123d7f2e5857b090490ea0fea0efe2.png

 

measured to the ceiling is the winner

 

 

 

 

 

 

 

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