]> SALOME platform Git repositories - modules/shaper.git/blobdiff - src/PartSet/PartSet_Tools.cpp
Salome HOME
Issue #805 In the sketch presentation, show both the parameter and its value: providi...
[modules/shaper.git] / src / PartSet / PartSet_Tools.cpp
index 8ee41ea47b8fc070c7f6f46c4b04d8a5dace060e..27921bf5e60b2a5dcac162d4259caacdf234a315 100755 (executable)
@@ -14,6 +14,9 @@
 #include <ModelAPI_Document.h>
 #include <ModelAPI_Session.h>
 #include <ModelAPI_ResultConstruction.h>
+#include <ModelAPI_Events.h>
+
+#include <Events_Loop.h>
 
 #include <SketcherPrs_Tools.h>
 
@@ -255,8 +258,8 @@ void PartSet_Tools::createConstraint(CompositeFeaturePtr theSketch,
       ModelAPI_AttributeRefAttr>(aData->attribute(SketchPlugin_Constraint::ENTITY_B()));
   aRef2->setAttr(thePoint2);
 
-  if (aFeature)  // TODO: generate an error if feature was not created
-    aFeature->execute();
+  // we need to flush created signal in order to coincidence is processed by solver
+  Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_OBJECT_CREATED));
 }
 
 /*std::shared_ptr<GeomDataAPI_Point2D> PartSet_Tools::
@@ -887,3 +890,18 @@ AttributePtr PartSet_Tools::findAttributeBy2dPoint(ObjectPtr theObj,
   }
   return anAttribute;
 }
+
+void PartSet_Tools::sendSubFeaturesEvent(const CompositeFeaturePtr& theComposite,
+                                         const Events_ID theEventId)
+{
+  if (!theComposite.get())
+    return;
+
+  static Events_Loop* aLoop = Events_Loop::loop();
+  for (int i = 0; i < theComposite->numberOfSubs(); i++) {
+    FeaturePtr aSubFeature = theComposite->subFeature(i);
+    static const ModelAPI_EventCreator* aECreator = ModelAPI_EventCreator::get();
+    aECreator->sendUpdated(aSubFeature, theEventId);
+  }
+  Events_Loop::loop()->flush(theEventId);
+}