Home/ Reference/ Align / Distribute

shape.AlignToShapeRange(AlignType, ShapeRange)

Aligns to a group of objects. Use it when a block of images should align as one unit — faster than doing them one by one.

Signature

shape.AlignToShapeRange(AlignType, ShapeRange)

Notes

Aligns to a group of objects. Use it when a block of images should align as one unit — faster than doing them one by one.

Python example (runnable)

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

ref = app.CreateShapeRange()                        # an empty range
ref.Add(shapes.Item(1))                             # add the reference shape to it
ref.Add(shapes.Item(2))

for i in range(3, shapes.Count + 1):
    shapes.Item(i).AlignToShapeRange(1, ref)        # 1 = align left to the group

print("The rest are aligned to the left edge of the first two")

About this section: Align / Distribute

Align / Distribute — align, distribute and transform.

Other entries in this section