From ec44a81b875f8c2cc8080e000c3a6d49e9a1eaf0 Mon Sep 17 00:00:00 2001 From: dbv Date: Fri, 12 Aug 2016 15:54:21 +0300 Subject: [PATCH] Issue #1648: Dump Python in the High Level Parameterized Geometry API Dump for FeaturesAPI_Placement --- src/FeaturesAPI/FeaturesAPI_Placement.cpp | 18 ++++++++++++++++++ src/FeaturesAPI/FeaturesAPI_Placement.h | 5 +++++ 2 files changed, 23 insertions(+) diff --git a/src/FeaturesAPI/FeaturesAPI_Placement.cpp b/src/FeaturesAPI/FeaturesAPI_Placement.cpp index f45264e14..5d3aff8b4 100644 --- a/src/FeaturesAPI/FeaturesAPI_Placement.cpp +++ b/src/FeaturesAPI/FeaturesAPI_Placement.cpp @@ -6,6 +6,7 @@ #include "FeaturesAPI_Placement.h" +#include #include //================================================================================================== @@ -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& thePart, const std::list& theObjects, diff --git a/src/FeaturesAPI/FeaturesAPI_Placement.h b/src/FeaturesAPI/FeaturesAPI_Placement.h index 14378f068..2b157611f 100644 --- a/src/FeaturesAPI/FeaturesAPI_Placement.h +++ b/src/FeaturesAPI/FeaturesAPI_Placement.h @@ -14,6 +14,7 @@ #include #include +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. -- 2.39.2