Quantcast
Channel: RAM | STAAD Forum - Recent Threads
Viewing all articles
Browse latest Browse all 16762

OpenSTAAD GetAllPlateCenterMoments returns only zero values

$
0
0

I have written a VBA macro in Excel to extract plate element moments and forces from STAAD, but am getting all zeroes from the corresponding OpenSTAAD commands (GetAllPlateCenterMoments and GetAllPlateCenterForces) rather than the actual load case results. I am forbidden from sending my model, but here is my code:

sub Concrete_Crack()

Dim file As string
Dim path As String
Dim file_path As string
Dim plate_count As Long
Dim allplates() As Long
Dim plate As Long
Dim group As string
Dim lcmin As Long
Dim lcmax As Long
Dim lcn As Long
Dim Cmom(2) As Double
Dim Cfrc(4) As Double
Dim Mpr1 As Double
Dim Mpr2 As Double
Dim Mprplate As Double
Dim Mprmax() As Double
Dim Sxymax() As Double
Dim LCmaxM() As Long
Dim LCmaxV() As Long
Dim rowstart As Long
Dim ostd As Object

path = "C:\SProV8i SS6\STAAD\Staadpro.exe"
open_program = shell(path)

‘Open STAAD.pro
Application.wait (Now + Timevalue("0:00:05"))
Set ostd = GetObject(, "StaadPro.OpenSTAAD")

‘Determine STAAD file name
file = Cells(4, 2)

‘Determine path of current workbook (assuming STAAD files are in same path)
path = Application.Activeworkbook.path

‘Open STAAD file
file_path = path & Application.PathSeparator & file
ostd.OpenSTAADFile file_path

‘wait 15 seconds for model to open
Application.wait (Now + TimeValue("0:00:15"))

'Cycle through load combinations and get max Sxy, Mpr
group = Cells(3,2)
lcmin = Cells(5,2)
lcmax = Cells(6,2)
rowstart = Cells(7,2)

'Select group in STAAD
ostd.geometry.ClearPlateSelection

ostd.View.SelectGroup (group)
'Application.wait (Now + TimeValue(”0:00:03"))

‘Count number of plates selected
plate_count = ostd.geometry.GetNoOfSelectedPlates

'Clear and size arrays
Erase Mprmax
Erase Sxymax
Erase LCmaxM
Erase LcmaxV
ReDim Mprmax(plate_count - 1)
ReDim Sxymax(plate_count - 1)
ReDim LCmaxM(plate_count - 1)
ReDim LCmaxV(plate_count - 1)
ReDim allplates(plate_count - 1)

'Populate allplates array with list of selected plates
ostd.Geometry.GetSelectedPlates allplates

'Cycle through all plates and load combinations and extract forces/moments
For i = 0 To (plate_count - 1)
For j = lcmin To lcmax
ostd.output.GetAllPlateCenterMoments allplates(i), j, Cmom

'Calculate maximum principal moment for current load case
Mpr1 = Abs((Cmom(0) + Cmom(1)) / 2 + Sqr(((Cmom(0) - Cmom(1)) / 2 + Cmom(2) ^2)))
Mpr2 = Abs((Cmom(0) + Cmom(1)) / 2 - Sqr(((Cmom(0) - Cmom(1)) / 2 + Cmom(2) ^2)))

Mprplate = WorksheetFunction.Max(Mpr1, Mpr2)

ostd.Output.GetAllPlateCenterForces allplates(i), j, Cfrc

'Record maximum values if found

If Mprplate > Mprmax(i) Then
Mprmax(i) = Mprplate
LCmaxM(i) = j
End If

If Cfrc(4) > Sxymax(i) Then
Sxymax(i) = Cfrc(4)
LCmaxV(i) = j
End If

Next j
Next i

'Close STAAD
ostd.Quit

'Record maximum values

For k = 0 To (plate_count - 1)
Cells(rowstart + k, 1) = allplates(k)
Cells(rowstart + k, 2) = Format(Sxymax(k), "#####.00")
Cells(rowstart + k, 3) = LCmaxV(k)
Cells(rowstart + k, 4) = Format(Mprmax(k), "#####.00")
Cells(rowstart + k, 5) = LCmaxM(k)
Next k

End Sub

Thank you very much for any assistance you can provide.


Viewing all articles
Browse latest Browse all 16762

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>