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

2 minutes ago, MarkMc said:

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.

next version maybe <_<

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

In a custom schedule I put the glazing macro in comments OIP, and thermal area in Code. Note the difference which will can add up.

image.thumb.png.d9610221ae1fe80c595870e61836e713.png

Here is result wihtout grouping after pasting into spreadsheet.

image.thumb.png.fdcacd7d619070d47327d27153886875.png

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

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

 

image.thumb.png.77dfbcdd24a28410a3b89abc22e7c6c2.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

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share