Home/ Reference/ Group / Order / Boolean

shapeRange.FrontSubtract(other) / .BackSubtract(other)

Front minus back, or back minus front.

Signature

shapeRange.FrontSubtract(other) / .BackSubtract(other)

Notes

Front minus back, or back minus front.

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

layer.CreateRectangle2(0, 0, 50/25.4, 50/25.4)        # put it behind
layer.CreateRectangle2(30/25.4, 0, 50/25.4, 50/25.4)  # put it in front

page.Shapes.Item(1).AddToSelection()
page.Shapes.Item(2).AddToSelection()
rng = app.ActiveSelectionRange

try:
    rng.FrontSubtract()        # front minus back
    print("Front subtracted from back")
    # rng.BackSubtract()       # the reverse: back minus front
except Exception as e:
    print("FrontSubtract failed: ", e)

About this section: Group / Order / Boolean

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

Other entries in this section