Sign in to follow this  
builder

Macro writing question

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

Share this post


Link to post
Share on other sites

Try this.

 

number = riser_height * total_risers

 

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\"")

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

  • Member Statistics

    27494
    Total Members
    6254
    Most Online
    theCADStudio
    Newest Member
    theCADStudio
    Joined