+
+ // if the subshape is part of a result face, select the whole face (#1997)
+ bool isSelectionMode = false; // and other don't set shapes - all the naming is in face label
+ if (!aSubShape.IsNull() && aSubShape.ShapeType() > TopAbs_FACE) {
+ for(int aFaceIndex = 0; aFaceIndex < facesNum(); aFaceIndex++) {
+ TopExp_Explorer anExp(face(aFaceIndex)->impl<TopoDS_Shape>(), aSubShape.ShapeType());
+ for(; anExp.More(); anExp.Next()) {
+ if (aSubShape.IsSame(anExp.Current())) { // this is the case: select the whole face
+ // here just store the face index (to update face if update of edge is needed)
+ TNaming_Builder aBuilder(aLab);
+ aBuilder.Select(aSubShape, aSubShape);
+ int aFaceSelID = select(face(aFaceIndex), theExtDoc, -1);
+ TDF_Reference::Set(aLab, aLab.Father().FindChild(aFaceSelID));
+ isSelectionMode = true;
+ break;
+ }
+ }
+ }
+ }
+
+ // external full result is not identified by index == 0, so, add here the ID
+ if (!theSubShape.get()) {
+ TDataStd_UAttribute::Set(aLab, kFULL_RESULT_ID);
+ // empty NS
+ TNaming_Builder aBuilder(aLab);
+ // store all sub-faces naming since faces may be used for extrusion, where all edges are needed
+ Handle(TDataStd_IntPackedMap) anIndices = TDataStd_IntPackedMap::Set(aLab);
+ std::list<int> aFacesIndexes;
+ for(int a = 0; a < facesNum(); a++) {
+ anIndices->Add(select(face(a), theExtDoc, -1));
+ }
+ return anIndex - 1;
+ }
+
+ { // this to have erased Builder after the shape was generated (NS on this label may be changed)
+ TNaming_Builder aBuilder(aLab);
+ if (aSubShape.IsNull()) {
+ return anIndex - 1; // just keep empty named shape
+ }
+ // wire never happens as sub, it must be generated to be found
+ // by SelectionNaming TNaming_Tool::NamedShape
+ if (isSelectionMode && aSubShape.ShapeType() != TopAbs_WIRE) {
+ aBuilder.Select(aSubShape, aSubShape);
+ } else {
+ aBuilder.Generated(aSubShape);
+ }
+ }