Duplicate parents from MapShapesAndAncestors?

I am trying to get the parents information of all sub-entities of a box. However, I seem to get duplicate parents. The details can be seen in the attached code and output log. Basically the code get all the sub-entities of the box (vertices, edges, etc), give them IDs, then when checking one sub-element's parent, I also check its ID.

An excerpt from the log file:

EDGE 1 has 2 SOLID parents: 1, 1,
VERTEX 1 has 6 SOLID parents: 1, 1, 1, 1, 1, 1, 
VERTEX 1 has 6 FACE parents: 1, 1, 3, 3, 6, 6, 
VERTEX 1 has 6 VERTEX parents: 1, 1, 1, 1, 1, 1,

Is this result expected? If yes, what could possible be the reason of these duplicates? If not, is there a mistake in my code?

Thank you!


Forum supervisor's picture

Dear Nicholas,

Some algorithms need to know how many times sub-shape is included in its ancestor, so they need ancestors to be duplicated.
We are going to add separate method, MapShapesAndUniqueAncestors(), allowing to get this information without duplicates.
See issue #26682

Best Regards,

Forum supervisor

Nicholas MW's picture

Dear Forum supervisor,

Thank you for your reply! I look forward to trying MapShapesAndUniqueAncestors() out. :)