From 792ff3795180cb50ef97dfc173c772b8897b8862 Mon Sep 17 00:00:00 2001 From: dbv Date: Fri, 12 Aug 2016 15:54:05 +0300 Subject: [PATCH] Issue #1648: Dump Python in the High Level Parameterized Geometry API Dump for FeaturesAPI_Pipe --- src/FeaturesAPI/FeaturesAPI_Pipe.cpp | 30 ++++++++++++++++++++++++ src/FeaturesAPI/FeaturesAPI_Pipe.h | 5 ++++ src/PythonAPI/model/features/__init__.py | 9 +++---- 3 files changed, 38 insertions(+), 6 deletions(-) diff --git a/src/FeaturesAPI/FeaturesAPI_Pipe.cpp b/src/FeaturesAPI/FeaturesAPI_Pipe.cpp index 3ca9a4e54..f99cccef2 100644 --- a/src/FeaturesAPI/FeaturesAPI_Pipe.cpp +++ b/src/FeaturesAPI/FeaturesAPI_Pipe.cpp @@ -6,6 +6,7 @@ #include "FeaturesAPI_Pipe.h" +#include #include //================================================================================================== @@ -110,6 +111,35 @@ void FeaturesAPI_Pipe::setByBasePathLocations(const std::listdocument()); + + AttributeSelectionListPtr anAttrObjects = aBase->selectionList(FeaturesPlugin_Pipe::BASE_OBJECTS_ID()); + AttributeSelectionPtr anAttrPath = aBase->selection(FeaturesPlugin_Pipe::PATH_OBJECT_ID()); + + theDumper << aBase << " = model.addPipe(" << aDocName << ", " + << anAttrObjects << ", " << anAttrPath; + + std::string aCreationMethod = aBase->string(FeaturesPlugin_Pipe::CREATION_METHOD())->value(); + + if(aCreationMethod == FeaturesPlugin_Pipe::CREATION_METHOD_SIMPLE()) { + // Do nothing; + } else if(aCreationMethod == FeaturesPlugin_Pipe::CREATION_METHOD_BINORMAL()) { + AttributeSelectionPtr anAttrBiNormal = aBase->selection(FeaturesPlugin_Pipe::BINORMAL_ID()); + + theDumper << ", " << anAttrBiNormal; + } else if(aCreationMethod == FeaturesPlugin_Pipe::CREATION_METHOD_LOCATIONS()) { + AttributeSelectionListPtr anAttrLocations = aBase->selectionList(FeaturesPlugin_Pipe::LOCATIONS_ID()); + + theDumper << ", " << anAttrLocations; + } + + theDumper << ")" << std::endl; +} + //================================================================================================== PipePtr addPipe(const std::shared_ptr& thePart, const std::list& theBaseObjects, diff --git a/src/FeaturesAPI/FeaturesAPI_Pipe.h b/src/FeaturesAPI/FeaturesAPI_Pipe.h index 1a3ee09a0..e45fd369f 100644 --- a/src/FeaturesAPI/FeaturesAPI_Pipe.h +++ b/src/FeaturesAPI/FeaturesAPI_Pipe.h @@ -14,6 +14,7 @@ #include #include +class ModelHighAPI_Dumper; class ModelHighAPI_Selection; /// \class FeaturesAPI_Pipe @@ -81,6 +82,10 @@ public: void setByBasePathLocations(const std::list& theBaseObjects, const ModelHighAPI_Selection& thePath, const std::list& theLocations); + + /// Dump wrapped feature + FEATURESAPI_EXPORT + virtual void dump(ModelHighAPI_Dumper& theDumper) const; }; /// Pointer on Pipe object. diff --git a/src/PythonAPI/model/features/__init__.py b/src/PythonAPI/model/features/__init__.py index 186a4018f..ad4104ea1 100644 --- a/src/PythonAPI/model/features/__init__.py +++ b/src/PythonAPI/model/features/__init__.py @@ -2,12 +2,9 @@ """ from FeaturesAPI import addPlacement, addRotation, addTranslation - -from FeaturesAPI import addCut, addFuse, addCommon, addSmash, addFill - -from FeaturesAPI import addIntersection, addPartition - from FeaturesAPI import addExtrusion, addExtrusionCut, addExtrusionFuse from FeaturesAPI import addRevolution, addRevolutionCut, addRevolutionFuse - +from FeaturesAPI import addPipe +from FeaturesAPI import addCut, addFuse, addCommon, addSmash, addFill +from FeaturesAPI import addIntersection, addPartition from FeaturesAPI import addGroup, addRecover -- 2.39.2