KristjanM Posted July 20, 2023 Share Posted July 20, 2023 I commonly do a quick calculation for pad footing sizes for estimating purposes. If an engineer is involved, he/she will do the calculations. I've created a text box which gives me the area, loads and footing size in square feet. I would like to get the square root of the footing area and multiply by 12 to give me the footing edge size in inches (assuming the pad is square). I've tried various things such as sqrt() or math.sqrt() both in the text box and in the ruby console but can't generate a correct result. Can you do math functions in a text box? Do I have to call an actual macro. What is the right syntax? Link to comment Share on other sites More sharing options...
Joe_Carrick Posted July 20, 2023 Share Posted July 20, 2023 You would need a custom macro. It's not a difficult one to create. Link to comment Share on other sites More sharing options...
KristjanM Posted July 20, 2023 Author Share Posted July 20, 2023 Can I use math.sqrt() in the macro? I tried it in the ruby console and it didn't work. Link to comment Share on other sites More sharing options...
robdyck Posted July 20, 2023 Share Posted July 20, 2023 If you know the square feet needed for the pad footing, you can simply divide by 2 to get the edge length, no? Link to comment Share on other sites More sharing options...
Joe_Carrick Posted July 20, 2023 Share Posted July 20, 2023 I just tried the following in the Ruby Console: y = 450.00 ; x = Math.sqrt(y).round(4) ---> 21.2132 It works fine. However, the data in the parentheses has to be numerical. Otherwise you'll get an error. Also note that Ruby is case sensitive. So as Eric said, Math works, math doesn't. Link to comment Share on other sites More sharing options...
KristjanM Posted July 20, 2023 Author Share Posted July 20, 2023 Tried in the Ruby console (should return 2) - > Math.sqft(4) => Ruby NoMethodError: undefined method `sqft' for Math:Module Stack Trace: from eval:10:in `eval' from eval:10:in `block (2 levels) in <main>' from eval:4:in `loop' from eval:4:in `block in <main>' Link to comment Share on other sites More sharing options...
KristjanM Posted July 20, 2023 Author Share Posted July 20, 2023 Sorry, typed sqft not sqrt !! Link to comment Share on other sites More sharing options...
KristjanM Posted July 20, 2023 Author Share Posted July 20, 2023 Okay, thanks to all for your help. 1st issue - don't type sqft when you need sqrt. 2nd issue - sqrt doesn't work in a text box but does work in the ruby console. So...need to make a macro. Thanks again. Link to comment Share on other sites More sharing options...
Joe_Carrick Posted July 20, 2023 Share Posted July 20, 2023 Eric is correct that it works in a text box - but you have to put it there as a macro evaluation. ie %...........%. You can even use a RTB and get all sorts of formatting. The advantage however of using a custom macro is that it can get data from the owner or referenced object and use that to return results. Link to comment Share on other sites More sharing options...
KristjanM Posted July 20, 2023 Author Share Posted July 20, 2023 Okay, more good info. My ruby syntax knowledge is rather primitive. I will play around with this. Thanks. 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