Salome HOME
Merge branch 'master' of newgeom:newgeom
[modules/shaper.git] / src / Model / Model_AttributeSelection.cpp
index dd360d258474f4baf9e732802c6eff3e5940511b..c284b49eb48291e09625458a7ecaa732e20bb1d0 100644 (file)
@@ -104,8 +104,9 @@ bool Model_AttributeSelection::update()
     // body: just a named shape, use selection mechanism from OCCT
     TNaming_Selector aSelector(selectionLabel());
     TDF_LabelMap aScope; // empty means the whole document
+    bool aResult = aSelector.Solve(aScope) == Standard_True;
     owner()->data()->sendAttributeUpdated(this);
-    return aSelector.Solve(aScope) == Standard_True;
+    return aResult;
   } else if (aContext->groupName() == ModelAPI_ResultConstruction::group()) {
     // construction: identification by the results indexes, recompute faces and
     // take the face that more close by the indexes
@@ -364,7 +365,18 @@ void Model_AttributeSelection::selectConstruction(
             Standard_Real aFirst, aLast;
             Handle(Geom_Curve) aCurve = BRep_Tool::Curve(anEdge, aFirst, aLast);
             if (allCurves.Contains(aCurve)) {
-              aRefs->Add(aComposite->subFeatureId(a));
+              int anID = aComposite->subFeatureId(a);
+              aRefs->Add(anID);
+              // add edges to sub-label to support naming for edges selection
+              for(TopExp_Explorer anEdgeExp(aSubShape, TopAbs_EDGE); anEdgeExp.More(); anEdgeExp.Next()) {
+                TopoDS_Edge anEdge = TopoDS::Edge(anEdgeExp.Current());
+                Standard_Real aFirst, aLast;
+                Handle(Geom_Curve) aFaceCurve = BRep_Tool::Curve(anEdge, aFirst, aLast);
+                if (aFaceCurve == aCurve) {
+                  TNaming_Builder anEdgeBuilder(selectionLabel().FindChild(anID));
+                  anEdgeBuilder.Generated(anEdge);
+                }
+              }
             }
           }
         }