Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 1

Sub GetMaxMoment()

Dim objOpenSTAAD As Object


Dim selBeamNo As Long 'Total numbers of selected beams
Dim selBeams() As Long 'Array of individual beam
Dim LC() As Long 'Array of individual load cases
Dim nLC As Integer 'Total number of load cases
Dim MaxMz As Double
Dim MinMz As Double
Dim temp As Double

Set objOpenSTAAD = GetObject(, "StaadPro.OpenSTAAD")


selBeamNo = objOpenSTAAD.Geometry.GetNoOfSelectedBeams 'No. of
selected beams
ReDim selBeams(selBeamNo - 1) As Long

'List out selected beams

objOpenSTAAD.Geometry.GetSelectedBeams selBeams, 1
For i = 0 To selBeamNo - 1
Cells(i + 6, 2) = selBeams(i)
Next i

'''## Looping through load-cases for each beams to get maximum moment out of all
load cases

For i = 1 To selBeamNo

For j = 1 To nLC

LC(j) = Cells(5 + j, 19 * CountEnvl).Value

'objOpenSTAAD.Output.GetIntermediateMemberForcesAtDistance selBeams(i -
1), dx(0), LC(j), Force

objOpenSTAAD.GetMaxBendingMoment selBeams(i - 1), "MZ", LC(j), temp


If temp > MaxMz Then MaxMz = temp

objOpenSTAAD.GetMinBendingMoment selBeams(i - 1), "MZ", LC(j), temp


If temp < MinMz Then MinMz = temp
Next j

Cells(5 + i, 19 * CountEnv - 5).Value = MaxMz


Cells(5 + i, 19 * CountEnv - 4).Value = MinMz

MaxMz = 0
MinMz = 0
Next i

Set objOpenSTAAD = Nothing

End Sub

You might also like