- TopTools_ListIteratorOfListOfShape itl(aList);
- for (int i = 1;itl.More();itl.Next(),i++) {
- const TopoDS_Shape& aFace = itl.Value();
- std::string aFaceName = GetShapeName(aDoc, aFace, selectionLabel());
- if(i == 1)
- aName = aFaceName;
- else
- aName += "|" + aFaceName;
+ int n = aList.Extent();
+ if(n < 3) { // open topology case => via edges
+ TopTools_IndexedDataMapOfShapeListOfShape aMap;
+ TopExp::MapShapesAndAncestors(aContext, TopAbs_VERTEX, TopAbs_EDGE, aMap);
+ const TopTools_ListOfShape& aList2 = aMap.FindFromKey(aSubShape);
+ if(aList2.Extent() >= 2) { // regular solution
+ TopTools_ListIteratorOfListOfShape itl(aList2);
+ for (int i = 1;itl.More();itl.Next(),i++) {
+ const TopoDS_Shape& anEdge = itl.Value();
+ std::string anEdgeName = GetShapeName(aDoc, anEdge, selectionLabel());
+ if(i == 1)
+ aName = anEdgeName;
+ else
+ aName += "|" + anEdgeName;
+ }
+ }
+ }
+ else {
+ TopTools_ListIteratorOfListOfShape itl(aList);
+ for (int i = 1;itl.More();itl.Next(),i++) {
+ const TopoDS_Shape& aFace = itl.Value();
+ std::string aFaceName = GetShapeName(aDoc, aFace, selectionLabel());
+ if(i == 1)
+ aName = aFaceName;
+ else
+ aName += "|" + aFaceName;
+ }