Home/ Reference/ Object Data

shape.StaticID

A unique ID within the file, read-only, and stable across reopening. The most dependable way to dedupe during traversal — the same object can arrive down several pat

Signature

shape.StaticID

Notes

A unique ID within the file, read-only, and stable across reopening. The most dependable way to dedupe during traversal — the same object can arrive down several paths.

Python example (runnable)

Requires pywin32. The example assumes app / doc / page / layer are already connected. See Connection & Init
Python
shape = app.ActiveSelectionRange(1)
print("Unique ID: ", shape.StaticID)

# dedupe by ID while walking
seen = set()
layer = doc.ActivePage.ActiveLayer
for i in range(1, layer.Shapes.Count + 1):
    s = layer.Shapes.Item(i)
    sid = s.StaticID
    if sid in seen:
        continue
    seen.add(sid)
print("Shapes after dedupe: ", len(seen))

About this section: Object Data

Object Data — object data and document properties.

Other entries in this section