From 0506dc30e19f7abac9f6a7ada28cc7630b9010b7 Mon Sep 17 00:00:00 2001 From: Nicolas RECHATIN Date: Mon, 9 Oct 2023 16:29:18 +0200 Subject: [PATCH] feat : Added getVolumeList & getVolumeFeatureList --- src/OperaAPI/OperaAPI_Tools.cpp | 32 ++++++++++++++++++++++++++++++++ src/OperaAPI/OperaAPI_Tools.h | 8 ++++++++ 2 files changed, 40 insertions(+) diff --git a/src/OperaAPI/OperaAPI_Tools.cpp b/src/OperaAPI/OperaAPI_Tools.cpp index 2cec12913..3ead88e32 100644 --- a/src/OperaAPI/OperaAPI_Tools.cpp +++ b/src/OperaAPI/OperaAPI_Tools.cpp @@ -33,3 +33,35 @@ static std::list OperaAPI_Tools::getMediumList() return aMediumList; } + +//================================================================================================= +static std::list OperaAPI_Tools::getVolumeList() +{ + SessionPtr aSession = ModelAPI_Session::get(); + DocumentPtr aDocument = aSession->activeDocument(); + std::list aFeatures = aDocument->allFeatures(); + + std::list aVolumeList; + std::list::iterator itFeature = aFeatures.begin(); + for (; itFeature != aFeatures.end(); ++itFeature) + if ((*itFeature)->getKind() == "Volume") + aVolumeList.push_back((*itFeature)->firstResult()); + + return aVolumeList; +} + +//================================================================================================= +static std::list OperaAPI_Tools::getVolumeFeatureList() +{ + SessionPtr aSession = ModelAPI_Session::get(); + DocumentPtr aDocument = aSession->activeDocument(); + std::list aFeatures = aDocument->allFeatures(); + + std::list aVolumeFeatureList; + std::list::iterator itFeature = aFeatures.begin(); + for (; itFeature != aFeatures.end(); ++itFeature) + if ((*itFeature)->getKind() == "Volume") + aVolumeFeatureList.push_back(*itFeature); + + return aVolumeFeatureList; +} diff --git a/src/OperaAPI/OperaAPI_Tools.h b/src/OperaAPI/OperaAPI_Tools.h index a221a3e53..69d66bfd6 100644 --- a/src/OperaAPI/OperaAPI_Tools.h +++ b/src/OperaAPI/OperaAPI_Tools.h @@ -40,6 +40,14 @@ public: /// Get medium list OPERAAPI_EXPORT static std::list getMediumList(); + + /// Get volume list + OPERAAPI_EXPORT + static std::list getVolumeList(); + + /// Get volume list + OPERAAPI_EXPORT + static std::list getVolumeFeatureList(); }; #endif // OPERAAPI_TOOLS_H_ -- 2.39.2