Message 1 of 8
Not applicable
09-04-2011
02:43 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hope someone can help me.
I'm using VB to extract peak member forces from Robot for a given set of load cases. Unfortunately in the case where a given bar position has 2 member forces, Robot will pass the lower of the 2 values to Excel. The result is that my code and spreadsheet and therefore my structural design is not capturing the peak moment.
I don't think this is a problem with my code, its working at every other position of the structure. I have a work around in mind, but forcing a peak moment extraction would be first prize.
Private Sub GetBarForces()
Dim rbForceServer As RobotBarForceServer
Dim rbCase_Col As RobotCaseCollection
Dim lBarNum As Long
Dim lCaseNum As Long
Dim rbForceData As RobotBarForceData
Dim ResultFx As Double, ResultFz As Double, ResultMy As Double
Dim rbCase As IRobotCase
Dim rbCase_Sel As RobotSelection
Dim i, j As Integer
Dim iNumPositions As Integer
Dim iMinFx, iMaxFx As Single
Dim iMinFz, iMaxFz As Single
Dim iMinMy, iMaxMy As Single
Dim iBarPosition, iBarLength As Single
Dim rRange As Range
'set collection of load cases
Set rbCase_Sel = Robot.Project.Structure.Selections.Create(I_OT_CASE)
rbCase_Sel.AddText (sCaseNums)
Set rbCase_Col = Robot.Project.Structure.Cases.GetMany(rbCase_Sel)
'set Robot forceserver
Set rbForceServer = Robot.Project.Structure.Results.Bars.Forces
With Worksheets("Case 2&3- " & vWallResults(1, iWallNum))
.Unprotect
iBarLength = vWallResults(3, iWallNum) - vWallResults(4, iWallNum)
Set rRange = .Range("A:A")
iNumPositions = Application.WorksheetFunction.Count(rRange)
For i = 1 To iNumPositions
'update status window
With frmStatusWindow
.txtStatusWindow = .txtStatusWindow.Text _
& ". "
End With
'set position on bar for force extraction
iBarPosition = (vWallResults(3, iWallNum) - .Cells(6 + i, 1)) / iBarLength
For j = 1 To rbCase_Col.Count
'get jth load case
Set rbCase = rbCase_Col.Get(j)
lCaseNum = rbCase.Number
'set bar number for force extraction
lBarNum = vWallResults(2, iWallNum)
'extract forces/moments
Set rbForceData = rbForceServer.Value(lBarNum, lCaseNum, iBarPosition)
ResultFx = rbForceData.FX
ResultFz = rbForceData.FZ
ResultMy = rbForceData.MY
'initialise envelope variables
If j = 1 Then
iMinFx = ResultFx
iMaxFx = ResultFx
iMinFz = ResultFz
iMaxFz = ResultFz
iMinMy = ResultMy
iMaxMy = ResultMy
End If
'compare forces/moments to determine envelope
If ResultFx < iMinFx Then
iMinFx = ResultFx
End If
If ResultFx > iMaxFx Then
iMaxFx = ResultFx
End If
If ResultFz < iMinFz Then
iMinFz = ResultFz
End If
If ResultFz > iMaxFz Then
iMaxFz = ResultFz
End If
If ResultMy < iMinMy Then
iMinMy = ResultMy
End If
If ResultMy > iMaxMy Then
iMaxMy = ResultMy
End If
Set rbForceData = Nothing
Next j
'record force/moment envelope to spreadsheet
With rCase
.Cells(6 + i, 1) = iMinFx / 1000
.Cells(6 + i, 2) = iMaxFx / 1000
.Cells(6 + i, 3) = iMinFz / 1000
.Cells(6 + i, 4) = iMaxFz / 1000
.Cells(6 + i, 5) = iMinMy / 1000
.Cells(6 + i, 6) = iMaxMy / 1000
End With
Next iThanks in Advance for your help.
Solved! Go to Solution.

