Salome HOME
Issue #1648: Dump Python in the High Level Parameterized Geometry API
authordbv <dbv@opencascade.com>
Fri, 12 Aug 2016 08:25:35 +0000 (11:25 +0300)
committerdbv <dbv@opencascade.com>
Mon, 15 Aug 2016 11:03:12 +0000 (14:03 +0300)
Dump for FeaturesAPI_Intersection

src/FeaturesAPI/FeaturesAPI_Intersection.cpp
src/FeaturesAPI/FeaturesAPI_Intersection.h
src/PythonAPI/model/features/__init__.py

index ce33f83da978172674e9eff8172225db1796112b..8cd80eb47e5985b86fdb0f3c1461099d9a8d9d33 100644 (file)
@@ -6,6 +6,7 @@
 
 #include "FeaturesAPI_Intersection.h"
 
+#include <ModelHighAPI_Dumper.h>
 #include <ModelHighAPI_Tools.h>
 
 //==================================================================================================
@@ -51,6 +52,19 @@ void FeaturesAPI_Intersection::setTools(const std::list<ModelHighAPI_Selection>&
   execute();
 }
 
+//==================================================================================================
+void FeaturesAPI_Intersection::dump(ModelHighAPI_Dumper& theDumper) const
+{
+  FeaturePtr aBase = feature();
+  const std::string& aDocName = theDumper.name(aBase->document());
+
+  AttributeSelectionListPtr anAttrObjects = aBase->selectionList(FeaturesPlugin_Intersection::OBJECT_LIST_ID());
+  AttributeSelectionListPtr anAttrTools = aBase->selectionList(FeaturesPlugin_Intersection::TOOL_LIST_ID());
+
+  theDumper << aBase << " = model.addIntersection(" << aDocName << ", "
+            << anAttrObjects << ", " << anAttrTools << ")" << std::endl;
+}
+
 //==================================================================================================
 IntersectionPtr addIntersection(const std::shared_ptr<ModelAPI_Document>& thePart,
                                 const std::list<ModelHighAPI_Selection>& theObjects,
index 440e43013115365897168255f97c9745e88561ea..78a6d51562b2264f8add3e632ba46ee46c8f2227 100644 (file)
@@ -14,6 +14,7 @@
 #include <ModelHighAPI_Interface.h>
 #include <ModelHighAPI_Macro.h>
 
+class ModelHighAPI_Dumper;
 class ModelHighAPI_Selection;
 
 /// \class FeaturesAPI_Intersection
@@ -47,6 +48,10 @@ public:
   /// Modify tools attribute of the feature.
   FEATURESAPI_EXPORT
   void setTools(const std::list<ModelHighAPI_Selection>& theTools);
+
+  /// Dump wrapped feature
+  FEATURESAPI_EXPORT
+  virtual void dump(ModelHighAPI_Dumper& theDumper) const;
 };
 
 /// Pointer on Intersection object.
index 9d1dd8d174aa7ae83757d9edc0af96c7780dc378..186a4018fc0258e2177b71eb5d67633dfdd34724 100644 (file)
@@ -5,10 +5,9 @@ from FeaturesAPI import addPlacement, addRotation, addTranslation
 
 from FeaturesAPI import addCut, addFuse, addCommon, addSmash, addFill
 
-from FeaturesAPI import addPartition
+from FeaturesAPI import addIntersection, addPartition
 
 from FeaturesAPI import addExtrusion, addExtrusionCut, addExtrusionFuse
 from FeaturesAPI import addRevolution, addRevolutionCut, addRevolutionFuse
 
 from FeaturesAPI import addGroup, addRecover
-