From 1d9f819d2cd7d6735e1669a139deb88abf921c41 Mon Sep 17 00:00:00 2001 From: Clarisse Genrault Date: Thu, 26 Jan 2017 08:04:08 +0100 Subject: [PATCH] Debugging Symmetry feature. --- src/FeaturesAPI/FeaturesAPI_Symmetry.cpp | 9 +++------ src/FeaturesAPI/Test/APIParam_Symmetry.py | 4 ++-- src/FeaturesPlugin/FeaturesPlugin_Symmetry.cpp | 9 ++++----- src/FeaturesPlugin/FeaturesPlugin_Symmetry.h | 17 +++++++++-------- src/GeomAlgoAPI/GeomAlgoAPI_Symmetry.cpp | 8 ++++---- src/GeomAlgoAPI/GeomAlgoAPI_Symmetry.h | 18 +++++++++--------- 6 files changed, 31 insertions(+), 34 deletions(-) diff --git a/src/FeaturesAPI/FeaturesAPI_Symmetry.cpp b/src/FeaturesAPI/FeaturesAPI_Symmetry.cpp index 24a41f3f1..36888ef3e 100644 --- a/src/FeaturesAPI/FeaturesAPI_Symmetry.cpp +++ b/src/FeaturesAPI/FeaturesAPI_Symmetry.cpp @@ -10,8 +10,7 @@ #include //================================================================================================== -FeaturesAPI_Symmetry::FeaturesAPI_Symmetry( - const std::shared_ptr& theFeature) +FeaturesAPI_Symmetry::FeaturesAPI_Symmetry(const std::shared_ptr& theFeature) : ModelHighAPI_Interface(theFeature) { initialize(); @@ -24,7 +23,7 @@ FeaturesAPI_Symmetry::FeaturesAPI_Symmetry(const std::shared_ptrdocument()); @@ -106,7 +103,7 @@ void FeaturesAPI_Symmetry::dump(ModelHighAPI_Dumper& theDumper) const theDumper << ", " << anAttrPlane; } - theDumper << ")" << std::endl; + theDumper << ")" << std::endl; } //================================================================================================== diff --git a/src/FeaturesAPI/Test/APIParam_Symmetry.py b/src/FeaturesAPI/Test/APIParam_Symmetry.py index dcf822b19..97aca11e8 100644 --- a/src/FeaturesAPI/Test/APIParam_Symmetry.py +++ b/src/FeaturesAPI/Test/APIParam_Symmetry.py @@ -1,5 +1,5 @@ """ -Test case for Translation feature. +Test case for Symmetry feature. Written on High API. """ from ModelAPI import * @@ -18,11 +18,11 @@ aDocument = aSession.activeDocument() aSession.finishOperation() # Create a box - aSession.startOperation() aBox1 = model.addBox(aDocument, 10, 10, 10) aBox2 = model.addBox(aDocument, 10, 10, 10) aBox3 = model.addBox(aDocument, 10, 10, 10) +aSession.finishOperation() # Perform a symmetry by a point aSession.startOperation() diff --git a/src/FeaturesPlugin/FeaturesPlugin_Symmetry.cpp b/src/FeaturesPlugin/FeaturesPlugin_Symmetry.cpp index e38bff2e8..b1b34237b 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Symmetry.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_Symmetry.cpp @@ -6,17 +6,16 @@ #include -#include -#include -#include +#include #include #include #include #include -#include - +#include +#include +#include #include //================================================================================================= diff --git a/src/FeaturesPlugin/FeaturesPlugin_Symmetry.h b/src/FeaturesPlugin/FeaturesPlugin_Symmetry.h index 988f58339..efa462156 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Symmetry.h +++ b/src/FeaturesPlugin/FeaturesPlugin_Symmetry.h @@ -23,8 +23,8 @@ class FeaturesPlugin_Symmetry : public ModelAPI_Feature /// Symmetry kind. inline static const std::string& ID() { - static const std::string MY_SYMMETRY("Symmetry"); - return MY_SYMMETRY; + static const std::string MY_SYMMETRY_ID("Symmetry"); + return MY_SYMMETRY_ID; } /// Attribute name for creation method. @@ -34,21 +34,21 @@ class FeaturesPlugin_Symmetry : public ModelAPI_Feature return MY_CREATION_METHOD_ID; } - /// Attribute name for creation method "ByAxisAndDistance". + /// Attribute name for creation method "ByPoint". inline static const std::string& CREATION_METHOD_BY_POINT() { static const std::string MY_CREATION_METHOD_ID("ByPoint"); return MY_CREATION_METHOD_ID; } - /// Attribute name for creation method "ByDimensions". + /// Attribute name for creation method "ByAxis". inline static const std::string& CREATION_METHOD_BY_AXIS() { static const std::string MY_CREATION_METHOD_ID("ByAxis"); return MY_CREATION_METHOD_ID; } - /// Attribute name for creation method "ByTwoPoints". + /// Attribute name for creation method "ByPlane". inline static const std::string& CREATION_METHOD_BY_PLANE() { static const std::string MY_CREATION_METHOD_ID("ByPlane"); @@ -100,15 +100,16 @@ class FeaturesPlugin_Symmetry : public ModelAPI_Feature FeaturesPlugin_Symmetry(); private: - ///Perform symmetry with respect to a point. + /// Perform symmetry with respect to a point. void performSymmetryByPoint(); - ///Perform symmetry with respect to an axis. + /// Perform symmetry with respect to an axis. void performSymmetryByAxis(); - ///Perform symmetry with respect to a plane. + /// Perform symmetry with respect to a plane. void performSymmetryByPlane(); + /// Perform the naming void loadNamingDS(GeomAlgoAPI_Symmetry& theSymmetryAlgo, std::shared_ptr theResultBody, std::shared_ptr theBaseShape); diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Symmetry.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_Symmetry.cpp index 143f41c4b..f5baf287d 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Symmetry.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Symmetry.cpp @@ -101,7 +101,7 @@ void GeomAlgoAPI_Symmetry::build() break; } default: { - myError = "Mirror builder :: method not supported"; + myError = "Symmetry builder :: method not supported"; return; } } @@ -109,14 +109,14 @@ void GeomAlgoAPI_Symmetry::build() const TopoDS_Shape& aSourceShape = mySourceShape->impl(); if(aSourceShape.IsNull()) { - myError = "Mirror builder :: source shape does not contain any actual shape."; + myError = "Symmetry builder :: source shape does not contain any actual shape."; return; } // Transform the shape while copying it. BRepBuilderAPI_Transform* aBuilder = new BRepBuilderAPI_Transform(aSourceShape, *aTrsf, true); if(!aBuilder) { - myError = "Mirror builder :: source shape does not contain any actual shape."; + myError = "Symmetry builder :: transform initialization failed."; return; } @@ -124,7 +124,7 @@ void GeomAlgoAPI_Symmetry::build() setBuilderType(OCCT_BRepBuilderAPI_MakeShape); if(!aBuilder->IsDone()) { - myError = "Mirror builder :: source shape does not contain any actual shape."; + myError = "Symmetry builder :: algorithm failed."; return; } diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Symmetry.h b/src/GeomAlgoAPI/GeomAlgoAPI_Symmetry.h index 153f451ad..8eac85251 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Symmetry.h +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Symmetry.h @@ -21,7 +21,7 @@ class GeomAlgoAPI_Symmetry : public GeomAlgoAPI_MakeShape { public: - /// Type of mirror operation + /// Type of symmetry operation enum MethodType { BY_POINT, ///< Symmetry by point. BY_AXIS, ///< Symmetry by axis. @@ -30,29 +30,29 @@ public: /// \brief Creates an object which is obtained from current object by performing /// a symmetry operation by a point. - /// \param[in] theSourceShape a shape to be moved. - /// \param[in] thePoint symmetry point. + /// \param[in] theSourceShape the shape to be moved. + /// \param[in] thePoint the symmetry point. GEOMALGOAPI_EXPORT GeomAlgoAPI_Symmetry(std::shared_ptr theSourceShape, std::shared_ptr thePoint); /// \brief Creates an object which is obtained from current object by performing /// a symmetry operation by a point. - /// \param[in] theSourceShape a shape to be moved. - /// \param[in] theAxis symmetry axis. + /// \param[in] theSourceShape the shape to be moved. + /// \param[in] theAxis the symmetry axis. GEOMALGOAPI_EXPORT GeomAlgoAPI_Symmetry(std::shared_ptr theSourceShape, std::shared_ptr theAxis); /// \brief Creates an object which is obtained from current object by performing /// a symmetry operation by a point. - /// \param[in] theSourceShape a shape to be moved. - /// \param[in] thePlane symmetry plane. + /// \param[in] theSourceShape the shape to be moved. + /// \param[in] thePlane the symmetry plane. GEOMALGOAPI_EXPORT GeomAlgoAPI_Symmetry(std::shared_ptr theSourceShape, std::shared_ptr thePlane); - /// Checks if data for the translation execution is OK. + /// Checks if data for the symmetry execution is OK. GEOMALGOAPI_EXPORT bool check(); - /// Execute the translation. + /// Execute the symmetry. GEOMALGOAPI_EXPORT void build(); private: -- 2.39.2