cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

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

SOLVED
Highlighted
Newbie

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

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

1 ACCEPTED SOLUTION

Accepted Solutions

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

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

19 REPLIES 19

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

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

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

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.

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

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

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

Something like the attached?

Mike

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

I am really thankful to you, as you have fairly got the correct idea as to what I want.

As for your first question, yes the data has been extracted incorrectly. I want values to the right of the node to be x2, x3 ....so on and so forth, I guess I can manage that.

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.

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!"

If that is a bit too much then can you please explain at least the following two things.

1) Which lines defines the start and end of the loop?

2) Which line asks MathCAD to make a table (it looks as if it has been exported)

Apart from this there are other silly doubts as below.

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?

Thanks a ton!

Debayan

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

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

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

Notes added to the worksheet. Hope you can understand it.

Mike

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

Mike you're my man! You hit the nail on the head. Now I know how to do this.

Just a wee bit of problem here.

I have noticed that you have programmed the whole equation into your loop for it to return results (The 4th point of your explanation). This was just an example, so I used simple terms like addition. The actual sheet in which I will use this program is very complicated and it will not be practical to define the whole thing in a loop.

I have updated the excel file you sent and attached it here so that you can see the exact condition that I need.

I have added one line that has Node, Col1 (which will have the value which is to the right of the mentioned node), Col2, Col3, Col4 and Col5

Now the loop should paste the nodes in the Variable 'Node' only, on doing so the values in Col1 to Col5 will get automatically updated from the excel sheet. This in turn will be linked to the x1 to x5 values below which will perform the calculation which I can see. The summary table should just literally pick the result from the 'Check' variable and 'Stack' it one below the other.

Thanks for the help Mike, you are a godsend.

Regards,

Debayan

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

I have noticed that you have programmed the whole equation into your loop for it to return results (The 4th point of your explanation). This was just an example, so I used simple terms like addition. The actual sheet in which I will use this program is very complicated and it will not be practical to define the whole thing in a loop.

I have updated the excel file you sent and attached it here so that you can see the exact condition that I need.

I have added one line that has Node, Col1 (which will have the value which is to the right of the mentioned node), Col2, Col3, Col4 and Col5

Now the loop should paste the nodes in the Variable 'Node' only, on doing so the values in Col1 to Col5 will get automatically updated from the excel sheet. This in turn will be linked to the x1 to x5 values below which will perform the calculation which I can see. The summary table should just literally pick the result from the 'Check' variable and 'Stack' it one below the other.

I'm not entirely sure what your after.

So you want to check each node separately?

Mike