]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Dump Python in the High Level Parameterized Geometry API (issue #1648)
authorazv <azv@opencascade.com>
Fri, 19 Aug 2016 04:22:50 +0000 (07:22 +0300)
committerazv <azv@opencascade.com>
Fri, 19 Aug 2016 04:23:14 +0000 (07:23 +0300)
Shortcut for setting name of feature by ModelHighAPI_Interface

src/ModelHighAPI/ModelHighAPI_Dumper.cpp
src/ModelHighAPI/ModelHighAPI_Interface.cpp
src/ModelHighAPI/ModelHighAPI_Interface.h

index 11bc372cc46f39aeea1750ccd69c830e4bb17773..ce25271d85eab21fe896e6cc51699f7b5eb6f15b 100644 (file)
@@ -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<ModelAPI_Feature>(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();
index 39b076ffbe7df707a4a35f24cf15cb3aeadfce9c..aadac128acfcce1e46e149809a5a7188e7ab7c49 100644 (file)
@@ -47,6 +47,11 @@ void ModelHighAPI_Interface::execute()
   }
 }
 
+void ModelHighAPI_Interface::setName(const std::string& theName)
+{
+  feature()->data()->setName(theName);
+}
+
 std::list<ModelHighAPI_Selection> ModelHighAPI_Interface::result() const
 {
   // TODO(spo): should I use more common function for the whole model to prepare results?
index 009b7e89b08333ebb053d40f650f6c9cc6413f86..4dd2bca21a0d140e2ddd1e931c1391800986038a 100644 (file)
@@ -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