Etienne17
Mechanical
- Dec 4, 2020
- 6
Hello everyone,
With a script I try to get the coordinates of the nodes of a particular surface.
The problem is that they are sorted according to their index and it gives this as a result for example:
The following image illustrates the first points:
I would like to be able to sort them as follows:
Do you think it's possible?
Here is the code I used:
With a script I try to get the coordinates of the nodes of a particular surface.
The problem is that they are sorted according to their index and it gives this as a result for example:
Python:
coord = [G,E,K,
L,J,B,
N,K,M
H,I,A,
F,C,O ]
The following image illustrates the first points:
I would like to be able to sort them as follows:
Python:
coord = [A,F,K
B,G,L
C,H,M
D,I,N
E,J,O ]
Do you think it's possible?
Here is the code I used:
Python:
n1=mdb.models['Model'].rootAssembly.sets['SURFACE']
xyz_coor = []
for i in range(0,len(n1.nodes)):
xyz_coor.append([n1.nodes[i].coordinates[0],n1.nodes[i].coordinates[1],n1.nodes[i].coordinates[2],n1.nodes[i].label])