Hello,
I need to get the Id's and coordinates of the nodes of a meshing made with Workbench.
I write something like
myModel = dpf.Model(r"anywhere\file.rst")
myMeshing = myModel.metadata.meshed_region
length = len(myMehsing.nodes)
nodesId = [myMeshing.nodes[i].id for i in range(length)]
nodesCoordinates = [myMeshing.nodes[i].coordinates for i in range(length)]
But as I have more than 1e6 nodes, this takes a some time (about 26 seconds); Acceptable, as long as you do it once in a while.
I tried to use the Python slicing, nodesId = myMeshing.nodes[:].id, but I get a “TypeError: 'slice' object cannot be interpreted as an integer”.
So, is there an elegant and efficient way to get all the Id's and coordinates at once, or is the for loop the only solution?