Macro for Stairs


jbaehmer
 Share

Recommended Posts

I had rec'd a stair macro on here a month or so ago.  Finally getting around to working with it.  I am having issues with getting it to display how I want it displayed.  The fractions don't seem to reduce and one doesn't calc out correctly.  Any thoughts?  I have attached an example.

Link to comment
Share on other sites

Try this macro for riser height:

 

inches =nR.floor

frac =( (nR-inches)*16).round.quo(16)

 

case

when frac == 1

result = "#{inches + 1}"

when frac == 0

result = "#{inches}"

else

result = "#{inches} #{frac}"

end

 

result

 

 

This macro for number of treads:

 

num_treads

 

 

This macro for length of run:

 

# Displays Stair Length (Total of Treads)

nL = num_treads * tread_depth

 

# Convert Decimal Values to Fractions

inches = nL.floor

 

frac =( (nL-inches)*16).round.quo(16)

case

when frac == 1

result = "#{inches + 1}"

when frac == 0

result = "#{inches}"

else

result = "#{inches} #{frac}"

end

 

#Display Results

'Length = '+result+'"'

 

and here's one for the total height of a run:

 

arr =(total_risers*riser_height).divmod(12)

inch_frac = ((arr[1]-arr[1].floor)*16).round.quo(16)

 

result = case

when inch_frac == 1.0

"#{arr[0]}'-#{arr[1].ceil}"+'"'

when inch_frac == 0.0

"#{arr[0]}'- #{arr[1].floor}"+'"'

else

"#{arr[0].floor}'-#{arr[1].floor} #{inch_frac}"+'"'

end

result

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