]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Tests fix.
authordbv <dbv@opencascade.com>
Thu, 14 Jul 2016 13:00:50 +0000 (16:00 +0300)
committerdbv <dbv@opencascade.com>
Thu, 14 Jul 2016 13:01:12 +0000 (16:01 +0300)
src/ConstructionAPI/ConstructionAPI_Plane.cpp
src/FeaturesPlugin/Test/TestCompositeFeaturesOnCompSolids.py
src/FeaturesPlugin/Test/TestExtrusion.py
src/FeaturesPlugin/Test/TestPartition.py
src/FeaturesPlugin/Test/TestRevolution.py
src/GeomAPI/CMakeLists.txt
src/GeomAPI/GeomAPI_Face.cpp
src/ModelAPI/Test/Test1064.py
src/PrimitivesPlugin/Test/UnitTestBox.py

index b33d4d74611c3d39ee3ae8d7c6cb9cdf1756f83d..2ea1b567ddab97e89450a12517b2f13669d1f5c5 100644 (file)
@@ -4,11 +4,10 @@
 // History:
 // 27/05/16 - Sergey POKHODENKO - Creation of the file
 
-//--------------------------------------------------------------------------------------
 #include "ConstructionAPI_Plane.h"
-//--------------------------------------------------------------------------------------
+
 #include <ModelHighAPI_Tools.h>
-//--------------------------------------------------------------------------------------
+
 ConstructionAPI_Plane::ConstructionAPI_Plane(
     const std::shared_ptr<ModelAPI_Feature> & theFeature)
 : ModelHighAPI_Interface(theFeature)
