# Macro for Stairs

## 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.

##### Share on other sites

Need to see your example -- Should not be a problem.

##### Share on other sites

Sorry...thought I had attached it earlier. Learning this new site.

Stair Macro.plan

##### 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:

This macro for length of run:

# Displays Stair Length (Total of Treads)

# 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

##### Share on other sites

Using a helper function" -- You will have to open the macro manager and click the ft_in once to enter it into the plan -- Bummer