Home/ Reference/ Geometry & Transform

shape.StaticID

Stable ID. Use it to deduplicate when the same object arrives down more than one path. You can't traverse groups and containers without it.

Signature

shape.StaticID

Notes

Stable ID. Use it to deduplicate when the same object arrives down more than one path. You can't traverse groups and containers without it.

Python example (runnable)

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

sid = shape.StaticID                    # the ID is stable across passes
print("StaticID:", sid)

# typical use: dedupe while walking groups and containers
seen = set()
seen.add(sid)
print("Recorded; skip it if it comes round again")

About this section: Geometry & Transform

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

Other entries in this section