Skip to main content
Welcome back to Script Tip Friday! Pernelle Marone-Hitz is a Lead Application Engineer at Ansys with incredible knowledge of scripting. Her Script Tip today answers the following questions: Using DPF in Mechanical how can I get:
  1. The ids and position of the nodes of a named selection
  2. Know which elements this node is attached to (node connectivity)
“Last week, I struggled for a few hours on this topic, so maybe it would help avoid others getting a headache if they have the same question! First, let’s use DPF to get the ids of the nodes in the named selection. The NS is a face NS in Mechanical, called “my_NS*”.* When written to the .rst file the named selection names are converted to capital letters so we need to search for the NS called “MY_NS”:
Then, let’s grab the complete mesh through:
Now we can use the info on the mesh and on the node Ids to get information on the nodes of this named selection:
Finally, for the node connectivity, we can use the NodalConnectivityPropertyField property of the mesh. One thing that is important to notice is that the connectivity will return the index of the element in the element list, which is not equal to the element Id. Once the index is known, the element Id can be obtained from the element list: