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:
eint

The element number of the element to be considered.

Returns:
float

The centroid coordinate.

Return type:

float

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