Traverses the Product Structure and computes the number of instances of unique parts and assemblies.
Description
As shown in model data guide product structure is represented by a graph of elements (ModelData::ModelElement ).
To traverse this graph, we use ModelData::ModelElementVisitor .
Assembly: Omni Wheel Assembly
--- Instance: OMNI WHEEL
--- --- Assembly: Omni Wheel
--- --- --- Instance: WHEEL ASSEMBLY
--- --- --- --- Assembly: Wheel assembly
--- --- --- --- --- Instance: SHAFT
--- --- --- --- --- --- Part: Shaft
--- --- --- --- --- Instance: WHEEL
--- --- --- --- --- --- Part: Wheel
--- --- --- --- --- Instance: BRACKET
--- --- --- --- --- --- Part: Bracket
--- --- --- --- --- Instance: BRACKET
--- --- --- --- --- --- Part: Bracket
To count the number of unique ModelData::ModelElement , we use BaseObjectHash .
Total:
name | type | count
Omni Wheel Assembly | Assembly | 1
Omni Wheel | Assembly | 1
Wheel assembly | Assembly | 1
Bracket | Part | 2
Wheel | Part | 1
Shaft | Part | 1
Files