Doug_N Posted October 15, 2019 Share Posted October 15, 2019 IN the Ruby console the first answer is 0.025 times the internal room area of a selected room. The second answer is that value rounded. Is there a problem with the order of operations? Link to comment Share on other sites More sharing options...
Doug_N Posted October 15, 2019 Share Posted October 15, 2019 3 minutes ago, solver said: Parentheses are your friend. Where would you put parentheses in this? owner.internal_area*0.025.round(2) Link to comment Share on other sites More sharing options...
Doug_N Posted October 15, 2019 Share Posted October 15, 2019 Well this works. Create a local variable 'a' and then operate on that variable as a second operation. >a=owner.internal_area*0.025; a.round(2) >=3.4 Link to comment Share on other sites More sharing options...
Chopsaw Posted October 15, 2019 Share Posted October 15, 2019 2 minutes ago, Doug_N said: Arrgg, why doesn't this work in the callout? looks like you entered the wrong name for the macro to start with. Link to comment Share on other sites More sharing options...
Doug_N Posted October 15, 2019 Share Posted October 15, 2019 Arrgg, why doesn't this work in the callout? Link to comment Share on other sites More sharing options...
Kbird1 Posted October 15, 2019 Share Posted October 15, 2019 16 minutes ago, Doug_N said: Where would you put parentheses in this? owner.internal_area*0.025.round(2) I think Michael was trying to give you a hint...... , you need to round the result of the multiplication (of the Room area) so bracket that 1st (owner.internal_area*0.0250).round(2) Link to comment Share on other sites More sharing options...
Kbird1 Posted October 15, 2019 Share Posted October 15, 2019 15 minutes ago, Doug_N said: Arrgg, why doesn't this work in the callout? as CS mentioned it looks like you have assigned the wrong macro name to the Label it is not called 025roomarea but roomArea025 ...... is it set to evaluate correctly? M. Link to comment Share on other sites More sharing options...
Doug_N Posted October 15, 2019 Share Posted October 15, 2019 Well I did type it wrong, but here is the result with the right macro. I am going bald tearing my hair out! Link to comment Share on other sites More sharing options...
Joe_Carrick Posted October 15, 2019 Share Posted October 15, 2019 You have to specify the room as the thing you want to get the internal_area of. Try this macro: ######################################################## # Macro Name: "room_internal_area" # Displays the internal area of the room a Note is in. ######################################################## # Copywrite by Joseph P. Carrick, August 2, 2019 ######################################################## referenced ? obj= referenced : obj=owner begin obj.room.internal_area.round(2) rescue "object isn't a Room" end You have to specify the room as the thing you want to get the internal_area of. 1 Link to comment Share on other sites More sharing options...
Doug_N Posted October 16, 2019 Share Posted October 16, 2019 22 hours ago, Joe_Carrick said: referenced ? obj= referenced : obj=owner begin obj.room.internal_area.round(2) rescue "object isn't a Room" end Joe, Wow, works like a charm! Thanks Joe. I added a bit of simple code to get the percentages and just put the macro in a text box. One macro to get the area, and one to get the result. 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