centrx#
- Query.centrx(e)#
Return the x coordinate of the element centroid.
Fetches centroid X-coordinate of element
e
in global Cartesian coordinate system. Centroid is determined from the selected nodes on the element.- Parameters:
- e
int
The element number of the element to be considered.
- e
- Returns:
float
The centroid coordinate.
- Return type:
Examples
Here we construct a line between the coordinates
(0, 0, 0)
and(1, 2, 3)
then find the centroid x-coordinate of this element.>>> from ansys.mapdl.core import launch_mapdl >>> mapdl = launch_mapdl() >>> mapdl.prep7() >>> n0 = mapdl.n(1, 0, 0, 0) >>> n1 = mapdl.n(2, 1, 2, 3) >>> mapdl.et(1, 'LINK11') >>> e0 = mapdl.e(n0, n1) >>> mapdl.queries.centrx(e0) 0.5