From 307719ccd8caf86108a00bc73b53dd896b92a50b Mon Sep 17 00:00:00 2001 From: azv Date: Fri, 19 Aug 2016 07:22:50 +0300 Subject: [PATCH] Dump Python in the High Level Parameterized Geometry API (issue #1648) Shortcut for setting name of feature by ModelHighAPI_Interface --- src/ModelHighAPI/ModelHighAPI_Dumper.cpp | 6 +----- src/ModelHighAPI/ModelHighAPI_Interface.cpp | 5 +++++ src/ModelHighAPI/ModelHighAPI_Interface.h | 4 ++++ 3 files changed, 10 insertions(+), 5 deletions(-) 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 -- 2.39.2