shape.AlignToShape(AlignType, TargetShape)
Aligns to another object. The argument order is alignment first, target second; swap them and it fails silently.
Signature
shape.AlignToShape(AlignType, TargetShape)
Notes
Aligns to another object. The argument order is alignment first, target second; swap them and it fails silently.
Python example (runnable)
Requires
pywin32. The example assumes app / doc / page / layer are already connected.
See Connection & InitPython
shapes = app.ActiveSelectionRange
if shapes.Count < 2:
raise SystemExit("Select at least two shapes")
target = shapes.Item(1) # the first one is the reference
for i in range(2, shapes.Count + 1):
shapes.Item(i).AlignToShape(4, target) # 4 = align tops to target
print("All tops aligned to the first shape")
About this section: Align / Distribute
Align / Distribute — align, distribute and transform.
- This section has 8 entries; this is one of them.
- See the full section index: Align / Distribute
Other entries in this section
- shape.AlignToPage(AlignType)Aligns to the page. The batch-layout workhorse: align everything left,
- shape.AlignToPageCenter(AlignType)Aligns to the page center, strictly, with each axis specified separate
- shape.AlignToShapeRange(AlignType, ShapeRange)Aligns to a group of objects. Use it when a block of images should ali
- shape.Rotate(Angle)Rotates around the rotation center, in degrees, counter-clockwise posi
- shape.SetRotationCenter(X, Y)Sets the rotation center. Put it at the page center and rotate in a lo
- shape.Skew(Angle)Skew (shear). Cleaner than dragging an edge for italic signage or spee
- shape.SetBoundingBox(X, Y, Width, Height)Sets position and size in one call — positioning and scaling merged. T