Salome HOME
Debugging Symmetry feature.
authorClarisse Genrault <clarisse.genrault@cea.fr>
Thu, 26 Jan 2017 07:04:08 +0000 (08:04 +0100)
committerClarisse Genrault <clarisse.genrault@cea.fr>
Thu, 26 Jan 2017 07:04:08 +0000 (08:04 +0100)
src/FeaturesAPI/FeaturesAPI_Symmetry.cpp
src/FeaturesAPI/Test/APIParam_Symmetry.py
src/FeaturesPlugin/FeaturesPlugin_Symmetry.cpp
src/FeaturesPlugin/FeaturesPlugin_Symmetry.h
src/GeomAlgoAPI/GeomAlgoAPI_Symmetry.cpp
src/GeomAlgoAPI/GeomAlgoAPI_Symmetry.h

index 24a41f3f13316df8a42577b811f1aaafdac25485..36888ef3e37ce03be2bc23df5dbb3124f65c3f43 100644 (file)
@@ -10,8 +10,7 @@
 #include <ModelHighAPI_Tools.h>
 
 //==================================================================================================
-FeaturesAPI_Symmetry::FeaturesAPI_Symmetry(
-  const std::shared_ptr<ModelAPI_Feature>& theFeature)
+FeaturesAPI_Symmetry::FeaturesAPI_Symmetry(const std::shared_ptr<ModelAPI_Feature>& theFeature)
 : ModelHighAPI_Interface(theFeature)
 {
   initialize();
@@ -24,7 +23,7 @@ FeaturesAPI_Symmetry::FeaturesAPI_Symmetry(const std::shared_ptr<ModelAPI_Featur
 : ModelHighAPI_Interface(theFeature)
 {
   if(initialize()) {
-    fillAttribute(theMainObjects, mymainObjects);
+    fillAttribute(theMainObjects, mainObjects());
     GeomAPI_Shape::ShapeType aType = getShapeType(theObject);
     if(aType == GeomAPI_Shape::VERTEX) {
       setPoint(theObject);
@@ -39,7 +38,6 @@ FeaturesAPI_Symmetry::FeaturesAPI_Symmetry(const std::shared_ptr<ModelAPI_Featur
 //==================================================================================================
 FeaturesAPI_Symmetry::~FeaturesAPI_Symmetry()
 {
-
 }
 
 //==================================================================================================
@@ -81,7 +79,6 @@ void FeaturesAPI_Symmetry::setPlane(const ModelHighAPI_Selection& thePlaneObject
 //==================================================================================================
 void FeaturesAPI_Symmetry::dump(ModelHighAPI_Dumper& theDumper) const
 {
-  std::cout << "DUMP SYMMETRY" << std::endl;
   FeaturePtr aBase = feature();
   const std::string& aDocName = theDumper.name(aBase->document());
 
@@ -106,7 +103,7 @@ void FeaturesAPI_Symmetry::dump(ModelHighAPI_Dumper& theDumper) const
     theDumper << ", " << anAttrPlane;
   }
 
-   theDumper << ")" << std::endl;
+  theDumper << ")" << std::endl;
 }
 
 //==================================================================================================
index dcf822b1947167ddd55d5c4f3d52145c4b1fd843..97aca11e83670fcdfd30cbef1e924edde213ba6a 100644 (file)
@@ -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()
index e38bff2e8ed32fdcf20fe24b434d9e8d9e5fcf3f..b1b34237b6821cb90bea397a4422b7c215fb7c8a 100644 (file)
@@ -6,17 +6,16 @@
 
 #include <FeaturesPlugin_Symmetry.h>
 
-#include <ModelAPI_AttributeSelectionList.h>
-#include <ModelAPI_AttributeString.h>
-#include <ModelAPI_ResultBody.h>
+#include <GeomAlgoAPI_PointBuilder.h>
 
 #include <GeomAPI_Edge.h>
 #include <GeomAPI_Face.h>
 #include <GeomAPI_Lin.h>
 #include <GeomAPI_Pln.h>
 
-#include <GeomAlgoAPI_PointBuilder.h>
-
+#include <ModelAPI_AttributeSelectionList.h>
+#include <ModelAPI_AttributeString.h>
+#include <ModelAPI_ResultBody.h>
 #include <ModelAPI_ResultPart.h>
 
 //=================================================================================================
index 988f58339d3eb23920e76954c00ace4f8756bac6..efa462156c464a8e4ecf09e90590a676e56b7c1c 100644 (file)
@@ -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<ModelAPI_ResultBody> theResultBody,
                     std::shared_ptr<GeomAPI_Shape> theBaseShape);
index 143f41c4bfc26356b19d1ca76d497b43a38695b6..f5baf287d1ecfa6022197313eba7c13d6db7d924 100644 (file)
@@ -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<TopoDS_Shape>();
 
   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;
   }
 
index 153f451adb91f592d99f7ad0acafb10adeba7b92..8eac85251b9e29ac18702eb9ddbd4da360fcb44e 100644 (file)
@@ -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<GeomAPI_Shape> theSourceShape,
                                           std::shared_ptr<GeomAPI_Pnt>   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<GeomAPI_Shape> theSourceShape,
                                           std::shared_ptr<GeomAPI_Ax1>   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<GeomAPI_Shape> theSourceShape,
                                           std::shared_ptr<GeomAPI_Ax2>   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: