Duplicates by MapShapesAndAncestors

Hi guys.
Thanks for the super work

I am trying to access faces sharing a single vertex of a box. I get 6 faces. Same with edges.

For completeness, the vertex is the nearest in the box when I am getting distance between two boxes (see the pict). Everything works and faces are correct but they are each duplicated in the list. So the list has 6 of them. Is it a bug?

const TopoDS_Shape& shapeObjectThis= ...;
const TopoDS_Shape& shapeObjectOther = ..;

BRepExtrema_DistShapeShape extr( shapeObjectThis, shapeObjectOther);

BRepExtrema_SupportType typeSupp; = extr.SupportTypeShape2(0);

TopoDS_Shape shSupport = extr.SupportOnShape2(0);

if(typeSupp == BRepExtrema_IsVertex)
TopoDS_Vertex tdsVtx = TopoDS::Vertex(shSupport);

TopTools_IndexedDataMapOfShapeListOfShape mapIncidence;
TopExp::MapShapesAndAncestors(shapeObject, TopAbs_VERTEX, TopAbs_FACE, mapIncidence);
Standard_Integer iThis = mapIncidence.FindIndex(tdsVtx);
TopTools_ListOfShape& list = mapIncidence(iThis);
Standard_Integer n = list.Extent(); //6 !

Thank You

Nikolai's picture

Correction: Indecies are actually 1:
BRepExtrema_SupportType typeSupp; = extr.SupportTypeShape2(1);
TopoDS_Shape shSupport = extr.SupportOnShape2(1);