# Macro question

## Recommended Posts

Trying to move more of my behind the seines work from ACAD to Chief and I guess I must learn Ruby.

What I need is a simple macro calculation. In the text I have:

x%Roof TL%TL= 5896#

The "Roof TL" is simply 40 in this case which I assume is a string 40.

What is necessary to multiply %AreaPline% by %Roof TL%  to get the total rounded to no decimals?

Would someone show me an example of what is needed for that to happen?

Or point me to an example someone posted?

Thanks

##### Share on other sites

I guess I must learn Ruby

There are many learning Ruby resources available via a web search.

Where does Roof TL come from?

##### Share on other sites

2 hours ago, solver said:

Where does Roof TL come from?

That's not all that needs to be answered.

• %AreaPline% ???  would need to return the area of a PolyLine as a floating point value, not a text string
• %Roof TL% ??? would also need to return a floating point value, not a text string.
• x would need to be changed to *.  Ruby uses the following characters for calculations: +-/*

In any event, the load on that column would not be the result of the proposed calculation anyway.  Alan needs to consult an Engineer.

The Hip Beam has a reaction that is much more complicated to determine.

• 1
##### Share on other sites

The Roof TL is entered into a text macro I created with a value of 40  (20# DL & 20# LL per sq ft)
Yes the area of the poly would return with the use of %AreaPline%
Yes again as the equation is (%AreaPline%*%Roof TL%)

I beg to differ Joe, the conventionally framed hip is more complex but a Hip Truss Assembly load is more like the polygon shown.
The only flaw if you will is that the beam load carrying

the girder truss creates a point load the is not quite evenly distributed on the Beam.
But the COLUMN load is very close to real.
If it was conventional framing the HIP Truss load is like the picture in this post and the column load is P plus the adjoining triangles.

Ignore framing in the picture below.

##### Share on other sites

Alan,

I would need to see all 3 of your macros to know what you are doing wrong.  I suspect it's the way you are calling the macros but it might be the returned values of the 2 macros you reference.

##### Share on other sites

Thanks Joe.

My work is just in the text object & no real macro on my part because I'm clueless.

See attached

Using Your AreaPline macro for the area which is area.round(1).

My macro is just a value of 40

I don't know how to multiply them in Ruby.

Having only a 2 day work week this week but will return this weekend so I can explore Ruby further then.

I just thought it would be a simple procedure for someone familiar with Ruby.

The equation would be something like (%AreaPline%*%Roof TL%)

Thanks again.

##### Share on other sites

Alan,

1. Create a new owner context evaluated macro named area_40 with the content (area.round(1)*40).to_s
2. In the Polyline Label place %area_40% along with any other text you want.

You can't just do this in a text box - it needs to be in the Label of the Polyline.

##### Share on other sites

I give it a go tomorrow.

Thanks Joe.

##### Share on other sites

5 hours ago, Joe_Carrick said:

You can't just do this in a text box - it needs to be in the Label of the Polyline.

Actually, you can do it in a text box with an arrow connected to the Polyline - but the macro would need to be "referenced" and maintaining the connection of the arrow can be difficult.

Labels are best.

• 1
##### Share on other sites

• 2 weeks later...

Thanks Joe.

I just got back to this & have the text Macro as you pointed out.  See attached

How do you incorporate the "Roof TL" into the area_40 macro?

"Roof TL" macro value is 40 with no other text