OpenSTAAD V8i
The following example macro uses several OpenSTAAD output functions to build a mode shape report for the results of a dynamic analysis.
Option Explicit
Sub Main()
Dim stdFile As String
Dim rptFile As String
Dim Tokens() As String
Dim staad As OpenSTAAD
Set staad = GetObject(,"StaadPro.OpenSTAAD")
staad.GetSTAADFile(stdFile, True)
Tokens = Split(stdFile,".")
rptFile = Tokens(0) + ".ModeShapeData.txt"
CreateModeShapeReport(rptFile, staad)
Set staad = Nothing
End Sub
Private Function CreateModeShapeReport(rptFile As String, staad As Object)
Dim I As Integer, J As Integer
Dim nNodeCount As Long
Dim nModeCount As Long
Dim nModeNo As Long
Dim setOfNodes() As Long
Dim setOfFrequency() As Double
Dim modVal(6) As Double
Dim szName As String
Dim tblno As Long
Dim rptno As Long
Dim idx As Long
nNodeCount = staad.Geometry.GetNodeCount()
'Variant GetNoOfModesExtracted();
nModeCount = staad.Output.GetNoOfModesExtracted()
Open rptFile For Output As #10
Print #10, "No of Nodes = ";nNodeCount
Print #10, "No of Modes Extracted = ";nModeCount
Print #10, ""
If nModeCount > 0 Then
ReDim setOfNodes(nNodeCount)
ReDim setOfFrequency(nModeCount)
'Variant GetModeFrequency(Variant varMode, Variant varFreq);
Print #10, "Mode Frequency (Hz)"
Print #10, "------------------------------------"
For I = 0 To nModeCount - 1
nModeNo = I+1
staad.Output.GetModeFrequency(nModeNo, setOfFrequency(I))
Print #10, nModeNo;Space$(10);Format$(setOfFrequency(I),"Standard")
Next
Print #10,
'Variant GetModalParticipationFactors(Variant varMode, Variant varfactorX, Variant varfactorY, Variant varfactorZ);
Dim Participation(3) As Double
Print #10, "Mode Participation X (%) Participation Y (%) Participation Z (%)"
Print #10, "------------------------------------------------------------------------"
For I = 0 To nModeCount - 1
nModeNo = I+1
staad.Output.GetModalParticipationFactors(nModeNo, Participation(1), Participation(2), Participation(3))
Print #10, nModeNo;Space$(10);Format$(Participation(1),"Scientific"); Space$(14); Format$(Participation(2),"Scientific"); Space$(14); Format$(Participation(3),"Scientific")
Next
Print #10,
'Variant GetModalDisplacementAtNode(Variant varMode, Variant arNode, Variant varModalDisps);
staad.Geometry.GetNodeList(setOfNodes)
Print #10, "Mode Node x y z"
Print #10, "--------------------------------------------------"
For I = 0 To nModeCount - 1
nModeNo = I+1
For J = 0 To nNodeCount - 1
staad.Output.GetModalDisplacementAtNode(nModeNo, setOfNodes(J), modVal)
Print #10, Format$(nModeNo,"00");Space$(5);Format$(setOfNodes(J),"000");Space$(5);Format$(modVal(0),"Scientific");Space$(5);Format$(modVal(1),"Scientific");Space$(5);Format$(modVal(2),"Scientific")
Next J
Next I
Print #10,
'The following function is currently not operational:-
'Variant GetMissingMassParticipationFactors
End If
Close #10
End Function