ROBOT - API - VB.NET - Performance
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi there!
I have a question regarding the performance of extracting information from ROBOT. Maybe the poor performance I am getting is because I am doing something terribly wrong.
What I am trying to do is to extract the finite element information, such as conectivities, labels, and also the nodal information only of the subset of selected FEs.
This is an example of a loop over finite elements:
Dim rbtSel_FEs = Me._robApp.Project.Structure.Selections.Get(IRobotObjectType.I_OT_FINITE_ELEMENT)
rbtSel_FEs.FromText(listFEs)
Dim FEsCollection As IRobotCollection = Me._robApp.Project.Structure.FiniteElems.GetMany(rbtSel_FEs)
Dim iKont As Integer = 0
For II = 1 To FEsCollection.Count
iKont += 1
Dim kFE As IRobotFiniteElement
kFE = FEsCollection.Get(iKont)
Dim iFE As ItemFE = New ItemFE
iFE.ID = kFE.Number
iFE.N1 = kFE.Nodes.Get(1)
iFE.N2 = kFE.Nodes.Get(2)
iFE.N3 = kFE.Nodes.Get(3)
If (kFE.FeType = IRobotFiniteElementType.I_FET_T3) Then
iFE.FE_Type = "I_FET_T3"
iFE.N4 = -1
ElseIf (kFE.FeType = IRobotFiniteElementType.I_FET_Q4) Then
iFE.FE_Type = "I_FET_Q4"
iFE.N4 = kFE.Nodes.Get(4)
End If
Me.theFEs.Add(iFE)
Next
This is the other loop that take ages,
For Each iFE As ItemFE In Me.theFEs
'Nodo 1...
If (Me.theNodes.posVec(iFE.N1 - 1) = -1) Then
kPos += 1
Me.theNodes.posVec(iFE.N1 - 1) = kPos
iNode = getNodalInfo(iFE.N1)
Me.theNodes.Items.Add(iNode)
End If
'Nodo 2...
If (Me.theNodes.posVec(iFE.N2 - 1) = -1) Then
kPos += 1
Me.theNodes.posVec(iFE.N2 - 1) = kPos
iNode = getNodalInfo(iFE.N2)
Me.theNodes.Items.Add(iNode)
End If
'Nodo 3...
If (Me.theNodes.posVec(iFE.N3 - 1) = -1) Then
kPos += 1
Me.theNodes.posVec(iFE.N3 - 1) = kPos
iNode = getNodalInfo(iFE.N3)
Me.theNodes.Items.Add(iNode)
End If
Next
Private Function getNodalInfo(ByVal iNode As Integer) As ItemNode
Dim nodeToReturn As ItemNode = New ItemNode
Dim rbtSel_Node = Me._robApp.Project.Structure.Selections.Get(IRobotObjectType.I_OT_NODE)
rbtSel_Node.FromText(iNode.ToString)
Dim pointCollection As IRobotCollection = Me._robApp.Project.Structure.Nodes.GetMany(rbtSel_Node)
Dim iPoint As IRobotNode
iPoint = pointCollection.Get(1)
nodeToReturn.ID = iNode
nodeToReturn.X = iPoint.X
nodeToReturn.Y = iPoint.Y
nodeToReturn.Z = iPoint.Z
Return nodeToReturn
End Function
Also at the begining of the process I am doing this: robApp.Interactive = 0. In such a way I expect the process to finish in like 6 hours to get the info of 69000 FEs and 45000 nodes. The specs of the PC are: 64Gb of RAM and AMD Ryzen 7 2700 Eight-Core.
I would kindly appreciate if someone can tell me if in someone's experience this performance I am getting is ridiculously poor. In my experience they are, compared with other pre-processors.
Greetings!