Macro Math help


sjalheim
 Share

Recommended Posts

I'm inexperienced with macros and such, so any help is welcomed. 

I've wanted a way for the daylight/vent to be incorporated, but I'd be happy with just some math to be done in a text box. I'm sure some of you have seen my requests. ;)

 

Could someone help me get this done? I got an email a long time ago from someone but don't know what I did with it, or if I understood it anyway. It's probably uber-easy...

 

TOTAL SF - %room.area.internal%

DLO REQ'D - %room.area.internal% (times) .08

VENT REQ'D - %room.area.internal% (times) .04

 

I can just copy this text into a room and VIOLA! I get my answers. That's my dreeeeaaaaam.

Link to comment
Share on other sites

Unfortunately Chief doesn't currently allow us to access/manipulate the values of their predefined macros so your only solution will probably be to create a custom macro using TMM (Text Macro Management) which is a little easier said than done if you're not familiar with it.

This particular macro shouldn't be too complex and if I wasn't so busy I might just donate the time but I'm pretty swamped right now so if you'd like me to write one for you I could probably do so for a small fee. Just send me a PM if you are interested. Maybe someone else will be willing to donate their time though… I guess we'll see. You might also check with Joe Carrick, he might already have a macro that works for you as part of his macro a month club or as a standalone macro package that he has for sale.

Link to comment
Share on other sites

While we are on the subject…

This particular macro would require using multiplication. I can't seem to get the "*" operator to work in a custom macro so I've ended up using "/" and the inverse of the desired number. What am I missing? I thought "*" was Ruby's multiplication operator but apparently not.

Link to comment
Share on other sites

Hmm...very strange. I'm going to test again when I get back to the office but for some reason I couldn't get it to work. Can you do me a favor in the meantime and try testing with less than a whole number? Use the example in the OP maybe (.8). I wonder if perhaps my problem is that you need to start with a zero (0.8)?

Link to comment
Share on other sites

Thanks, Eric. I was getting a couple of rooms that ran out the decimal pretty far so I added 

 

'TOTAL SF - ' + internal_area.to_s + "\n" + 'DLO REQ\'D - ' + (internal_area.to_f * 0.08).round(2).to_s + " sf"+ "\n" + 'VENT REQ\'D - ' + (internal_area.to_f * 0.04).round(2).to_s + " sf"

 

Because it has to "live" in the Room Label, I'll just modify the way I label the rooms. This will at least save me from having to do that part manually! Thanks again!

 

Screenshot 2016 07 20 08.06.02

 

Irrelevant, but I did use to use lisp in AutoCAD a lot, wrote/modified a ton of php, dabbled in mysql, but Ruby defies me. Not to mention my job here keeps me drawing instead of doing "fun" stuff! I'd love to be able to modify CA more than I can!

Link to comment
Share on other sites

What about when you add a room and you need to steal light and ventilation from the new room to show a combined 2 rooms calc. Any chance of that? Happens to me all the time. the only thing I could think might work is a no -room def between the 2 rooms, but in most cases I need the room def.

Link to comment
Share on other sites

What about when you add a room and you need to steal light and ventilation from the new room to show a combined 2 rooms calc. Any chance of that? Happens to me all the time. the only thing I could think might work is a no -room def between the 2 rooms, but in most cases I need the room def.

 

Would you still want the labels in the individual rooms or just the one label with combined totals?  It can definitely be done and although I'm sure Joe, Eric, or someone else might be able to come up with something more elegant but the only way I know of doing it would require a "one time use" macro for each of the 2 rooms and possibly a 3rd depending on how you wanted things displayed. 

 

And by "one time use" I mean just that...The macros could only be used once in any given plan.  If you had the situation arise multiple times in the same plan you would have to set up 2 or 3 more similar macros with some very minor changes. Easy enough to do but keeping track might be a different story.  

Link to comment
Share on other sites

That's a good idea Eric. The one downside to that method would be that you would have to remember to resize the polyline anytime you modified the room size(s).

So just wait until you have the rooms finalized.  Some things are never going to be 100% automatic. 

 

OTOH, I prefer a methodology that is more comprehensive.  If all rooms have unique names, a global hash table can be maintained and a single macro can be used to sum the areas of any one (or more) rooms.  This only requires two macros:

 

1.  A macro In the Default Room Label to accumulate and maintain the hash table. 

   a.  The hash table would contain at a minimum the internal_area of each room.

   b.  It could if desired also contain the required vent and opening areas

2.  Another macro to display the desired output based on summing the values in the hash table for

specific rooms.

   a.  This macro could be used in the Default Room Label for single rooms but could be easily modified to use for multiple rooms.

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