proformacon Posted June 3, 2023 Share Posted June 3, 2023 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 More sharing options...
DBCooper Posted June 3, 2023 Share Posted June 3, 2023 I am no macro expert... but have you tried just using the built in macro ".to_ft" and ".round"? Link to comment Share on other sites More sharing options...
Chopsaw Posted June 3, 2023 Share Posted June 3, 2023 (edited) 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 June 4, 2023 by Chopsaw Note that this will only work for typical framing situations where the rough framing is a little more than the nearest foot. 1 Link to comment Share on other sites More sharing options...
proformacon Posted June 4, 2023 Author Share Posted June 4, 2023 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 More sharing options...
proformacon Posted June 4, 2023 Author Share Posted June 4, 2023 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 More sharing options...
Chopsaw Posted June 4, 2023 Share Posted June 4, 2023 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 More sharing options...
someguy Posted June 8, 2023 Share Posted June 8, 2023 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 More sharing options...
Joe_Carrick Posted June 9, 2023 Share Posted June 9, 2023 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. 1 Link to comment Share on other sites More sharing options...
MikeCSD Posted June 5 Share Posted June 5 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 More sharing options...
proformacon Posted June 5 Author Share Posted June 5 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. 1 Link to comment Share on other sites More sharing options...
Alaskan_Son Posted June 5 Share Posted June 5 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 + "'"% 2 Link to comment Share on other sites More sharing options...
Renerabbitt Posted June 11 Share Posted June 11 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 1 Link to comment Share on other sites More sharing options...
MikeCSD Posted June 12 Share Posted June 12 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 More sharing options...
MikeCSD Posted June 12 Share Posted June 12 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! 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now