我在为某种情况创建宏时遇到问题。 我有一个STAAD模型,它有8个梁和10个载荷箱。 我想获得所有光束的光束末端力,但仅限于此 载入案例1和2。
这是代码
Sub ExtractLC_Click()
Sheets("COPING BEAM").Range("A:I").ClearContents
'Variable Declaration
Dim lMemberNo As Long
Dim lEnd As Long
Dim lLoadCase As Long
Dim dForceArray(6) As Double
Dim icount As Integer
Dim ret As Boolean
Dim path As String
path = Sheets("Main").Cells(185, 23).Value
Set staad = GetObject(, "StaadPro.OpenSTAAD")
staad.OpenSTAADFile path
'extract beam end forces
lMemberNo = Sheets("Main").Cells(184, 10).Value
For x = 2 To 6
lLoadCase = Sheets("SEISMIC").Range("B" & x).Value
ret = staad.Output.GetMemberEndForces(lMemberNo, lEnd, lLoadCase, dForceArray)
For icount = 0 To 5
Sheets("SEISMIC").Cells(x, 3 + icount).Value = dForceArray(icount)
Next icount
Next x
Set staad = Nothing
End Sub
然而对于这一行:
Output.GetMemberEndForces(lMemberNo, lEnd, lLoadCase, dForceArray)
仅提取光束的 START 力而不是 END 。 Excel and STAAD comparison
我想要两个。是否有某些涉及开放STAAD的代码, 复制所有成员结束力?谢谢你的帮助!
答案 0 :(得分:0)
美好的一天!
您可以为“借”添加循环语句。
示例:
For lend = 0 to 1
For x = 2 To 6
lLoadCase = Sheets("SEISMIC").Range("B" & x).Value
ret = staad.Output.GetMemberEndForces(lMemberNo, lEnd, lLoadCase, dForceArray)
For icount = 0 To 5
Sheets("SEISMIC").Cells(x, 3 + icount).Value = dForceArray(icount)
Next icount
Next x
next lend
虽然您仍然需要稍微编辑代码以将结果粘贴到不同的单元格中。