return myRef.myRef->Label().FindChild(1);
}
-#define DEB_NAME 1
+#define FIX_BUG1 1
std::string GetShapeName(std::shared_ptr<Model_Document> theDoc, const TopoDS_Shape& theShape,
const TDF_Label& theLabel)
{
break;
case TopAbs_VERTEX:
- // name structure (Monifold Topology): F1 | F2 | F3; intersection of 3 faces defines a vertex.
+ // name structure (Monifold Topology):
+ // 1) F1 | F2 | F3 - intersection of 3 faces defines a vertex - trivial case.
+ // 2) F1 | F2 - intersection of 2 faces definses a vertex - applicable for case
+ // when 1 faces is cylindrical, conical, spherical or revolution and etc.
+ // 3) E1 | E2 | E3 - intersection of 3 edges defines a vertex - when we have case of a shell
+ // or compound of 2 open faces.
+ // 4) E1 | E2 - intesection of 2 edges defines a vertex - when we have a case of
+ // two independent edges (wire or compound)
+ // implemented 2 first cases
{
TopTools_IndexedDataMapOfShapeListOfShape aMap;
TopExp::MapShapesAndAncestors(aContext, TopAbs_VERTEX, TopAbs_FACE, aMap);
const TopTools_ListOfShape& aList2 = aMap.FindFromKey(aSubShape);
TopTools_ListOfShape aList;
TopTools_MapOfShape aFMap;
-#ifdef DEB_NAME
- int n = aList2.Extent(); //bug!
+#ifdef FIX_BUG1
+ //int n = aList2.Extent(); //bug!
+ // fix is below
TopTools_ListIteratorOfListOfShape itl2(aList2);
for (int i = 1;itl2.More();itl2.Next(),i++) {
if(aFMap.Add(itl2.Value()))
aList.Append(itl2.Value());
}
- n = aList.Extent();
+ //n = aList.Extent();
#endif
TopTools_ListIteratorOfListOfShape itl(aList);
for (int i = 1;itl.More();itl.Next(),i++) {
}
break;
}
+ // register name
+ aDoc->addNamingName(selectionLabel(), aName);
}
return aName;
}
return type();
}
- /// builds name of the SubShape
+ /// Builds name of the SubShape
virtual std::string buildSubShapeName(std::shared_ptr<GeomAPI_Shape> theSubShape,
const ResultPtr& theContext) = 0;
+
+ /// Selects sub-shape by Name
+ //virtual selectSubShape(const std::string& theSubShapeName, const std::string& theContextShapeName)
/// To virtually destroy the fields of successors
virtual ~ModelAPI_AttributeSelection()
{