fillAttribute(theY, myy);
fillAttribute(theZ, myz);
- execute();
+ execute(false);
}
/*//==================================================================================================
fillAttribute(theMainObjects, mymainObjects);
fillAttribute(theToolObjects, mytoolObjects);
- execute();
+ execute(false);
}
}
return feature()->getKind();
}
-void ModelHighAPI_Interface::execute()
+void ModelHighAPI_Interface::execute(bool isForce)
{
- //SessionPtr aMgr = ModelAPI_Session::get();
- //ModelAPI_ValidatorsFactory* aFactory = aMgr->validators();
- //FeaturePtr aFeature = feature();
- //if(aFactory->validate(aFeature)) {
- // aFeature->execute();
- //}
+ if (isForce) {
+ SessionPtr aMgr = ModelAPI_Session::get();
+ ModelAPI_ValidatorsFactory* aFactory = aMgr->validators();
+ FeaturePtr aFeature = feature();
+ if(aFactory->validate(aFeature))
+ aFeature->execute();
+ }
Events_Loop* aLoop = Events_Loop::loop();
aLoop->flush(Events_Loop::eventByName(EVENT_OBJECT_CREATED));
const std::string& getKind() const;
/// Shortcut for feature()->execute()
+ /// \param isForce start execution of feature instead of sending events
MODELHIGHAPI_EXPORT
- void execute();
+ void execute(bool isForce = false);
/// Shortcut for feature()->data()->setName()
MODELHIGHAPI_EXPORT
const std::shared_ptr<ModelHighAPI_Interface> & theValue)
: myObject(std::shared_ptr<ModelAPI_Object>(theValue->defaultResult()))
{
+ // the result is not constructed yet, forcibly do it
+ if (!myObject) {
+ theValue->execute(true);
+ myObject = std::shared_ptr<ModelAPI_Object>(theValue->defaultResult());
+ }
}
ModelHighAPI_Reference::~ModelHighAPI_Reference()
}
myGroups.push_back(aNewGroup);
}
- return aResult;
+ return aResult || isUpdated;
}
// ============================================================================