In GitLab by @klei_j0 on Feb 17, 2025, 20:45
It is possible to iterate the direct subshapes of a Shape. But the order of the subshapes is not necessarily consistent across multiple runs, if in each run the Shape is generated from a Shape::filter or Shape::select_subshapes call:
- Internally, to detect duplicates,
filter and select_subshapes manage the found shapes using an std::unordered_set, which uses a custom hash function that depends on the current memory address of a Shape's TopoDS_Shape's TShape. This memory address is bound to change across runs.
- When returning a
Shape from filter or select_subshapes the subshapes are stored in an ordered std::vector, but the ordering depends on the hash values of the elements in the std::unordered_set.
Ideally, we would use a hash function that is consistent across runs. I think I read that this is available in newer versions of OCCT (7.8?)
In GitLab by @klei_j0 on Feb 17, 2025, 20:45
It is possible to iterate the direct subshapes of a
Shape. But the order of the subshapes is not necessarily consistent across multiple runs, if in each run theShapeis generated from aShape::filterorShape::select_subshapescall:filterandselect_subshapesmanage the found shapes using anstd::unordered_set, which uses a custom hash function that depends on the current memory address of aShape'sTopoDS_Shape'sTShape. This memory address is bound to change across runs.Shapefromfilterorselect_subshapesthe subshapes are stored in an orderedstd::vector, but the ordering depends on the hash values of the elements in thestd::unordered_set.Ideally, we would use a hash function that is consistent across runs. I think I read that this is available in newer versions of OCCT (7.8?)