Open CASCADE, the 3D modelling kernel
3D modeling & numerical simulation

Search the Forums
See All Topics

Duplicates by MapShapesAndAncestors

Duplicates by MapShapesAndAncestors
Nikolai 2013/04/18 11:30
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
You have to be logged in to download the attached file
Nikolai 2013/04/18 11:32
Correction: Indecies are actually 1:
BRepExtrema_SupportType typeSupp; = extr.SupportTypeShape2(1);
TopoDS_Shape shSupport = extr.SupportOnShape2(1);
Latest news
  • JT Assistant Linux and CAD Assistant
  • Open CASCADE JT Assistant
  • OCCT Applications

  • © OPEN CASCADE 2000 - 2015  |  Search  |  Contacts   |  Site map