Salome HOME
#1624 Translation/Rotation/Mirror geometrical constraint are always visible
[modules/shaper.git] / src / PartSet / PartSet_WidgetShapeSelector.cpp
index c291eb0ff7d6598923284f50fc0e19bd79921b1e..a502fcdfa0cda24aa8c07f54eb5e3d53c7ef80bc 100755 (executable)
@@ -13,6 +13,8 @@
 #include <ModelAPI_Validator.h>
 
 #include <ModuleBase_Definitions.h>
+#include <ModuleBase_ViewerPrs.h>
+
 #include <Config_WidgetAPI.h>
 
 #include <PartSet_ExternalObjectsMgr.h>
@@ -76,15 +78,18 @@ void PartSet_WidgetShapeSelector::getGeomSelection(const ModuleBase_ViewerPrsPtr
           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
   // 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 (aSPFeature.get() == NULL) {
+    theObject = ObjectPtr();
+    if (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())
+        theObject = myExternalObjectMgr->externalObject(theObject, aShape, sketch(), myIsInValidate);
     }
-    if (aShape.get() != NULL && !aShape->isNull())
-      theObject = myExternalObjectMgr->externalObject(theObject, aShape, sketch(), myIsInValidate);
   }
 }