Skip to main content
1-Visitor
January 18, 2011
Solved

Using Scripts in MathCAD (VB Script?) for foundation design calculation

  • January 18, 2011
  • 1 reply
  • 22774 views

A Big Hello to all fellow Civil & Structural Engineers!

I had thought that I should put this question in 'Programming & Extending MathCAD' discussion, but then I thought against it and decided to put this question here.

I thought I will just explain it the way it is in a language that fellow engineers will understand.

Bascially what I have is this

1) STAAD output of support reactions in MS excel worksheet.

2) MathCAD 15.0

Now what I want to do is

1) To script a code (please let me know whether I can do this without a code too) and run a loop so that it automatically pastes each and every node and load case number one by one in a particular variable by reading the following from the excel sheet.

2) As and when the node no and LC is getting pasted, the variables which I have assigned for forces like FX,FY and FZ should change automatically (The values of FX, FY and FZ will be read from the excel sheet)

3) Assuming that I have just one check , whose output is 'Safe' and 'Unsafe' should be tabulated in an array form for each and every load case and node no

4) I should be able to display the most critical LC and node no combination for documentation purposes.

I hope that I have not jumbled up all of this. Any help will be appreciated. I have done this in VB Macro in excel and am just shifting to MathCAD thus this long question.

Regards,

Debayan

Best answer by MikeArmstrong
But there is also one additional thing, the node number should be user editable, means if in the summary sheet if I see unsafe then I should be able to enter that node number somewhere in the sheet so that the I can review the actual calculation and see where it has failed.

Will the attached help?

I have added an extract function which loops through all elements of Evaluation and checks for the condition 'Unsafe' and then returns the original input data, in order for it to be checked. Is this what you had in mind?

Also the whole programming looks a bit greek to me , I know it is asking for much but could you please explain what your program does...coz If someone asks me, how this sheet functions then I will have to reply "Go and ask Mike!"

I will write some notes and re-post a bit later if that's ok?

1) Why can't I view the table in totality?

2) How do I make MathCAD recognize the Book1.xls file to read the contents if it is not located on desktop?

If you double left click and set the 'Matrix display options' under the display tab to Matrix you should be able to see it.

To change the path of the component, right click and select properties and browse for your file.

Hope this helps.

Mike

1 reply

1-Visitor
January 18, 2011

Welcome to the forum.

Can you provide the Excel sheet and maybe the Mathcad sheet, to see how far you have got. You could also provide examples of the results you expect to obtain for clarity.

Mike

Debayan1-VisitorAuthor
1-Visitor
January 18, 2011

Hey Mike!

Because of client confidentiality and all that, I had to make a mathcad sheet myself!

Please find attached excel sheet and MathCAD sheet. Please paste both on desktop.

In the excel sheet consider leftmost column as node numbers which I want to be pasted one by one to execute the condition "Safe/Unsafe" below.

The Mathcad sheet should have a variable for nodes so that when the node number pastes in that variable the values of x2,x3,x4 and x5 change automatically and pick the values which are to the right of the pasted node number.

Now in my sheet there are 17 nodes so in the end of the operation it should display a table which has two columns (one for node no and the other for result) which shows 1-safe,2-safe,3-unsafe...........and so on till 17th node.

I think it is similar to the READ-EVAL-PRINT LOOP.

Hope this helps.

1-Visitor
January 18, 2011

I think I'm sure I know what your after. It seems that you have extracted the values from the data incorrectly.

Are the values to be summated for each node found on the right hand side of the corresponding node number? (Columns 1 - 6)

Mike