No NVP for Railing Height???


Renerabbitt
 Share

Recommended Posts

5 hours ago, Joe_Carrick said:

No.  I just enter the label and use that.  ie:

  • 42" Tall
  • Glass Railing

welp this only works with solid walls since its using drywall for the calc but here ya go:
 

# Copyright Rabbitt Design 2024

# This macro is in your Room Label but can also be used in a polyline or rich text box

##########################################################################################

# Rabbitt Design assumes no liability for the accuracy of this macro calculation or
# any consequences arising from the use of this script. Users are responsible for verifying
# the appropriateness of the settings within the label options and ensuring the script functions as intended
# in their specific use case.

##########################################################################################

referenced ? obj = referenced : obj = owner

##########################################################################################
#FORMATTER
formatter = NumberFormatter.new
formatter.use_fractions = true
formatter.denominator = 4
formatter.show_trailing_zeros = true
formatter.unit = '"'  # Set units to inches

formatter

##########################################################################################
#SCRIPT
is_railing_wall = obj.respond_to?(:is_railing) && obj.is_railing
if is_railing_wall && obj.respond_to?(:upper_layers) && obj.respond_to?(:length)

  layer_with_greatest_thickness = obj.upper_layers.max_by { |layer| layer.thickness }

  if layer_with_greatest_thickness

    area_sq_in = layer_with_greatest_thickness.area.convert_to(:"sq in")
    railing_height_raw = area_sq_in / obj.length.to_f

    # Apply formatter only to the final railing height result
    railing_height = formatter.apply(railing_height_raw.round)+"w/Rail Cap"
  else
    railing_height = "No valid layer found"
  end
end

 

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