Home/ Reference/ Group / Order / Boolean

shapeRange.Intersect(other)

Intersect: keeps only the overlap.

Signature

shapeRange.Intersect(other)

Notes

Intersect: keeps only the overlap.

Python example (runnable)

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

r1 = layer.CreateRectangle2(0, 0, 50/25.4, 50/25.4)
r2 = layer.CreateRectangle2(30/25.4, 0, 50/25.4, 50/25.4)

# select both shapes first
page.Shapes.Item(1).AddToSelection()
page.Shapes.Item(2).AddToSelection()

try:
    app.ActiveSelectionRange.Intersect()     # intersect: keep only the overlap
    print("Intersected; only the overlap remains")
except Exception as e:
    print("Intersect failed: ", e)

About this section: Group / Order / Boolean

Group / Order / Boolean — grouping, ordering and boolean operations.

Other entries in this section