Element centroid

Hi all,

How can I extract centroid of each element in the selected set and output them to .txt file?

thanks and regards.