From 825fcb61f5890cd8176c0022765cc34ed683270a Mon Sep 17 00:00:00 2001 From: azv Date: Fri, 10 Jun 2016 07:10:28 +0300 Subject: [PATCH] Send CREATED event when building tangent arc (issue #1291) --- src/SketchPlugin/SketchPlugin_Arc.cpp | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/SketchPlugin/SketchPlugin_Arc.cpp b/src/SketchPlugin/SketchPlugin_Arc.cpp index aa6e7fb4f..90cb7e541 100644 --- a/src/SketchPlugin/SketchPlugin_Arc.cpp +++ b/src/SketchPlugin/SketchPlugin_Arc.cpp @@ -766,10 +766,10 @@ void SketchPlugin_Arc::tangencyArcConstraints() Events_Loop::loop()->flush(aDeleteEvent); // Wait all constraints being created, then send update events - static Events_ID anUpdateEvent = Events_Loop::eventByName(EVENT_OBJECT_UPDATED); - bool isUpdateFlushed = Events_Loop::loop()->isFlushed(anUpdateEvent); - if (isUpdateFlushed) - Events_Loop::loop()->setFlushed(anUpdateEvent, false); + static Events_ID aCreateEvent = Events_Loop::eventByName(EVENT_OBJECT_CREATED); + bool isCreateFlushed = Events_Loop::loop()->isFlushed(aCreateEvent); + if (isCreateFlushed) + Events_Loop::loop()->setFlushed(aCreateEvent, false); // Create new constraints FeaturePtr aConstraint = sketch()->addFeature(SketchPlugin_ConstraintCoincidence::ID()); @@ -780,7 +780,7 @@ void SketchPlugin_Arc::tangencyArcConstraints() aRefAttrA->setAttr(aStartAttr); aRefAttrB->setAttr(aTangPtAttr->attr()); aConstraint->execute(); - ModelAPI_EventCreator::get()->sendUpdated(aConstraint, anUpdateEvent); + ModelAPI_EventCreator::get()->sendUpdated(aConstraint, aCreateEvent); aConstraint = sketch()->addFeature(SketchPlugin_ConstraintTangent::ID()); aRefAttrA = std::dynamic_pointer_cast( @@ -790,11 +790,13 @@ void SketchPlugin_Arc::tangencyArcConstraints() aRefAttrA->setObject(aThisArc); aRefAttrB->setObject(aTangFeature); aConstraint->execute(); - ModelAPI_EventCreator::get()->sendUpdated(aConstraint, anUpdateEvent); + ModelAPI_EventCreator::get()->sendUpdated(aConstraint, aCreateEvent); // Send events to update the sub-features by the solver. - if(isUpdateFlushed) - Events_Loop::loop()->setFlushed(anUpdateEvent, true); + if(isCreateFlushed) + Events_Loop::loop()->setFlushed(aCreateEvent, true); + else + Events_Loop::loop()->flush(aCreateEvent); } } -- 2.39.2