Salome HOME
Bos #24043: EDF 23094 - problem with dump.
authorjfa <jfa@opencascade.com>
Wed, 7 Apr 2021 08:40:50 +0000 (11:40 +0300)
committerjfa <jfa@opencascade.com>
Wed, 7 Apr 2021 08:40:50 +0000 (11:40 +0300)
src/ModuleBase/ModuleBase_WidgetSelectionFilter.cpp

index 024e2d01936b317e4bbd90eaf4b979d3b9a57b85..8e44be6a9b15eead26a011f29718a7f70693bcf1 100644 (file)
@@ -476,7 +476,19 @@ void ModuleBase_WidgetSelectionFilter::onSelect()
       bool isValid = aSession->filters()->isValid(myFeature, aBody, aSubShape);
       if (isValid) {
         aBuilder.Add(aComp, aTShape);
-        ModuleBase_ViewerPrsPtr aValue(new ModuleBase_ViewerPrs(aObj, aSubShape));
+        // bos #24043: Naming on a compsolid works wrong.
+        // Find a simple sub-result for the ViewerPrs context:
+        ObjectPtr aSubResultObj = aObj;
+        for (int aSubIndex = 0; aSubIndex < aBody->numberOfSubs(); aSubIndex++) {
+          ResultBodyPtr aSubResult = aBody->subResult(aSubIndex);
+          GeomShapePtr aSubResultShape = aSubResult->shape();
+          if (aSubResultShape->isSubShape(aSubShape)) {
+            aSubResultObj = aSubResult;
+            break;
+          }
+        }
+        ModuleBase_ViewerPrsPtr aValue(new ModuleBase_ViewerPrs(aSubResultObj, aSubShape));
+        //ModuleBase_ViewerPrsPtr aValue(new ModuleBase_ViewerPrs(aObj, aSubShape));
         myValues.append(aValue);
       }
     }