I have a group/component/selected set of nodes, and I want to find the average position. How can I do this?

This may be desirable in a number of situations; for example, to find the approximate centroid of a surface that was a named selection in Simulation.

You will have to *VGET an array for the coordinates of all nodes (*VGET,allX,NODE,1,LOC,X), *VGET an array for the selected state of all nodes (*VGET,maskX,NODE,1,NSEL), mask the unselected nodes from the following operation (*VMASK,maskX), then calculate the average position of the selected nodes (*VSCFUN,avgX,MEAN,allX). Repeat this for Y and Z, then you will have the coordinates of the average position of the nodes (avgX,avgY,avgZ).




Show Form
No comments yet. Be the first to add a comment!