@@ -61,7 +60,7 @@ void ConstructionAPI_Plane::setGeneralEquation(
     const ModelHighAPI_Double & theC,
     const ModelHighAPI_Double & theD)
 {
-  fillAttribute("PlaneByGeneralEquation", mycreationMethod);
+  fillAttribute(ConstructionPlugin_Plane::CREATION_METHOD_BY_GENERAL_EQUATION(), mycreationMethod);
   fillAttribute(theA, myA);
   fillAttribute(theB, myB);
   fillAttribute(theC, myC);
index ba38dd2f2033996dc59fd1627faf5d70cd9585b3..1f9f97c49b62d8f7c2292fc359be9ee1c8435c75 100644 (file)
@@ -81,7 +81,8 @@ assert (anExtrusionResult is not None)
 # Create from plane
 aSession.startOperation()
 aFromPlaneFeature = aPart.addFeature("Plane")
-aFromPlaneFeature.string("CreationMethod").setValue("PlaneByGeneralEquation")
+aFromPlaneFeature.string("creation_method").setValue("by_general_equation")
+aFromPlaneFeature.string("by_other_plane_option").setValue("by_distance_from_other") # TODO: remove
 aFromPlaneFeature.real("A").setValue(0.)
 aFromPlaneFeature.real("B").setValue(0.)
 aFromPlaneFeature.real("C").setValue(1.)
@@ -91,7 +92,8 @@ aSession.finishOperation()
 # Create to plane
 aSession.startOperation()
 aToPlaneFeature = aPart.addFeature("Plane")
-aToPlaneFeature.string("CreationMethod").setValue("PlaneByGeneralEquation")
+aToPlaneFeature.string("creation_method").setValue("by_general_equation")
+aToPlaneFeature.string("by_other_plane_option").setValue("by_distance_from_other") # TODO: remove
 aToPlaneFeature.real("A").setValue(0.)
 aToPlaneFeature.real("B").setValue(0.)
 aToPlaneFeature.real("C").setValue(1.)
index da1d1f953323261304a5efe51a583ecce7ad5477..9a5c6d784e084f088b198fd9716c410631fba886 100644 (file)
@@ -103,7 +103,8 @@ assert (anExtrusionResult is not None)
 # Create from plane
 aSession.startOperation()
 aFromPlaneFeature = aPart.addFeature("Plane")
-aFromPlaneFeature.string("CreationMethod").setValue("PlaneByGeneralEquation")
+aFromPlaneFeature.string("creation_method").setValue("by_general_equation")
+aFromPlaneFeature.string("by_other_plane_option").setValue("by_distance_from_other") # TODO: remove
 aFromPlaneFeature.real("A").setValue(0.)
 aFromPlaneFeature.real("B").setValue(0.)
 aFromPlaneFeature.real("C").setValue(1.)
@@ -113,7 +114,8 @@ aSession.finishOperation()
 # Create to plane
 aSession.startOperation()
 aToPlaneFeature = aPart.addFeature("Plane")
-aToPlaneFeature.string("CreationMethod").setValue("PlaneByGeneralEquation")
+aToPlaneFeature.string("creation_method").setValue("by_general_equation")
+aToPlaneFeature.string("by_other_plane_option").setValue("by_distance_from_other") # TODO: remove
 aToPlaneFeature.real("A").setValue(0.)
 aToPlaneFeature.real("B").setValue(0.)
 aToPlaneFeature.real("C").setValue(1.)
index c90a2908273493936bc583d413e9d860403a5614..db00eaeeffde8132f605ba0e91ae87a8d75ebdd7 100644 (file)
@@ -80,7 +80,8 @@ assert (anExtrusionResult is not None)
 #=========================================================================
 aSession.startOperation()
 aPlaneFeature = aPart.addFeature("Plane")
-aPlaneFeature.string("CreationMethod").setValue("PlaneByGeneralEquation")
+aPlaneFeature.string("creation_method").setValue("by_general_equation")
+aPlaneFeature.string("by_other_plane_option").setValue("by_distance_from_other") # TODO: remove
 aPlaneFeature.real("A").setValue(0.)
 aPlaneFeature.real("B").setValue(1.)
 aPlaneFeature.real("C").setValue(0.)
index 6e4b2f175e1efc8fd6df334f32fc4c1e20db5e99..3f46da758957cd3386b72b2a47f1d5c330f40d3f 100644 (file)
@@ -7,10 +7,10 @@
         static const std::string MY_GROUP_LIST_ID("base");
         static const std::string MY_TO_OBJECT_ID("axis_object");
         static const std::string METHOD_ATTR("CreationMethod");
-        static const std::string MY_TO_ANGLE_ID("to_angle");           
+        static const std::string MY_TO_ANGLE_ID("to_angle");
         static const std::string MY_FROM_ANGLE_ID("from_angle");
         static const std::string MY_TO_OBJECT_ID("to_object");
-        static const std::string MY_TO_OFFSET_ID("to_offset"); 
+        static const std::string MY_TO_OFFSET_ID("to_offset");
         static const std::string MY_FROM_OBJECT_ID("from_object");
         static const std::string MY_FROM_OFFSET_ID("from_offset");
 
@@ -133,7 +133,8 @@ assert (aRevolResult is not None)
 # Create from plane
 aSession.startOperation()
 aFromPlaneFeature = aPart.addFeature("Plane")
-aFromPlaneFeature.string("CreationMethod").setValue("PlaneByGeneralEquation")
+aFromPlaneFeature.string("creation_method").setValue("by_general_equation")
+aFromPlaneFeature.string("by_other_plane_option").setValue("by_distance_from_other") # TODO: remove
 aFromPlaneFeature.real("A").setValue(0.)
 aFromPlaneFeature.real("B").setValue(0.)
 aFromPlaneFeature.real("C").setValue(1.)
@@ -145,7 +146,8 @@ aFromShape = modelAPI_ResultConstruction(aFromResult).shape()
 # Create to plane
 aSession.startOperation()
 aToPlaneFeature = aPart.addFeature("Plane")
-aToPlaneFeature.string("CreationMethod").setValue("PlaneByGeneralEquation")
+aToPlaneFeature.string("creation_method").setValue("by_general_equation")
+aToPlaneFeature.string("by_other_plane_option").setValue("by_distance_from_other") # TODO: remove
 aToPlaneFeature.real("A").setValue(0.)
 aToPlaneFeature.real("B").setValue(0.)
 aToPlaneFeature.real("C").setValue(1.)
index c440f5e4dc4afe65adb2deabde9067714001428c..767eb4922715df0cbe9fafa352f414ed9983ca16 100644 (file)
@@ -82,6 +82,7 @@ SET(PROJECT_LIBRARIES
     ${CAS_VIEWER}
     ${CAS_SHAPE}
     ${CAS_TKTopAlgo}
+    ${CAS_TKBO}
 )
 
 ADD_DEFINITIONS(-DGEOMAPI_EXPORTS ${CAS_DEFINITIONS})
index 6c3894ba7b256142140a414ea5280aef1cf84ffa..ff6eafc601c15eca8f967fb461bcd0ab6bc317eb 100644 (file)
 #include "GeomAPI_Pln.h"
 #include "GeomAPI_Pnt.h"
 
+#include <BOPTools_AlgoTools.hxx>
 #include <BRep_Tool.hxx>
 #include <BRepAdaptor_Surface.hxx>
 #include <Geom_Surface.hxx>
 #include <Geom_CylindricalSurface.hxx>
 #include <Geom_RectangularTrimmedSurface.hxx>
+#include <IntTools_Context.hxx>
 #include <TopoDS.hxx>
 #include <TopoDS_Face.hxx>
 
@@ -41,8 +43,11 @@ bool GeomAPI_Face::isEqual(std::shared_ptr<GeomAPI_Shape> theFace) const
   const TopoDS_Shape& aMyShape = const_cast<GeomAPI_Face*>(this)->impl<TopoDS_Shape>();
   const TopoDS_Shape& aInShape = theFace->impl<TopoDS_Shape>();
 
-  Handle(Geom_Surface) aMySurf = BRep_Tool::Surface(TopoDS::Face(aMyShape));
-  Handle(Geom_Surface) aInSurf = BRep_Tool::Surface(TopoDS::Face(aInShape));
+  TopoDS_Face aMyFace = TopoDS::Face(aMyShape);
+  TopoDS_Face aInFace = TopoDS::Face(aInShape);
+
+  Handle(Geom_Surface) aMySurf = BRep_Tool::Surface(aMyFace);
+  Handle(Geom_Surface) aInSurf = BRep_Tool::Surface(aInFace);
 
   // Check that surfaces a the same type
   if (aMySurf->DynamicType() != aInSurf->DynamicType())
@@ -61,7 +66,10 @@ bool GeomAPI_Face::isEqual(std::shared_ptr<GeomAPI_Shape> theFace) const
       fabs(aMyVMax - aInVMax) > Precision::PConfusion())
     return false;
 
