Home/ Reference/ Geometry & Transform

shape.CenterX / .CenterY

Center coordinates. More convenient than Left/Top when you're aligning things.

Signature

shape.CenterX / .CenterY

Notes

Center coordinates. More convenient than Left/Top when you're aligning things.

Python example (runnable)

Requires pywin32. The example assumes app / doc / page / layer are already connected. See Connection & Init
Python
shape = app.ActiveSelectionRange(1)

# centre = (left+right)/2 and (top+bottom)/2; better than Left/Top for alignment
print("Centre X: ", (shape.Left + shape.Right) / 2)
print("Centre Y: ", (shape.Top + shape.Bottom) / 2)

print("CenterX:", shape.CenterX)          # also readable as a property
print("CenterY:", shape.CenterY)

About this section: Geometry & Transform

Geometry & Transform — position, size and rotation of shapes.

Other entries in this section