Macro writing question


Bob-Roraback
 Share

Recommended Posts

How would I write a macro to give me the number of risers x the riser height for a flight of stairs? What I am attempting to do is give the total rise of the stair.

The "next_height" macro command does not work because it references the subfloor height which adds 3/4" more than the actual total rise of the stairs.

So what I want to do is multiply this,

number = riser_height

 

divisor = 1/16.to_f

 

a = ((number/divisor).round*divisor).divmod(12)

 

feet = a[0]

 

inches = a[1].floor

 

if a[1].modulo(1) == 0

fraction = ""

 

else

fraction = " #{a[1].modulo(1).rationalize}"

end

 

"#{feet}'-#{inches}#{fraction}\"".reverse.chomp("-'0").chomp(" 0").reverse.chomp("-0\"")

 

By this,

total_risers

 

Thank you for any help with this, Bob

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