]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
feat : Added getVolumeList & getVolumeFeatureList
authorNicolas RECHATIN <nicolas.rechatin@cea.fr>
Mon, 9 Oct 2023 14:29:18 +0000 (16:29 +0200)
committerNicolas RECHATIN <nicolas.rechatin@cea.fr>
Mon, 9 Oct 2023 14:29:18 +0000 (16:29 +0200)
src/OperaAPI/OperaAPI_Tools.cpp
src/OperaAPI/OperaAPI_Tools.h

index 2cec12913bee6291b8943a890f8f6817f7fdb2be..3ead88e32cdf9c8a85697ac4475693b5ddb4b849 100644 (file)
@@ -33,3 +33,35 @@ static std::list<std::string> OperaAPI_Tools::getMediumList()
 
        return aMediumList;
 }
+
+//=================================================================================================
+static std::list<ResultPtr> OperaAPI_Tools::getVolumeList()
+{
+       SessionPtr aSession = ModelAPI_Session::get();
+       DocumentPtr aDocument = aSession->activeDocument();
+       std::list<FeaturePtr> aFeatures = aDocument->allFeatures();
+
+       std::list<ResultPtr> aVolumeList;
+       std::list<FeaturePtr>::iterator itFeature = aFeatures.begin();
+       for (; itFeature != aFeatures.end(); ++itFeature)
+               if ((*itFeature)->getKind() == "Volume")
+                       aVolumeList.push_back((*itFeature)->firstResult());
+
+       return aVolumeList;
+}
+
+//=================================================================================================
+static std::list<FeaturePtr> OperaAPI_Tools::getVolumeFeatureList()
+{
+       SessionPtr aSession = ModelAPI_Session::get();
+       DocumentPtr aDocument = aSession->activeDocument();
+       std::list<FeaturePtr> aFeatures = aDocument->allFeatures();
+
+       std::list<FeaturePtr> aVolumeFeatureList;
+       std::list<FeaturePtr>::iterator itFeature = aFeatures.begin();
+       for (; itFeature != aFeatures.end(); ++itFeature)
+               if ((*itFeature)->getKind() == "Volume")
+                       aVolumeFeatureList.push_back(*itFeature);
+
+       return aVolumeFeatureList;
+}
index a221a3e53e34fef007da874f0d8f83dc9c496e50..69d66bfd6ec0e2506d394f5e7d8425ac8dca4b2e 100644 (file)
@@ -40,6 +40,14 @@ public:
        /// Get medium list
        OPERAAPI_EXPORT
        static std::list<std::string> getMediumList();
+
+       /// Get volume list
+       OPERAAPI_EXPORT
+       static std::list<ResultPtr> getVolumeList();
+
+       /// Get volume list
+       OPERAAPI_EXPORT
+       static std::list<FeaturePtr> getVolumeFeatureList();
 };
 
 #endif // OPERAAPI_TOOLS_H_