From: dbv Date: Tue, 16 Aug 2016 07:50:07 +0000 (+0300) Subject: Issue #1648: Dump Python in the High Level Parameterized Geometry API X-Git-Tag: V_2.5.0~137^2~49 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=0d82f7d4b8f16937aaefb1ca047876cca6e01dc0;p=modules%2Fshaper.git Issue #1648: Dump Python in the High Level Parameterized Geometry API Dump for FeaturesAPI_Rotation --- diff --git a/src/FeaturesAPI/FeaturesAPI_Rotation.cpp b/src/FeaturesAPI/FeaturesAPI_Rotation.cpp index 861f3da00..d24aa0890 100644 --- a/src/FeaturesAPI/FeaturesAPI_Rotation.cpp +++ b/src/FeaturesAPI/FeaturesAPI_Rotation.cpp @@ -6,6 +6,7 @@ #include "FeaturesAPI_Rotation.h" +#include #include //================================================================================================== @@ -59,12 +60,26 @@ void FeaturesAPI_Rotation::setAngle(const ModelHighAPI_Double& theAngle) execute(); } +//================================================================================================== +void FeaturesAPI_Rotation::dump(ModelHighAPI_Dumper& theDumper) const +{ + FeaturePtr aBase = feature(); + const std::string& aDocName = theDumper.name(aBase->document()); + + AttributeSelectionListPtr anAttrObjects = aBase->selectionList(FeaturesPlugin_Rotation::OBJECTS_LIST_ID()); + AttributeSelectionPtr anAttrAxis = aBase->selection(FeaturesPlugin_Rotation::AXIS_OBJECT_ID()); + AttributeDoublePtr anAttrAngle = aBase->real(FeaturesPlugin_Rotation::ANGLE_ID()); + + theDumper << aBase << " = model.addRotation(" << aDocName << ", " + << anAttrObjects << ", " << anAttrAxis << ", " << anAttrAngle << ")" << std::endl; +} + //================================================================================================== RotationPtr addRotation(const std::shared_ptr& thePart, const std::list& theMainObjects, const ModelHighAPI_Selection& theAxisObject, - const ModelHighAPI_Double& theDistance) + const ModelHighAPI_Double& theAngle) { std::shared_ptr aFeature = thePart->addFeature(FeaturesAPI_Rotation::ID()); - return RotationPtr(new FeaturesAPI_Rotation(aFeature, theMainObjects, theAxisObject, theDistance)); + return RotationPtr(new FeaturesAPI_Rotation(aFeature, theMainObjects, theAxisObject, theAngle)); } diff --git a/src/FeaturesAPI/FeaturesAPI_Rotation.h b/src/FeaturesAPI/FeaturesAPI_Rotation.h index c8e74ace8..03fd636ad 100644 --- a/src/FeaturesAPI/FeaturesAPI_Rotation.h +++ b/src/FeaturesAPI/FeaturesAPI_Rotation.h @@ -15,6 +15,7 @@ #include class ModelHighAPI_Double; +class ModelHighAPI_Dumper; class ModelHighAPI_Selection; /// \class FeaturesAPI_Rotation @@ -54,6 +55,10 @@ public: /// Set angle. FEATURESAPI_EXPORT void setAngle(const ModelHighAPI_Double& theAngle); + + /// Dump wrapped feature + FEATURESAPI_EXPORT + virtual void dump(ModelHighAPI_Dumper& theDumper) const; }; /// Pointer on Rotation object. @@ -65,6 +70,6 @@ FEATURESAPI_EXPORT RotationPtr addRotation(const std::shared_ptr& thePart, const std::list& theMainObjects, const ModelHighAPI_Selection& theAxisObject, - const ModelHighAPI_Double& theDistance); + const ModelHighAPI_Double& theAngle); #endif // FeaturesAPI_Rotation_H_