if (aReason != theFeature && (aReason)->data()->isValid()) {
if (processFeature(aReason))
aIsModified = true;
- if (aReason->data()->execState() == ModelAPI_StateInvalidArgument)
+ // check validity of aReason once again because it may be removed by dependent feature
+ // (e.g. by SketchPlugin_IntersectionPoint)
+ if (!aReason->data()->isValid() ||
+ aReason->data()->execState() == ModelAPI_StateInvalidArgument)
isReferencedInvalid = true;
}
// searching for the next not used reason
static Events_ID anID = Events_Loop::eventByName("SketchPrepared");
std::shared_ptr<Events_Message> aMsg(new Events_Message(anID, this));
Events_Loop* aLoop = Events_Loop::loop();
+ // in case it is finish operation, flush for the sketch other events (#2450)
+ aLoop->flush(aLoop->eventByName(EVENT_OBJECT_UPDATED));
aLoop->send(aMsg);
// check that sub-elements of sketch are updated => sketch must be re-processed
std::set<FeaturePtr> aWholeR;
if (aSelAttr) {
ObjectPtr aContext = aSelAttr->context();
// update argument only if the referenced object is ready to use
- if (aContext.get() && !aContext->isDisabled()) {
+ if (aContext.get() && !aContext->isDisabled() && !aSelAttr->isInvalid()) {
if (isReason(theFeature, aContext)) {
if (!aSelAttr->update()) {
bool isObligatory = !aFactory->isNotObligatory(
aState = ModelAPI_StateInvalidArgument;
}
}
- } else if (aContext.get()) {
+ } else if (aContext.get() || aSelAttr->isInvalid()) {
// here it may be not obligatory, but if the reference is wrong, it should not be correct
bool isObligatory = aFactory->isCase(theFeature, theFeature->data()->id(aSel));
if (isObligatory)