I'm writing NXOpen code which does some processin on nodes. My code is quite slow and I tracked this back to the function I'm calling to extract the node from the CAE database.
MyNode = CType(FeModel.Find("Node[" & NodeNumber "]"), CAE.FENode)
I have also tried the following code, but this is even slower...
MyNode = FeModel.FenodeLabelMap.GetNode(NodeNumber)
When solving a problem with the Nastran solver, a .dat file is written which also contains all nodes in the model. My observations are that this a significantly faster than the code I showed earlier.
How can I access my nodes with the same speed as NX CAE itself?
Thanks in advance
Solved! Go to Solution.
If you are doing this one at a time and instantiating the FeNodeLableMap each time, it can be slow. When I have the need, I typically get all of the nodes into my own dictionary up front:
Function getNodeList(ByVal caePart As CAE.CaePart) As SortedList(Of Integer, CAE.FENode) Dim feNodeList As New SortedList(Of Integer, CAE.FENode) Dim nodeLabelMap As CAE.FENodeLabelMap = Nothing If TypeOf caePart Is CAE.FemPart Then Dim femPart As CAE.FemPart = CType(caePart, CAE.FemPart) nodeLabelMap = femPart.BaseFEModel.FenodeLabelMap End If If TypeOf caePart Is CAE.SimPart Then Dim simPart As CAE.SimPart = CType(caePart, CAE.SimPart) nodeLabelMap = simPart.Simulation.Femodel.FenodeLabelMap End If Dim iNextNodeLabel As Integer = nodeLabelMap.AskNextNodeLabel(0) Do Until iNextNodeLabel < 0 Dim feNode As CAE.FENode = nodeLabelMap.GetNode(iNextNodeLabel) feNodeList.Add(iNextNodeLabel, feNode) iNextNodeLabel = nodeLabelMap.AskNextNodeLabel(iNextNodeLabel) Loop
Return feNodeList End Function
You could also build the list by getting all of the meshes from the MeshManager, then getting the nodes from SmartSelectionManager.CreateRelatedNodeMethod(). This should be faster, but would miss any unconnected nodes.