-  return true;
+  Handle(IntTools_Context) aContext = new IntTools_Context();
+  Standard_Boolean aRes = BOPTools_AlgoTools::CheckSameGeom(aMyFace, aInFace, aContext);
+
+  return aRes == Standard_True;
 }
 
 bool GeomAPI_Face::isCylindrical() const
index 934a0779c50c9da4a5a56d620f3d2549901004fc..c2078e61d7bd8eb9ecb37bac57a3a0bf0b029cc1 100644 (file)
@@ -71,9 +71,10 @@ aSession.finishOperation()
 aSession.startOperation("Make Plane")
 aSession.setActiveDocument(aPartSet)
 aPlane = aPartSet.addFeature("Plane")
-aPlane.string("CreationMethod").setValue("PlaneByFaceAndDistance")
+aPlane.string("creation_method").setValue("by_other_plane")
+aPlane.string("by_other_plane_option").setValue("by_distance_from_other")
+aPlane.selection("plane").selectSubShape("face", "Part_1/Extrusion_1_1/Generated_Face_3")
 aPlane.real("distance").setValue(0)
-aPlane.selection("planeFace").selectSubShape("face", "Part_1/Extrusion_1_1/Generated_Face_3")
 aSession.finishOperation()
 
 #=========================================================================
index ef63b01098246a956d326904e49e47c348317eef..a5458b54a3169dd6aae8749d62b96fcf10cf3e82 100644 (file)
@@ -68,9 +68,10 @@ assert (math.fabs(aResVolume - aRefVolume) < 10 ** -5)
 #Check the naming by selecting a face and making a plane out of it
 aPlaneTop = aPart.addFeature("Plane")
 assert(aPlaneTop.getKind() == "Plane")
-aPlaneTop.string("CreationMethod").setValue("PlaneByFaceAndDistance")
-aSelectionAttr = aPlaneTop.selection("planeFace")
+aPlaneTop.string("creation_method").setValue("by_other_plane")
+aSelectionAttr = aPlaneTop.selection("plane")
 aSelectionAttr.selectSubShape("face", "Box_1_1/Top_1")
+aPlaneTop.string("by_other_plane_option").setValue("by_distance_from_other")
 aPlaneTop.real("distance").setValue(0.4)
 aPlaneTop.execute()
 
@@ -128,9 +129,10 @@ assert (math.fabs(aResVolume2 - aRefVolume2) < 10 ** -5)
 #Check the naming by selecting a face and making a plane out of it
 aPlaneRight = aPart.addFeature("Plane")
 assert(aPlaneRight.getKind() == "Plane")
-aPlaneRight.string("CreationMethod").setValue("PlaneByFaceAndDistance")
-aSelectionAttr = aPlaneRight.selection("planeFace")
+aPlaneRight.string("creation_method").setValue("by_other_plane")
+aSelectionAttr = aPlaneRight.selection("plane")
 aSelectionAttr.selectSubShape("face", "Box_2_1/Right_1")
+aPlaneRight.string("by_other_plane_option").setValue("by_distance_from_other")
 aPlaneRight.real("distance").setValue(0.5)
 aPlaneRight.execute()