Dear all: I have two questions related:
1.- Is it possible to get, via API, the value for «alpha cr X» and «alpha cr Y»? They are calculated for each storey but they don't appear in:
RobApp.Project.Structure.Results.Storeys.Displacements
RobApp.Project.Structure.Results.Storeys.ReducedForces
RobApp.Project.Structure.Results.Storeys.Values
2.- if I have a moving load, for each combination I would have several components. Due to this, for each component I should have a value for «alpha cr X» and «alpha cr Y». How can I get them? Is it possible to get via API?
Thanks in advance.
Solved! Go to Solution.
Solved by Rafal.Gaweda. Go to Solution.
Ok, so I understand there is no possibility to get values of alpha CR via API (whereas ROBOT calculates them).
On the other hand, I was asking too that if I have a moving load, for each combination I would have several components, so I should have several values for storey deformation and loads (for each component). How can we get them (via API it is not implemented I suppose, I'm asking if they can be seen in tabular data).
hello, is there a solution to my code, i want to retrieve the reduce forces FX FY for a specific Load Comb, but i get an error here that i cant figurout
' Get the collection including all the stories
Dim story_col As IRobotCollection
Set story_col = robapp.Project.Structure.Storeys.GetAll()
here the full code
Sub ExportStoreyResultsToExcel()
' Add reference to the active worksheet
Dim ws As Worksheet
Set ws = ActiveSheet
' Declare the main variable representing Robot application and connect it to the currently running program instance.
Dim robapp As IRobotApplication
Set robapp = New RobotApplication
' Declare and initialize the variable representing the storey results server.
Dim storey_res_serv As IRobotStoreyResultServer
Set storey_res_serv = robapp.Project.Structure.Results.Storeys
' Get the collection including all the stories
Dim story_col As IRobotCollection
Set story_col = robapp.Project.Structure.Storeys.GetAll()
' Find the range starting from the named range "force"
Dim ForceTable As Range
Set ForceTable = ws.Range("force")
' Clear existing content in the table range
ForceTable.CurrentRegion.Clear
ForceTable.CurrentRegion.ClearContents
' Write and format header
With ForceTable.Resize(1, 10)
.Value = Array("Storey Name", "Case Name", "FX", "FY", "FZ", "DrUX", "DrUY", "ex0", "ey0", "ex1", "ey1")
.Font.Bold = True
.Interior.Color = RGB(150, 170, 220) ' Light Blue
.HorizontalAlignment = xlCenter
.Borders.LineStyle = xlContinuous
End With
' Set starting row for data output
Dim DataStartRow As Long
DataStartRow = ForceTable.Row + 1 ' Start below the header
' Define the case numbers to be extracted
Dim caseNumbers() As Long
caseNumbers = Array(4, 5)
' Iterate for consecutive stories from the collection.
Dim i As Integer, j As Integer
For i = 1 To story_col.Count
' Get i-th story.
Dim story As IRobotStorey
Set story = story_col.Get(i)
' Read the name of the story.
Dim story_name As String
story_name = story.Name
' Iterate for the specified case numbers
For j = LBound(caseNumbers) To UBound(caseNumbers)
Dim cas_num As Long
cas_num = caseNumbers(j)
' Get the reduced forces for the specific storey and combination
Dim red_force As RobotStoreyReducedForces
Set red_force = storey_res_serv.ReducedForces(story.Number, cas_num)
' Get the displacements for the specific storey and combination
Dim disp As RobotStoreyDisplacements
Set disp = storey_res_serv.Displacements(story.Number, cas_num)
' Get the story values for the specific storey
Dim story_values As RobotStoreyValues
Set story_values = story.Values
' Write the results to Excel
With ForceTable.Offset(DataStartRow, 0).Resize(1, 11)
.Value = Array(story_name, "Case " & cas_num, red_force.FX, red_force.FY, red_force.FZ, _
disp.DrUX, disp.DrUY, story_values.Ex0, story_values.Ey0, story_values.Ex1, story_values.Ey1)
.HorizontalAlignment = xlCenter
.Borders.LineStyle = xlContinuous
End With
DataStartRow = DataStartRow + 1 ' Move to the next row
' Free references.
Set red_force = Nothing
Set disp = Nothing
Next j
' Free references.
Set story = Nothing
Next i
' Free references
Set storey_res_serv = Nothing
Set robapp = Nothing
Set ws = Nothing
End Sub
Can't find what you're looking for? Ask the community or share your knowledge.