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

  • 11 months later...
On 6/4/2023 at 2:52 PM, proformacon said:

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

Please help, I'm stuck on how to make this macro work.

 

I went to text macro management, created a new used defined macro, and named it roomheight. I then copied and pasted the macro above, "CLG:" + (ceiling_elevation-floor_elevation).to_ft.round .to_s + "'" , checked off evaluate, and set context as an owner object. I then placed a rich text box with that macro in it and used an arrow line to point to the room. It displays #Evaluation Error#

 

 

Link to comment
Share on other sites

2 hours ago, MikeCSD said:

Please help, I'm stuck on how to make this macro work.

 

I went to text macro management, created a new used defined macro, and named it roomheight. I then copied and pasted the macro above, "CLG:" + (ceiling_elevation-floor_elevation).to_ft.round .to_s + "'" , checked off evaluate, and set context as an owner object. I then placed a rich text box with that macro in it and used an arrow line to point to the room. It displays #Evaluation Error#

 

 

As far as I know you cant use a rich text box and make it work. It needs to be in the room label default. It should work inside there. 

  • Like 1
Link to comment
Share on other sites

6 hours ago, MikeCSD said:

Please help, I'm stuck on how to make this macro work.

 

I went to text macro management, created a new used defined macro, and named it roomheight. I then copied and pasted the macro above, "CLG:" + (ceiling_elevation-floor_elevation).to_ft.round .to_s + "'" , checked off evaluate, and set context as an owner object. I then placed a rich text box with that macro in it and used an arrow line to point to the room. It displays #Evaluation Error#

 

 

 

3 hours ago, proformacon said:

As far as I know you cant use a rich text box and make it work. It needs to be in the room label default. It should work inside there. 

 

Wrap that same code in % signs and use the room NVPublisher where indicated and you can simply place it into a text box.  No need to place in the default label or connect to anything with an arrow. See below:

 

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

  • Like 2
Link to comment
Share on other sites

On 6/5/2024 at 9:23 AM, proformacon said:

As far as I know you cant use a rich text box and make it work. It needs to be in the room label default. It should work inside there. 

Thank you very much for your help!

Link to comment
Share on other sites

On 6/5/2024 at 1:11 PM, Alaskan_Son said:

 

 

Wrap that same code in % signs and use the room NVPublisher where indicated and you can simply place it into a text box.  No need to place in the default label or connect to anything with an arrow. See below:

 

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

On 6/11/2024 at 1:53 AM, Renerabbitt said:

thought I'd throw in a lil plug. I've spent a ton of time developing ceiling height macros. check out this vid. you can always try and recreate this function yourself :)

 

Thank you very much for your help!

  • 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