return TDF_Label(); // not found
return aFind->second;
}
+
+ResultPtr Model_Document::findByName(const std::string theName)
+{
+ NCollection_DataMap<TDF_Label, FeaturePtr>::Iterator anObjIter(myObjs);
+ for(; anObjIter.More(); anObjIter.Next()) {
+ FeaturePtr& aFeature = anObjIter.ChangeValue();
+ if (!aFeature) // may be on close
+ continue;
+ const std::list<std::shared_ptr<ModelAPI_Result> >& aResults = aFeature->results();
+ std::list<std::shared_ptr<ModelAPI_Result> >::const_iterator aRIter = aResults.begin();
+ for (; aRIter != aResults.cend(); aRIter++) {
+ if (aRIter->get() && (*aRIter)->data() && (*aRIter)->data()->isValid() &&
+ (*aRIter)->data()->name() == theName) {
+ return *aRIter;
+ }
+ }
+ }
+ // not found
+ return ResultPtr();
+}
void addNamingName(const TDF_Label theLabel, std::string theName);
//! Returns the label, keeper of the name for the topological naming needs
TDF_Label findNamingName(std::string theName);
+ //! Returns the result by name of the result (names of results must be unique, used for naming
+ //! selection by name.
+ ResultPtr findByName(const std::string theName);
protected: