Ceiling Height Macro To Round To Feet


proformacon
 Share

Recommended Posts

Below is the macro I use for ceiling heights. It currently will show the ceiling height at 7'11 5/8 for finished and 8'1 1/8 for rough elevation. This is due do 97 1/8 rough ceiling height I have set. Id like the macro to round just to whole number, IE: 8'. That way it doesn't show the actual true height of 7'11 5/8 which can be confusing to clients. What's the easiest way to modify the rising macro to accommodate this? 

 

arr = (ceiling_elevation-floor_elevation).divmod(12)

 

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

 

result = case inch_frac

 

when Rational(1.0)

 

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

 

when Rational(0.0)

 

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

 

else

 

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

 

end

 

"CLG:" + result

 

Link to comment
Share on other sites

I am not sure what was wrong with the answer you got yesterday that was quite simple.  Something like this if I remember correctly ?

 

"CLG:" + (ceiling_elevation-floor_elevation).to_ft.round .to_s + "'"

 

However if you absolutely need to work with the old code you could try this but no guarantee it does not throw an error at some point.

 

arr = (ceiling_elevation-floor_elevation).to_f.divmod(12)

 

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

 

result = case inch_frac

 

when Rational(1.0)

 

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

 

when Rational(0.0)

 

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

 

else

 

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

 

end

 

"CLG:" + result

 

 

Edited by Chopsaw
Note that this will only work for typical framing situations where the rough framing is a little more than the nearest foot.
  • Like 1
Link to comment
Share on other sites

On 6/3/2023 at 10:21 AM, Chopsaw said:

"CLG:" + (ceiling_elevation-floor_elevation).to_ft.round .to_s + "'"

Nothing wrong just doesn't work. The one you edit of the old one works great. I definitely would rather go with the simpler version but get an eval error for it.

Link to comment
Share on other sites

On 6/3/2023 at 10:21 AM, Chopsaw said:

"CLG:" + (ceiling_elevation-floor_elevation).to_ft.round .to_s + "'"

Nevermind, got it work. Used the fix function thing, not sure what it changed exactly but thank you!

Link to comment
Share on other sites

26 minutes ago, proformacon said:

Nevermind, got it work. Used the fix function thing, not sure what it changed exactly but thank you!

 

Not exactly sure what may have caused the eval error unless you did not set it to evaluate and Owner Object with a room selected in plan.

 

Always best to go with simple when simple works.  That other macro is old and much more complex than necessary for this specific task.

Link to comment
Share on other sites

How to you get a macro to reference a room to get a ceiling height to work? Does it only work in a label? 

I want to just use a text line and put it in a room and have it auto fill like the area does. 

Trying to wrap my head around how this works. 

Link to comment
Share on other sites

1 hour ago, someguy said:

How to you get a macro to reference a room to get a ceiling height to work? Does it only work in a label? 

I want to just use a text line and put it in a room and have it auto fill like the area does. 

Trying to wrap my head around how this works. 

If it's one of Chief's "Room Macros" then it will work in a text box placed in the room or with an arrow connecting to the room.  A custom macro must have a line that sets the context.

  • Like 1
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