Hello,
I need to extract panel node results from multiple model files.
I'm using the following code to extract results:
'-----------------------------------------
Dim robotapp As IRobotApplication
robotapp = New RobotApplication
For i = 1 To grid1.Rows.Count - 2
robotapp.Project.Open(vecrutafile(i - 1))
robotapp.Project.Preferences.Units.Refresh()
Dim filename As String
filename = "\" & grid1(i, 1) & "_" & txtfile2pan.Text & ".csv"
Dim objWriter As New IO.StreamWriter(savepath & filename)
Dim RSelection As RobotSelection
RSelection = robotapp.Project.Structure.Selections.Create(IRobotObjectType.I_OT_PANEL)
RSelection.FromText(elem)
Dim panelcoll As RobotObjObjectCollection
panelcoll = robotapp.Project.Structure.Objects.GetMany(RSelection)
Dim FileLines As String
FileLines = ""
FileLines = "Panel,Node,Case,UXX (cm),UYY (cm),WNorm. (cm),RXX (Deg),RYY (Deg)" & vbCrLf
For j = 1 To panelcoll.Count
Dim obj As IRobotObjObject
obj = panelcoll.Get(j)
Dim panelnum As Long
panelnum = obj.Number
Dim nodes As String
Dim nodesel As RobotSelection
Dim nodecoll As RobotNodeCollection
nodes = obj.Nodes
nodesel = robotapp.Project.Structure.Selections.Create(IRobotObjectType.I_OT_NODE)
nodesel.FromText(nodes)
nodecoll = robotapp.Project.Structure.Nodes.GetMany(nodesel)
Dim FEparams As New RobotFeResultParams
If combolayer.SelectedIndex = 0 Then
FEparams.Layer = IRobotFeLayerType.I_FLT_UPPER
ElseIf combolayer.SelectedIndex = 1 Then
FEparams.Layer = IRobotFeLayerType.I_FLT_MIDDLE
ElseIf combolayer.SelectedIndex = 2 Then
FEparams.Layer = IRobotFeLayerType.I_FLT_LOWER
Else
End If
FEparams.SetDirX(IRobotObjLocalXDirDefinitionType.I_OLXDDT_UNDEFINED, 0, 0, 0)
For k = 1 To nodecoll.Count
Dim node As IRobotNode
node = nodecoll.Get(k)
Dim nodenum As Long
nodenum = node.Number
FEparams.Node = node.Number
FEparams.Case = caso
Dim FEresults As RobotFeResultDetailed
FEresults = robotapp.Project.Structure.Results.FiniteElems.Detailed(FEparams)
FileLines = FileLines & " " & panelnum & ", " & nodenum & ", " & caso & ","
FileLines = FileLines & Format(FEresults.UXX * 100, "0.000") & ","
FileLines = FileLines & Format(FEresults.UYY * 100, "0.000") & ","
FileLines = FileLines & Format(FEresults.WNorm * 100, "0.000") & ","
FileLines = FileLines & Format(FEresults.RXX * (180 / Math.PI), "0.000") & ","
FileLines = FileLines & Format(FEresults.RYY * (180 / Math.PI), "0.000") & vbCrLf
Next
Next
objWriter.Write(FileLines)
objWriter.Close()
robotapp.Project.Close()
Next
robotapp.Quit(IRobotQuitOption.I_QO_DISCARD_CHANGES)
'-----------------------------------------
The problem is that extracting results for each model is taking up to 8min (larger models with aprox 300 panels and 80 nodes per panel), and total number of models is around 80.
Is there any way to speed up the process?
Regards,
Solved! Go to Solution.