cartersjohnson Posted September 26, 2021 Share Posted September 26, 2021 I am trying to gain a better understanding of Ruby and macros. For starters, I understand the principle of %owner.name% (for example, %room.ceiling_elevation%). The owner comes first, followed by a name that will return a value, simple. However, I have found some default macros that have an owner followed by what seems to be 2 names all separated by periods, such as: %room.height.ceiling%. To help shed more light on my question, I am working with a custom macro to format ceiling height into feet and inches. My macro works perfectly when I input the first example above, but does not evaluate when I input the second example above. Can somebody help me understand what the difference is between the examples and why the second is immune to formatting? Link to comment Share on other sites More sharing options...
Chopsaw Posted September 27, 2021 Share Posted September 27, 2021 There are others that could explain better but %room.height.ceiling% is a "Global" macro which is not parsed by Ruby. It works fine for what it does but there is no way to manipulate that data that I am aware of. A lot but unfortunately not all of those "Global" macros are also "Ruby" name value pairs that can be looked up and put to good use and formatted the way you need them or used to calculate other values that are not directly available. 1 Link to comment Share on other sites More sharing options...
cartersjohnson Posted October 4, 2021 Author Share Posted October 4, 2021 On 9/26/2021 at 8:48 PM, Chopsaw said: There are others that could explain better but %room.height.ceiling% is a "Global" macro which is not parsed by Ruby. It works fine for what it does but there is no way to manipulate that data that I am aware of. A lot but unfortunately not all of those "Global" macros are also "Ruby" name value pairs that can be looked up and put to good use and formatted the way you need them or used to calculate other values that are not directly available. I am just now seeing your response. That answer makes sense to me. For the life of me I can't understand why the relative room heights are not provided as NVPs. Is there a way to see the code for Chief's default global macros? Link to comment Share on other sites More sharing options...
Chopsaw Posted October 4, 2021 Share Posted October 4, 2021 46 minutes ago, cartersjohnson said: Is there a way to see the code for Chief's default global macros? That would be awesome but not possible. NVP's would do just fine.... Then we could not only see but use the values. Is it %room.height.ceilingfinish% that you are after as a NVP ? Link to comment Share on other sites More sharing options...
cartersjohnson Posted October 4, 2021 Author Share Posted October 4, 2021 12 minutes ago, Chopsaw said: Is it %room.height.ceilingfinish% that you are after as a NVP ? Yes, I am after an NVP for the room height (subfloor to rough ceiling). I have a workaround which is to format %room.ceiling_elevation - room.floor_elevation% and it works fine. I was just trying to understand why I can't retrieve the ceiling height directly. Link to comment Share on other sites More sharing options...
Chopsaw Posted October 4, 2021 Share Posted October 4, 2021 5 minutes ago, cartersjohnson said: Yes, I am after an NVP for the room height (subfloor to rough ceiling). I have a workaround which is to format %room.ceiling_elevation - room.floor_elevation% and it works fine. I was just trying to understand why I can't retrieve the ceiling height directly. Ok that is what I thought. And then subtract %room.finished_floor_elevation% to get the finished ceiling height. Go with the workaround and put in a suggestion that your are doing it that way but could make good use of a proper NVP. I think it is just a lot more complicated than you or I might imagine to put those NVP's into the software. Link to comment Share on other sites More sharing options...
Joe_Carrick Posted October 5, 2021 Share Posted October 5, 2021 Most of Chief's built-in macros are hard coded (not actually processed by Ruby) The other Name/Value (object attributes) pairs are processed by Ruby and consequently can be manipulated and formatted.. I've attached a set of macros that will allow you to eamine an object to see what attributes are available Object_Properties.json 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