]> SALOME platform Git repositories - modules/shaper.git/blobdiff - src/PartSet/PartSet_WidgetMultiSelector.cpp
Salome HOME
Issue #672 - Crash when distance constraint
[modules/shaper.git] / src / PartSet / PartSet_WidgetMultiSelector.cpp
index d6c0008974f044bc263b532811cd073b0dd897fc..60b2573e7433877b2e77f83ab66a027b0757dbed 100644 (file)
@@ -99,11 +99,19 @@ void PartSet_WidgetMultiSelector::getGeomSelection(const ModuleBase_ViewerPrs& t
   std::shared_ptr<SketchPlugin_Feature> aSPFeature = 
           std::dynamic_pointer_cast<SketchPlugin_Feature>(aSelectedFeature);
   // there is no a sketch feature is selected, but the shape exists, try to create an exernal object
-  if (aSPFeature.get() == NULL && theShape.get() != NULL && !theShape->isNull() &&
-      myExternalObjectMgr->useExternal()) {
-    if (myIsInVaildate)
-      theObject = myExternalObjectMgr->externalObjectValidated(theObject, theShape, sketch());
-    else
-      theObject = myExternalObjectMgr->externalObject(theObject, theShape, sketch());
+  // TODO: unite with the same functionality in PartSet_WidgetShapeSelector
+  if (aSPFeature.get() == NULL && myExternalObjectMgr->useExternal()) {
+    GeomShapePtr aShape = theShape;
+    if (!aShape.get()) {
+      ResultPtr aResult = myWorkshop->selection()->getResult(thePrs);
+      if (aResult.get())
+        aShape = aResult->shape();
+    }
+    if (aShape.get() != NULL && !aShape->isNull()) {
+      if (myIsInVaildate)
+        theObject = myExternalObjectMgr->externalObjectValidated(theObject, theShape, sketch());
+      else
+        theObject = myExternalObjectMgr->externalObject(theObject, theShape, sketch());
+    }
   }
 }