From: Nicolas RECHATIN Date: Mon, 9 Oct 2023 14:29:18 +0000 (+0200) Subject: feat : Added getVolumeList & getVolumeFeatureList X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=0506dc30e19f7abac9f6a7ada28cc7630b9010b7;p=modules%2Fshaper.git feat : Added getVolumeList & getVolumeFeatureList --- 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_