Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations KootK on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

OpenSTAAD

Status
Not open for further replies.

Rahul Leslie

Structural
Mar 17, 2018
17
Hi,
I have been trying to extract model details via OpenSTAAD, but it is showing error right from the start (Error 438)... The code is as below


Private Sub CommandButton1_Click()
Dim openSTAADObj As Object

Set openSTAADObj = GetObject(, "StaadPro_OpenSTAAD")
openSTAADObj.OpenSTAADFile "D:\STD-Files\Str7.std"
'==========================NODES===============================
Dim nNodes As Long
nNodes = openSTAADObj.Geometry.GetNodeCount
Dim nodesList() As Long
[highlight #FCE94F]openSTAADObj.Geometry.GetNodeList nodesList()[/highlight]

Dim xCoord As Double
Dim yCoord As Double
Dim zCoord As Double

For i = 1 To nNodes-1
openSTAADObj.Geometry.GetNodeCoordinates (nodesList(i - 1)), xCoord, yCoord, zCoord

Worksheets("Sheet2").Range("A" & (i + 3)) = nodesList(i - 1)
Worksheets("Sheet2").Range("B" & (i + 3)) = xCoord
Worksheets("Sheet2").Range("C" & (i + 3)) = yCoord
Worksheets("Sheet2").Range("D" & (i + 3)) = zCoord
Next i
'=============================================================
Set openSTAADObj = Nothing
End Sub


The line giving the error is shown highlighted above ... The function used is as documented:

getNodeList_prqayf.png


Please, anyboby, any idea what the problem is?

Rahul Leslie
 
Replies continue below

Recommended for you

In a nutshel, I wonder whether the function...

openSTAADObj.Geometry.GetNodeList

...is working fine, in anybody's experience. In my case, with the VBA code given in above post, it is giving error, saying:

Run-time error '5'
Invalid procedure call or argument


where could I be wrong?

Rahul Leslie
 
Add

ReDim nodesList(nNodes-1) As Long

before openSTAADObj.Geometry.GetNodeList nodesList()

You also need your For-Next loop to go to nNodes not nNodes-1.

I'm assuming you know you can just copy and paste the STAAD nodes table into a spreadsheet.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor