Find & Traverse 11 entries
walking the shape tree
Entries in this section
- coll.FindShapes(query, shapeType, recursive)The main search call. query is a string condition (empty means anything), shapeType takes
- coll.FindShapes("", 6, True)Every text object. The most-used call of the lot, and it drills through groups and contain
- coll.FindShapes("", 7, True)Every group. When a document is huge, searching only the current level for groups skips th
- coll.FindShapes("", 5, True)Every bitmap.
- coll.FindShapes("", 3, True)Every curve.
- coll.FindShapes("@fill.color='#FF0000'", 0, True)Search by property condition, SQL-ish syntax. It cuts the amount of data coming back, but
- for i in range(1, coll.Count+1): s = coll.Item(i)Manual iteration. Remember that CDR collections start at 1, so Python's range needs +1.
- shape.Type == 7 → shape.ShapesTest for a group, then descend. Cap the recursion depth (8 levels in the code) to survive
- shape.PowerClip → .ShapesContainer descent. Containers can sit inside containers, so push those onto the stack too.
- Deduplicate shapes by StaticIDThe same object can arrive down more than one path (a group query and a container query ov
- coll.CountElement count for the collection. More reliable than len(coll), which doesn't always work
Getting StartedConnection & InitApplicationDocumentPageLayer & ShapesGeometry & TransformGroup / Order / BooleanShape AppearanceTextTextRangeFillOutlinePowerClipFountain FillPattern / Texture FillTransparency & BlendEffectsColorCurve & NodeBitmapFind & TraverseUnits & ConversionImport / ExportEnumerationsObject DataAlign / DistributeLayer AdvancedView & PerformanceEventsRecipesPitfalls