From: azv Date: Fri, 19 Aug 2016 04:22:50 +0000 (+0300) Subject: Dump Python in the High Level Parameterized Geometry API (issue #1648) X-Git-Tag: V_2.5.0~137^2~20 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=307719ccd8caf86108a00bc73b53dd896b92a50b;p=modules%2Fshaper.git Dump Python in the High Level Parameterized Geometry API (issue #1648) Shortcut for setting name of feature by ModelHighAPI_Interface --- diff --git a/src/ModelHighAPI/ModelHighAPI_Dumper.cpp b/src/ModelHighAPI/ModelHighAPI_Dumper.cpp index 11bc372cc..ce25271d8 100644 --- a/src/ModelHighAPI/ModelHighAPI_Dumper.cpp +++ b/src/ModelHighAPI/ModelHighAPI_Dumper.cpp @@ -285,11 +285,7 @@ void ModelHighAPI_Dumper::dumpEntitySetName() #ifdef DUMP_USER_DEFINED_NAMES const std::string& aName = name(myLastEntityWithName); - myDumpBuffer << aName; - FeaturePtr aFeature = std::dynamic_pointer_cast(myLastEntityWithName); - if (aFeature) - myDumpBuffer << ".feature()"; - myDumpBuffer << ".data().setName(\"" << aName << "\")" << std::endl; + myDumpBuffer << aName << ".setName(\"" << aName << "\")" << std::endl; #endif myNames[myLastEntityWithName].second = false; // don't dump "setName" for the entity twice myLastEntityWithName = EntityPtr(); diff --git a/src/ModelHighAPI/ModelHighAPI_Interface.cpp b/src/ModelHighAPI/ModelHighAPI_Interface.cpp index 39b076ffb..aadac128a 100644 --- a/src/ModelHighAPI/ModelHighAPI_Interface.cpp +++ b/src/ModelHighAPI/ModelHighAPI_Interface.cpp @@ -47,6 +47,11 @@ void ModelHighAPI_Interface::execute() } } +void ModelHighAPI_Interface::setName(const std::string& theName) +{ + feature()->data()->setName(theName); +} + std::list ModelHighAPI_Interface::result() const { // TODO(spo): should I use more common function for the whole model to prepare results? diff --git a/src/ModelHighAPI/ModelHighAPI_Interface.h b/src/ModelHighAPI/ModelHighAPI_Interface.h index 009b7e89b..4dd2bca21 100644 --- a/src/ModelHighAPI/ModelHighAPI_Interface.h +++ b/src/ModelHighAPI/ModelHighAPI_Interface.h @@ -47,6 +47,10 @@ public: MODELHIGHAPI_EXPORT void execute(); + /// Shortcut for feature()->data()->setName() + MODELHIGHAPI_EXPORT + void setName(const std::string& theName); + // TODO(spo): rename to selectAll() /// Return all objects of the feature MODELHIGHAPI_EXPORT