Salome HOME
Fix for the issue #2753 : error when dump/load script
[modules/shaper.git] / src / PartSet / PartSet_ExternalPointsMgr.cpp
index 0f9babdae75ef5377962558fc8b69dc8076b16a0..52e0a9d3fdc56065a30c7e4f14a57c3e3476f191 100644 (file)
@@ -27,6 +27,8 @@
 #include "PartSet_Tools.h"
 
 #include <ModelAPI_Tools.h>
+#include <ModelAPI_ResultField.h>
+#include <ModelAPI_ResultGroup.h>
 
 #include <ModuleBase_IWorkshop.h>
 #include <ModuleBase_ViewerPrs.h>
@@ -40,6 +42,7 @@
 #include <XGUI_Tools.h>
 #include <XGUI_Displayer.h>
 #include <XGUI_Workshop.h>
+#include <XGUI_SelectionActivate.h>
 #include <XGUI_SelectionMgr.h>
 
 PartSet_ExternalPointsMgr::PartSet_ExternalPointsMgr(ModuleBase_IWorkshop* theWorkshop,
@@ -96,6 +99,13 @@ QList<std::shared_ptr<ModuleBase_ViewerPrs>> PartSet_ExternalPointsMgr::findCirc
       continue;
 
     ResultPtr aResObj = std::dynamic_pointer_cast<ModelAPI_Result>(aObj);
+
+    // Do not use Fields and groups in selection in sketcher
+    if (!aResObj.get() ||
+      (aResObj->groupName() == ModelAPI_ResultField::group()) ||
+      (aResObj->groupName() == ModelAPI_ResultGroup::group()))
+      continue;
+
     if (aResObj.get()) {
       GeomShapePtr aShape = aResObj->shape();
       if (aShape.get()) {
@@ -179,7 +189,8 @@ void PartSet_ExternalPointsMgr::updateCenterPresentations()
       myPresentations[aPrs->object()] = aList;
     foreach(AISObjectPtr anAIS, aList) {
       aDisplayer->displayAIS(anAIS, false);
-      aDisplayer->activateAIS(anAIS->impl<Handle(AIS_InteractiveObject)>(), TopAbs_VERTEX, false);
+      aWorkshop->selectionActivate()->activateAIS(anAIS->impl<Handle(AIS_InteractiveObject)>(),
+        TopAbs_VERTEX, false);
     }
   }
 }