layer.FindShapes(query, type, recursive)
Layer-level search. The three calls worth memorizing: ("", 6, True) text, ("", 7, True) groups, ("", 5, True) bitmaps.
Signature
layer.FindShapes(query, type, recursive)
Notes
Layer-level search. The three calls worth memorizing:
("", 6, True) text, ("", 7, True) groups, ("", 5, True) bitmaps.Python example (runnable)
Requires
pywin32. The example assumes app / doc / page / layer are already connected.
See Connection & InitPython
layer = doc.ActivePage.ActiveLayer
texts = layer.FindShapes("", 6, True) # 6=text, True=look inside groups too
print("Text shapes: ", texts.Count)
groups = layer.FindShapes("", 7, True) # 7=group
print("Groups: ", groups.Count)
bitmaps = layer.FindShapes("", 5, True) # 5=bitmap
print("Bitmaps: ", bitmaps.Count)
About this section: Layer & Shapes
Layer & Shapes — layers and shape creation.
- This section has 14 entries; this is one of them.
- See the full section index: Layer & Shapes
Other entries in this section
- layer.CreateRectangle2(x, y, w, h)Draws a rectangle. (x, y) is the bottom-left corner; w and h are width
- layer.CreateRectangle(l, t, r, b)Rectangle from four edges. t (top) must be a larger number than b (bot
- layer.CreateEllipse2(x, y, w, h)Ellipse from bottom-left corner plus size. w == h gives a circle.
- layer.CreateEllipse(l, t, r, b)Ellipse from four edges.
- layer.CreateArtisticText(left, top, text, lang, charset, font, size, bold, italic, underline, align)Creates artistic text (a single-line heading). size is in points, not
- layer.CreateParagraphText(left, top, right, bottom, text, lang, charset, font, size, bold, italic, underline, align)Creates paragraph text that wraps inside a box. Requirement: top > bot
- layer.Import(path, filter, options)Imports an image, SVG or other external file. 0 means auto-detect the
- layer.CreateCurve(...) / layer.CreateFreehandCurve(...)Builds a curve from an array of points. Used for procedural artwork (f