From f9ffa7237613656122e3159719cd688c7d55c782 Mon Sep 17 00:00:00 2001 From: dbv Date: Tue, 16 Aug 2016 10:54:26 +0300 Subject: [PATCH] Issue #1648: Dump Python in the High Level Parameterized Geometry API Dump for FeaturesAPI_Translation --- src/FeaturesAPI/FeaturesAPI_Translation.cpp | 15 +++++++++++++++ src/FeaturesAPI/FeaturesAPI_Translation.h | 5 +++++ 2 files changed, 20 insertions(+) diff --git a/src/FeaturesAPI/FeaturesAPI_Translation.cpp b/src/FeaturesAPI/FeaturesAPI_Translation.cpp index 46a977c96..e70df5b8c 100644 --- a/src/FeaturesAPI/FeaturesAPI_Translation.cpp +++ b/src/FeaturesAPI/FeaturesAPI_Translation.cpp @@ -6,6 +6,7 @@ #include "FeaturesAPI_Translation.h" +#include #include //================================================================================================== @@ -59,6 +60,20 @@ void FeaturesAPI_Translation::setDistance(const ModelHighAPI_Double& theDistance execute(); } +//================================================================================================== +void FeaturesAPI_Translation::dump(ModelHighAPI_Dumper& theDumper) const +{ + FeaturePtr aBase = feature(); + const std::string& aDocName = theDumper.name(aBase->document()); + + AttributeSelectionListPtr anAttrObjects = aBase->selectionList(FeaturesPlugin_Translation::OBJECTS_LIST_ID()); + AttributeSelectionPtr anAttrAxis = aBase->selection(FeaturesPlugin_Translation::AXIS_OBJECT_ID()); + AttributeDoublePtr anAttrDistance = aBase->real(FeaturesPlugin_Translation::DISTANCE_ID()); + + theDumper << aBase << " = model.addTranslation(" << aDocName << ", " + << anAttrObjects << ", " << anAttrAxis << ", " << anAttrDistance << ")" << std::endl; +} + //================================================================================================== TranslationPtr addTranslation(const std::shared_ptr& thePart, const std::list& theMainObjects, diff --git a/src/FeaturesAPI/FeaturesAPI_Translation.h b/src/FeaturesAPI/FeaturesAPI_Translation.h index 0304f2819..995b880a8 100644 --- a/src/FeaturesAPI/FeaturesAPI_Translation.h +++ b/src/FeaturesAPI/FeaturesAPI_Translation.h @@ -15,6 +15,7 @@ #include class ModelHighAPI_Double; +class ModelHighAPI_Dumper; class ModelHighAPI_Selection; /// \class FeaturesAPI_Translation @@ -54,6 +55,10 @@ public: /// Set distance. FEATURESAPI_EXPORT void setDistance(const ModelHighAPI_Double& theDistance); + + /// Dump wrapped feature + FEATURESAPI_EXPORT + virtual void dump(ModelHighAPI_Dumper& theDumper) const; }; /// Pointer on Translation object. -- 2.39.2