'Abaqus find center of element set

I want to find the center of this red selected element set ('ES_'+ PartModelNameVertebra[l] + '_INFERIOR'); Image

Manually I am able to do so; Tools --> Query --> Mass properties --> I select the set and find the volume centroid to be; 23.76,-127.07,-726.18

As I need to do this for many parts, I want to script this using the following code;

# PartModelNameVertebra = 19 models. The photo shows 1 "PartModelNameVertabra model"
for l in range(PartModelNameVertebra):
     inst = mdb.models[PartModelNameVertebra[l]].rootAssembly.surfaces['ES_'+ PartModelNameVertebra[l] + '_INFERIOR']
     MassPropQuery  =mdb.models[PartModelNameVertebra[l]].rootAssembly.getMassProperties(regions=[inst,])
     print('MassPropQuery', MassPropQuery)

This code gives the error; sets and surfaces are not supported (I tried this with both sets and surfaces)

And when I select the elements of the set, like the following;

inst = mdb.models[PartModelNameVertebra[l]].rootAssembly.sets['ES_'+ PartModelNameVertebra[l] + '_INFERIOR_SET'].elements

It gives the error; regions[0]; found MeshElementArray, expecting GeomSequence

How come I can find the center manually, but not when I script it?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source