]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Issue #1648: Dump Python in the High Level Parameterized Geometry API
authordbv <dbv@opencascade.com>
Fri, 12 Aug 2016 12:54:21 +0000 (15:54 +0300)
committerdbv <dbv@opencascade.com>
Mon, 15 Aug 2016 11:03:14 +0000 (14:03 +0300)
Dump for FeaturesAPI_Placement

src/FeaturesAPI/FeaturesAPI_Placement.cpp
src/FeaturesAPI/FeaturesAPI_Placement.h

index f45264e14dc22ecf832f6dad7a6bc8bec9297926..5d3aff8b494772236e606a977c33f50076148300 100644 (file)
@@ -6,6 +6,7 @@
 
 #include "FeaturesAPI_Placement.h"
 
+#include <ModelHighAPI_Dumper.h>
 #include <ModelHighAPI_Tools.h>
 
 //==================================================================================================
@@ -79,6 +80,23 @@ void FeaturesAPI_Placement::setCentering(const bool theCentering)
   execute();
 }
 
+//==================================================================================================
+void FeaturesAPI_Placement::dump(ModelHighAPI_Dumper& theDumper) const
+{
+  FeaturePtr aBase = feature();
+  const std::string& aDocName = theDumper.name(aBase->document());
+
+  AttributeSelectionListPtr anAttrObjects = aBase->selectionList(FeaturesPlugin_Placement::OBJECTS_LIST_ID());
+  AttributeSelectionPtr anAttrStartShape = aBase->selection(FeaturesPlugin_Placement::START_SHAPE_ID());
+  AttributeSelectionPtr anAttrEndShape = aBase->selection(FeaturesPlugin_Placement::END_SHAPE_ID());
+  AttributeBooleanPtr anAttrReverse = aBase->boolean(FeaturesPlugin_Placement::REVERSE_ID());
+  AttributeBooleanPtr anAttrCentering = aBase->boolean(FeaturesPlugin_Placement::CENTERING_ID());
+
+  theDumper << aBase << " = model.addPlacement(" << aDocName << ", "
+            << anAttrObjects << ", " << anAttrStartShape << ", " << anAttrEndShape << ", "
+            << anAttrReverse << ", " << anAttrCentering << ")" << std::endl;
+}
+
 //==================================================================================================
 PlacementPtr addPlacement(const std::shared_ptr<ModelAPI_Document>& thePart,
                           const std::list<ModelHighAPI_Selection>& theObjects,
index 14378f06870e61577352f23e5e4bdc07f9d4fa34..2b157611f2893da24dc7b8dbd6b3e187dab23695 100644 (file)
@@ -14,6 +14,7 @@
 #include <ModelHighAPI_Interface.h>
 #include <ModelHighAPI_Macro.h>
 
+class ModelHighAPI_Dumper;
 class ModelHighAPI_Selection;
 
 /// \class FeaturesAPI_Placement
@@ -65,6 +66,10 @@ public:
   /// Set centering flag.
   FEATURESAPI_EXPORT
   void setCentering(const bool theCentering);
+
+  /// Dump wrapped feature
+  FEATURESAPI_EXPORT
+  virtual void dump(ModelHighAPI_Dumper& theDumper) const;
 };
 
 /// Pointer on Placement object.