Salome HOME
Issue #1648: Dump Python in the High Level Parameterized Geometry API
authordbv <dbv@opencascade.com>
Tue, 16 Aug 2016 07:50:07 +0000 (10:50 +0300)
committerdbv <dbv@opencascade.com>
Tue, 16 Aug 2016 07:54:53 +0000 (10:54 +0300)
Dump for FeaturesAPI_Rotation

src/FeaturesAPI/FeaturesAPI_Rotation.cpp
src/FeaturesAPI/FeaturesAPI_Rotation.h

index 861f3da0006cb8be4b1f650ff9ffc374cd94de03..d24aa08900bdbda186b0807af194860cc38ac604 100644 (file)
@@ -6,6 +6,7 @@
 
 #include "FeaturesAPI_Rotation.h"
 
+#include <ModelHighAPI_Dumper.h>
 #include <ModelHighAPI_Tools.h>
 
 //==================================================================================================
@@ -59,12 +60,26 @@ void FeaturesAPI_Rotation::setAngle(const ModelHighAPI_Double& theAngle)
   execute();
 }
 
+//==================================================================================================
+void FeaturesAPI_Rotation::dump(ModelHighAPI_Dumper& theDumper) const
+{
+  FeaturePtr aBase = feature();
+  const std::string& aDocName = theDumper.name(aBase->document());
+
+  AttributeSelectionListPtr anAttrObjects = aBase->selectionList(FeaturesPlugin_Rotation::OBJECTS_LIST_ID());
+  AttributeSelectionPtr anAttrAxis = aBase->selection(FeaturesPlugin_Rotation::AXIS_OBJECT_ID());
+  AttributeDoublePtr anAttrAngle = aBase->real(FeaturesPlugin_Rotation::ANGLE_ID());
+
+  theDumper << aBase << " = model.addRotation(" << aDocName << ", "
+            << anAttrObjects << ", " << anAttrAxis << ", " << anAttrAngle << ")" << std::endl;
+}
+
 //==================================================================================================
 RotationPtr addRotation(const std::shared_ptr<ModelAPI_Document>& thePart,
                         const std::list<ModelHighAPI_Selection>& theMainObjects,
                         const ModelHighAPI_Selection& theAxisObject,
-                        const ModelHighAPI_Double& theDistance)
+                        const ModelHighAPI_Double& theAngle)
 {
   std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(FeaturesAPI_Rotation::ID());
-  return RotationPtr(new FeaturesAPI_Rotation(aFeature, theMainObjects, theAxisObject, theDistance));
+  return RotationPtr(new FeaturesAPI_Rotation(aFeature, theMainObjects, theAxisObject, theAngle));
 }
index c8e74ace884c6ae0a75825d6816bdf1e34133a1b..03fd636ad780685298603699e60404eeae564405 100644 (file)
@@ -15,6 +15,7 @@
 #include <ModelHighAPI_Macro.h>
 
 class ModelHighAPI_Double;
+class ModelHighAPI_Dumper;
 class ModelHighAPI_Selection;
 
 /// \class FeaturesAPI_Rotation
@@ -54,6 +55,10 @@ public:
   /// Set angle.
   FEATURESAPI_EXPORT
   void setAngle(const ModelHighAPI_Double& theAngle);
+
+  /// Dump wrapped feature
+  FEATURESAPI_EXPORT
+  virtual void dump(ModelHighAPI_Dumper& theDumper) const;
 };
 
 /// Pointer on Rotation object.
@@ -65,6 +70,6 @@ FEATURESAPI_EXPORT
 RotationPtr addRotation(const std::shared_ptr<ModelAPI_Document>& thePart,
                         const std::list<ModelHighAPI_Selection>& theMainObjects,
                         const ModelHighAPI_Selection& theAxisObject,
-                        const ModelHighAPI_Double& theDistance);
+                        const ModelHighAPI_Double& theAngle);
 
 #endif // FeaturesAPI_Rotation_H_