From 99ced54c7fa671d4fbb003a7bf3a45986c28e652 Mon Sep 17 00:00:00 2001 From: dbv Date: Fri, 12 Aug 2016 11:25:35 +0300 Subject: [PATCH] Issue #1648: Dump Python in the High Level Parameterized Geometry API Dump for FeaturesAPI_Intersection --- src/FeaturesAPI/FeaturesAPI_Intersection.cpp | 14 ++++++++++++++ src/FeaturesAPI/FeaturesAPI_Intersection.h | 5 +++++ src/PythonAPI/model/features/__init__.py | 3 +-- 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/src/FeaturesAPI/FeaturesAPI_Intersection.cpp b/src/FeaturesAPI/FeaturesAPI_Intersection.cpp index ce33f83da..8cd80eb47 100644 --- a/src/FeaturesAPI/FeaturesAPI_Intersection.cpp +++ b/src/FeaturesAPI/FeaturesAPI_Intersection.cpp @@ -6,6 +6,7 @@ #include "FeaturesAPI_Intersection.h" +#include #include //================================================================================================== @@ -51,6 +52,19 @@ void FeaturesAPI_Intersection::setTools(const std::list& 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& thePart, const std::list& theObjects, diff --git a/src/FeaturesAPI/FeaturesAPI_Intersection.h b/src/FeaturesAPI/FeaturesAPI_Intersection.h index 440e43013..78a6d5156 100644 --- a/src/FeaturesAPI/FeaturesAPI_Intersection.h +++ b/src/FeaturesAPI/FeaturesAPI_Intersection.h @@ -14,6 +14,7 @@ #include #include +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& theTools); + + /// Dump wrapped feature + FEATURESAPI_EXPORT + virtual void dump(ModelHighAPI_Dumper& theDumper) const; }; /// Pointer on Intersection object. diff --git a/src/PythonAPI/model/features/__init__.py b/src/PythonAPI/model/features/__init__.py index 9d1dd8d17..186a4018f 100644 --- a/src/PythonAPI/model/features/__init__.py +++ b/src/PythonAPI/model/features/__init__.py @@ -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 - -- 2.39.2