From: dbv Date: Thu, 14 Jul 2016 13:00:50 +0000 (+0300) Subject: Tests fix. X-Git-Tag: V_2.5.0~191 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=f78a9c96be4d33c6574511e19e9d1df2df29bdb5;p=modules%2Fshaper.git Tests fix. --- diff --git a/src/ConstructionAPI/ConstructionAPI_Plane.cpp b/src/ConstructionAPI/ConstructionAPI_Plane.cpp index b33d4d746..2ea1b567d 100644 --- a/src/ConstructionAPI/ConstructionAPI_Plane.cpp +++ b/src/ConstructionAPI/ConstructionAPI_Plane.cpp @@ -4,11 +4,10 @@ // History: // 27/05/16 - Sergey POKHODENKO - Creation of the file -//-------------------------------------------------------------------------------------- #include "ConstructionAPI_Plane.h" -//-------------------------------------------------------------------------------------- + #include -//-------------------------------------------------------------------------------------- + ConstructionAPI_Plane::ConstructionAPI_Plane( const std::shared_ptr & 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); diff --git a/src/FeaturesPlugin/Test/TestCompositeFeaturesOnCompSolids.py b/src/FeaturesPlugin/Test/TestCompositeFeaturesOnCompSolids.py index ba38dd2f2..1f9f97c49 100644 --- a/src/FeaturesPlugin/Test/TestCompositeFeaturesOnCompSolids.py +++ b/src/FeaturesPlugin/Test/TestCompositeFeaturesOnCompSolids.py @@ -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.) diff --git a/src/FeaturesPlugin/Test/TestExtrusion.py b/src/FeaturesPlugin/Test/TestExtrusion.py index da1d1f953..9a5c6d784 100644 --- a/src/FeaturesPlugin/Test/TestExtrusion.py +++ b/src/FeaturesPlugin/Test/TestExtrusion.py @@ -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.) diff --git a/src/FeaturesPlugin/Test/TestPartition.py b/src/FeaturesPlugin/Test/TestPartition.py index c90a29082..db00eaeef 100644 --- a/src/FeaturesPlugin/Test/TestPartition.py +++ b/src/FeaturesPlugin/Test/TestPartition.py @@ -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.) diff --git a/src/FeaturesPlugin/Test/TestRevolution.py b/src/FeaturesPlugin/Test/TestRevolution.py index 6e4b2f175..3f46da758 100644 --- a/src/FeaturesPlugin/Test/TestRevolution.py +++ b/src/FeaturesPlugin/Test/TestRevolution.py @@ -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.) diff --git a/src/GeomAPI/CMakeLists.txt b/src/GeomAPI/CMakeLists.txt index c440f5e4d..767eb4922 100644 --- a/src/GeomAPI/CMakeLists.txt +++ b/src/GeomAPI/CMakeLists.txt @@ -82,6 +82,7 @@ SET(PROJECT_LIBRARIES ${CAS_VIEWER} ${CAS_SHAPE} ${CAS_TKTopAlgo} + ${CAS_TKBO} ) ADD_DEFINITIONS(-DGEOMAPI_EXPORTS ${CAS_DEFINITIONS}) diff --git a/src/GeomAPI/GeomAPI_Face.cpp b/src/GeomAPI/GeomAPI_Face.cpp index 6c3894ba7..ff6eafc60 100644 --- a/src/GeomAPI/GeomAPI_Face.cpp +++ b/src/GeomAPI/GeomAPI_Face.cpp @@ -10,11 +10,13 @@ #include "GeomAPI_Pln.h" #include "GeomAPI_Pnt.h" +#include #include #include #include #include #include +#include #include #include @@ -41,8 +43,11 @@ bool GeomAPI_Face::isEqual(std::shared_ptr theFace) const const TopoDS_Shape& aMyShape = const_cast(this)->impl(); const TopoDS_Shape& aInShape = theFace->impl(); - 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 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 diff --git a/src/ModelAPI/Test/Test1064.py b/src/ModelAPI/Test/Test1064.py index 934a0779c..c2078e61d 100644 --- a/src/ModelAPI/Test/Test1064.py +++ b/src/ModelAPI/Test/Test1064.py @@ -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() #========================================================================= diff --git a/src/PrimitivesPlugin/Test/UnitTestBox.py b/src/PrimitivesPlugin/Test/UnitTestBox.py index ef63b0109..a5458b54a 100644 --- a/src/PrimitivesPlugin/Test/UnitTestBox.py +++ b/src/PrimitivesPlugin/Test/UnitTestBox.py @@ -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()