+ CompositeFeaturePtr aCompositeFeature =
+ std::dynamic_pointer_cast<ModelAPI_CompositeFeature>(myFeature);
+ if(!aCompositeFeature.get()) {
+ return InterfacePtr();
+ }
+
+ FeaturePtr aSubFeature = aCompositeFeature->subFeature(theIndex);
+ if(!aSubFeature.get()) {
+ return InterfacePtr();
+ }
+
+ return InterfacePtr(new ModelHighAPI_Interface(aSubFeature));
+}
+
+const std::string& ModelHighAPI_Interface::getKind() const
+{
+ return feature()->getKind();
+}
+
+void ModelHighAPI_Interface::execute(bool isForce)
+{
+ 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));
+ aLoop->flush(Events_Loop::eventByName(EVENT_OBJECT_UPDATED));
+ aLoop->flush(Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY));
+ //aLoop->flush(Events_Loop::eventByName(EVENT_OBJECT_DELETED));
+}
+
+void ModelHighAPI_Interface::setName(const std::wstring& theName)
+{
+ if (feature().get() && feature()->data()->isValid())
+ feature()->data()->setName(theName);
+ else {
+ std::cout<<"Error: set name "<<theName.c_str()<<" for an invalid feature"<<std::endl;
+ }
+}
+
+std::wstring ModelHighAPI_Interface::name() const
+{
+ return feature()->data()->name();
+}
+
+ModelHighAPI_Selection ModelHighAPI_Interface::result() const
+{
+ std::list<ModelHighAPI_Selection> aResults = results();
+ if (aResults.empty())
+ return ModelHighAPI_Selection(std::shared_ptr<ModelAPI_Result>());
+ return aResults.front();
+}
+
+std::list<ModelHighAPI_Selection> ModelHighAPI_Interface::results() const
+{
+ const_cast<ModelHighAPI_Interface*>(this)->execute();
+
+ std::list<ModelHighAPI_Selection> aSelectionList;
+
+ if (feature().get()) {
+ std::list<std::shared_ptr<ModelAPI_Result> > aResults = feature()->results();
+ for (auto it = aResults.begin(), end = aResults.end(); it != end; ++it) {
+ if (!(*it)->isDisabled())
+ aSelectionList.push_back(ModelHighAPI_Selection(*it));
+ }
+ }
+
+ return aSelectionList;
+}
+
+std::shared_ptr<ModelAPI_Result> ModelHighAPI_Interface::defaultResult() const
+{
+ const_cast<ModelHighAPI_Interface*>(this)->execute();
+
+ return feature()->lastResult();