Goal
Find walls, doors, rooms, and other elements in a received model graph — and build indexes for QA checks, schedules, and quantity reports.What you will build
Queries that count elements by category, check required properties, find duplicateapplicationId values, and group quantities by level.
When to use this
AfterReceive2 on connector-published data — before CSV export, version comparison, or sending analysis results back. Read BIM data patterns first if property names are unfamiliar.
Recommended approach
The recommended approach for most filtering tasks isFlatten() on the root object, then filter on DataObject.properties. Use GraphTraversal with DefaultTraversal only when you need parent context or connector-style walk rules.
Prerequisites
- Work with model objects
- Build your first model analysis tool — load a model first
On
DataObject instances, semantic fields live in properties: dataObject.properties.GetValueOrDefault("category"). Connector-produced BIM data often uses proxy collections — see Working with Proxies.Complete example
How it works
Flatten vs GraphTraversal
Flatten returns every Base in the graph — the right default for filtering and indexing:
GraphTraversal adds context (parent, property name) and custom walk rules:
Building indexes for repeated lookups
EachFlatten() is O(n). Build a dictionary once for multiple lookups:
applicationId index resolves proxies:
Common mistakes
| Mistake | Fix |
|---|---|
| Hand-written recursion on large graphs | Use Flatten or GraphTraversal — they guard against cycles |
| Rebuilding an index inside a loop | Build the dictionary once outside your query loop |
Reading obj["category"] on all connector data | Use DataObject.properties |
new GraphTraversal() with no rules | Always pass at least one rule, or use DefaultTraversal |
Duplicate results from displayValue | Exclude displayValue in custom traversal rules when extracting BIM properties separately |
Next steps
Export model data to CSV
Door and room schedules
Working with Proxies
Resolve levels and groups
Compare two model versions
Diff between publishes