Ruby Macros


lavorhaynie
 Share

Recommended Posts

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

15 minutes ago, Doug_N said:

Arrgg, why doesn't this work in the callout?  

 

2019-10-14_21-07-00.thumb.png.6d173dd5d0e62f88dc4fbc1fc6300136.png

 

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

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.

  • Upvote 1
Link to comment
Share on other sites

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.

 

 

image.thumb.png.38c4f9ea0d463e2c4bc2a9ee12dfe1e4.png

 

image.thumb.png.e046072828a76e08a0c14e361d453f99.png

 

 

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

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share