Now that you understand the data model, here are practical patterns for traversing and processing Speckle models. These recipes assume you have a Root Collection object.
Recipe 1: Traverse Collections and Objects
The most common pattern: walk the collection hierarchy to find all objects.
Recipe 2: Find All DataObjects
Filter for DataObjects specifically:
Recipe 3: Process Geometry from displayValue
Extract and process geometry from DataObjects:
Recipe 4: Resolve Proxy References
Find which objects use a specific resource:
Recipe 5: Find Resources for an Object
Find which resources (materials, groups, etc.) an object uses:
Recipe 6: Resolve Instance Definitions
Get geometry for instance objects:
Recipe 7: Build Object-Resource Map
Create a lookup map for efficient access:
Recipe 8: Filter by Properties
Find objects matching specific property criteria:
Recipe 9: Process by Collection Path
Process objects organized by their collection hierarchy:
Gather statistics about a model:
Common Patterns Summary
- Always check for attributes - Use
hasattr() before accessing properties
- Handle empty arrays -
displayValue and objects may be empty
- Use applicationId for references - Proxies reference by
applicationId, not id
- Recurse collections - Collections can be nested to any depth
- Check speckle_type - Use
speckle_type to identify object types
- Proxies are at root - Always look for proxies in Root Collection
- Geometry in displayValue - All DataObject geometry is in
displayValue
Next Steps
Last modified on July 18, 2026