From: jfa Date: Thu, 16 Mar 2023 15:33:58 +0000 (+0000) Subject: Porting Salome to OCCT 7.7.0 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=refs%2Fheads%2Fjfa%2FPorting_OCCT_770;p=modules%2Fshaper.git Porting Salome to OCCT 7.7.0 --- diff --git a/src/BuildPlugin/Test/Test20513_2.py b/src/BuildPlugin/Test/Test20513_2.py index 8250f78e4..98fb0e1ee 100644 --- a/src/BuildPlugin/Test/Test20513_2.py +++ b/src/BuildPlugin/Test/Test20513_2.py @@ -1129,7 +1129,7 @@ model.testNbSubShapes(Filling_2, GeomAPI_Shape.SOLID, [0]) model.testNbSubShapes(Filling_2, GeomAPI_Shape.FACE, [1]) model.testNbSubShapes(Filling_2, GeomAPI_Shape.EDGE, [4]) model.testNbSubShapes(Filling_2, GeomAPI_Shape.VERTEX, [8]) -model.testResultsAreas(Filling_2, [29.10364506]) +model.testResultsAreas(Filling_2, [29.09175882]) model.testNbResults(Filling_3, 1) model.testNbSubResults(Filling_3, [0]) @@ -1137,6 +1137,6 @@ model.testNbSubShapes(Filling_3, GeomAPI_Shape.SOLID, [0]) model.testNbSubShapes(Filling_3, GeomAPI_Shape.FACE, [1]) model.testNbSubShapes(Filling_3, GeomAPI_Shape.EDGE, [4]) model.testNbSubShapes(Filling_3, GeomAPI_Shape.VERTEX, [8]) -model.testResultsAreas(Filling_3, [30.744277238]) +model.testResultsAreas(Filling_3, [30.720017606]) assert(model.checkPythonDump()) diff --git a/src/FeaturesPlugin/Test/Test2918.py b/src/FeaturesPlugin/Test/Test2918.py index 02cc11877..17ad1d65c 100644 --- a/src/FeaturesPlugin/Test/Test2918.py +++ b/src/FeaturesPlugin/Test/Test2918.py @@ -237,8 +237,8 @@ model.do() Revolution_2 = model.addRevolution(Part_1_doc, [model.selection("WIRE", (3.862008317343538, 0, 11.38077471561056))], model.selection("EDGE", (3.241000000000025, 0, 11.62374600149389)), 360, 0) Revolution_3 = model.addRevolution(Part_1_doc, [model.selection("WIRE", (4.212769702413368, 0, 11.10430922268928))], model.selection("EDGE", (3.241000000000025, 0, 11.62374600149389)), 360, 0) Symmetry_1 = model.addSymmetry(Part_1_doc, [model.selection("SOLID", (3.237566604725065, 0, 11.61400119092393)), model.selection("SOLID", (3.223802337712571, 0, 11.57493485456337))], model.selection("FACE", "PartSet/YOZ"), True) -Cut_1 = model.addCut(Part_1_doc, [model.selection("SOLID", (-0.02393444277354109, 0, -2.580701826672493))], [model.selection("COMPOUND", (0, 0, 11.60508262087049))]) -Fuse_1 = model.addFuse(Part_1_doc, [model.selection("SOLID", (-0.0201067396659898, 0, -2.591493279115657)), model.selection("COMPOUND", (0, 0, 11.54608275997197))], removeEdges = True) +Cut_1 = model.addCut(Part_1_doc, [model.selection("SOLID", (0, 0, -2.5816942490967))], [model.selection("COMPOUND", (0, 0, 11.60508262087049))]) +Fuse_1 = model.addFuse(Part_1_doc, [model.selection("SOLID", (0, 0, -2.5923523532641)), model.selection("COMPOUND", (0, 0, 11.54608275997197))], removeEdges = True) Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "PartSet/XOY"), 3.6, False) Sketch_3 = model.addSketch(Part_1_doc, model.selection("FACE", (0, 0, 3.6))) SketchProjection_9 = Sketch_3.addProjection(model.selection("EDGE", (-6.188, 7.578114393123822e-16, -3.45)), True) @@ -310,10 +310,10 @@ model.do() Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", (0, 0, 1.2))], model.selection(), 10, 0) Rotation_1_objects = [model.selection("SOLID", (5, 1.166200656118862e-18, 1.2)), model.selection("SOLID", (6.049686362669476, 0, 1.5)), model.selection("SOLID", (6.320976310013338, 0, 1.5))] Rotation_1 = model.addRotation(Part_1_doc, Rotation_1_objects, model.selection("EDGE", "PartSet/OZ"), -90) -Fuse_2_objects_1 = [model.selection("SOLID", (-0.01517504751345233, 0, -2.581926283264175)), model.selection("SOLID", (0, -6.049686362669479, 1.5)), model.selection("SOLID", (0, -6.320976310013339, 1.5))] +Fuse_2_objects_1 = [model.selection("SOLID", (0, 0, -2.5825883331029)), model.selection("SOLID", (0, -6.049686362669479, 1.5)), model.selection("SOLID", (0, -6.320976310013339, 1.5))] Fuse_2 = model.addFuse(Part_1_doc, Fuse_2_objects_1) -Cut_2 = model.addCut(Part_1_doc, [model.selection("SOLID", (-0.01017608298903453, -0.03890028204629473, -2.562040714294322))], [model.selection("SOLID", (0, -5, 1.2))]) -FusionFaces_1 = model.addFusionFaces(Part_1_doc, model.selection("SOLID", (-0.008741742572144908, -0.03112823644757425, -2.568357186681257))) +Cut_2 = model.addCut(Part_1_doc, [model.selection("SOLID", (0, -0.0305282901284, -2.5624546739218))], [model.selection("SOLID", (0, -5, 1.2))]) +FusionFaces_1 = model.addFusionFaces(Part_1_doc, model.selection("SOLID", (0, -0.020170634783153, -2.5687034308941))) model.end() @@ -323,6 +323,6 @@ model.testNbSubShapes(FusionFaces_1, GeomAPI_Shape.SOLID, [1]) model.testNbSubShapes(FusionFaces_1, GeomAPI_Shape.FACE, [47]) model.testNbSubShapes(FusionFaces_1, GeomAPI_Shape.EDGE, [202]) model.testNbSubShapes(FusionFaces_1, GeomAPI_Shape.VERTEX, [404]) -model.testResultsVolumes(FusionFaces_1, [612.7268292882]) +model.testResultsVolumes(FusionFaces_1, [612.727466]) assert(model.checkPythonDump()) diff --git a/src/FeaturesPlugin/Test/TestExtrusionCut_ByPlanesAndOffsets.py b/src/FeaturesPlugin/Test/TestExtrusionCut_ByPlanesAndOffsets.py index 7d5dc8cbb..0ae4193a2 100644 --- a/src/FeaturesPlugin/Test/TestExtrusionCut_ByPlanesAndOffsets.py +++ b/src/FeaturesPlugin/Test/TestExtrusionCut_ByPlanesAndOffsets.py @@ -57,7 +57,7 @@ SketchConstraintCoincidence_2 = Sketch_2.setCoincident(SketchCircle_2.center(), ExtrusionCut_2.setNestedSketch(Sketch_2) model.do() Shape = ExtrusionCut_2.results()[0].resultSubShapePair()[0].shape() -checkMiddlePoint(Shape, 4.999955838, 4.99999192, 4.677925562) +checkMiddlePoint(Shape, 4.999955680, 4.99999176, 4.677925400) model.end() diff --git a/src/FeaturesPlugin/Test/TestExtrusionFuse_ByPlanesAndOffsets.py b/src/FeaturesPlugin/Test/TestExtrusionFuse_ByPlanesAndOffsets.py index d63b70050..95118dad7 100644 --- a/src/FeaturesPlugin/Test/TestExtrusionFuse_ByPlanesAndOffsets.py +++ b/src/FeaturesPlugin/Test/TestExtrusionFuse_ByPlanesAndOffsets.py @@ -57,7 +57,7 @@ SketchConstraintCoincidence_2 = Sketch_2.setCoincident(SketchCircle_2.center(), ExtrusionFuse_2.setNestedSketch(Sketch_2) model.do() Shape = ExtrusionFuse_2.results()[0].resultSubShapePair()[0].shape() -checkMiddlePoint(Shape, 4.97994427, 4.995857948, 4.254078314) +checkMiddlePoint(Shape, 4.97994444, 4.995858131, 4.254077951) model.end() diff --git a/src/FeaturesPlugin/Test/TestExtrusion_ByFaces11.py b/src/FeaturesPlugin/Test/TestExtrusion_ByFaces11.py index 70098021c..35d796a6a 100644 --- a/src/FeaturesPlugin/Test/TestExtrusion_ByFaces11.py +++ b/src/FeaturesPlugin/Test/TestExtrusion_ByFaces11.py @@ -75,9 +75,9 @@ model.testNbResults(Extrusion_1, 1) model.testNbSubResults(Extrusion_1, [2]) model.testNbSubShapes(Extrusion_1, GeomAPI_Shape.SOLID, [2]) model.testNbSubShapes(Extrusion_1, GeomAPI_Shape.FACE, [13]) -model.testNbSubShapes(Extrusion_1, GeomAPI_Shape.EDGE, [61]) -model.testNbSubShapes(Extrusion_1, GeomAPI_Shape.VERTEX, [122]) -model.testResultsVolumes(Extrusion_1, [41289.10946]) +model.testNbSubShapes(Extrusion_1, GeomAPI_Shape.EDGE, [59]) +model.testNbSubShapes(Extrusion_1, GeomAPI_Shape.VERTEX, [118]) +model.testResultsVolumes(Extrusion_1, [41289.17344]) # change radius of sketch circle and check failure ParamRCir.setValue(10) diff --git a/src/FeaturesPlugin/Test/TestFillet_MultiLevelCompound_v0_3.py b/src/FeaturesPlugin/Test/TestFillet_MultiLevelCompound_v0_3.py index ba18b999a..a4bc7738d 100644 --- a/src/FeaturesPlugin/Test/TestFillet_MultiLevelCompound_v0_3.py +++ b/src/FeaturesPlugin/Test/TestFillet_MultiLevelCompound_v0_3.py @@ -112,9 +112,7 @@ model.testNbSubShapes(Fillet_5, GeomAPI_Shape.FACE, [12]) model.testNbSubShapes(Fillet_5, GeomAPI_Shape.EDGE, [53]) model.testNbSubShapes(Fillet_5, GeomAPI_Shape.VERTEX, [106]) model.testResultsVolumes(Fillet_5, [976.519471836586]) -refPoint = GeomAPI_Pnt(54.98720346, 4.918055722, 4.987203302) -midPoint = Fillet_5.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +model.checkMiddlePoint(Fillet_5.defaultResult().shape(), 54.98720346, 4.918055722, 4.987203302) Fillet_6 = model.addFillet(Part_1_doc, [model.selection("EDGE", "[Partition_1_1_2/Modified_Face&Box_2_1/Top][Box_2_1/Front]"), model.selection("FACE", "Box_2_1/Right")], RADIUS_1, RADIUS_2) model.testNbResults(Fillet_6, 1) @@ -124,9 +122,7 @@ model.testNbSubShapes(Fillet_6, GeomAPI_Shape.FACE, [23]) model.testNbSubShapes(Fillet_6, GeomAPI_Shape.EDGE, [95]) model.testNbSubShapes(Fillet_6, GeomAPI_Shape.VERTEX, [190]) model.testResultsVolumes(Fillet_6, [1565.568094166]) -refPoint = GeomAPI_Pnt(2.7448, 2.7448, 5) -midPoint = Fillet_6.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +model.checkMiddlePoint(Fillet_6.defaultResult().shape(), 2.58156073, 2.58159465, 4.83676073) Fillet_7 = model.addFillet(Part_1_doc, [model.selection("EDGE", "[AngularCopy_1_1_1/MF:Rotated&Box_3_1/Back][AngularCopy_1_1_1/MF:Rotated&Box_3_1/Top]"), model.selection("FACE", "AngularCopy_1_1_2/MF:Rotated&Box_3_1/Left")], RADIUS_1, RADIUS_2) model.testNbResults(Fillet_7, 2) diff --git a/src/FeaturesPlugin/Test/TestFillet_MultiLevelCompound_v0_4.py b/src/FeaturesPlugin/Test/TestFillet_MultiLevelCompound_v0_4.py index 92fc42075..df8ca36fd 100644 --- a/src/FeaturesPlugin/Test/TestFillet_MultiLevelCompound_v0_4.py +++ b/src/FeaturesPlugin/Test/TestFillet_MultiLevelCompound_v0_4.py @@ -114,9 +114,7 @@ model.testNbSubShapes(Fillet_5, GeomAPI_Shape.FACE, [11]) model.testNbSubShapes(Fillet_5, GeomAPI_Shape.EDGE, [50]) model.testNbSubShapes(Fillet_5, GeomAPI_Shape.VERTEX, [100]) model.testResultsVolumes(Fillet_5, [976.068565925934]) -refPoint = GeomAPI_Pnt(55.0654360945, 5.015632459, 4.985518188) -midPoint = Fillet_5.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +model.checkMiddlePoint(Fillet_5.defaultResult().shape(), 55.0654360945, 5.015632459, 4.985518188) Recover_1 = model.addRecover(Part_1_doc, Fillet_5, [Compound_1.result()], True) Fillet_6 = model.addFillet(Part_1_doc, [model.selection("EDGE", "[Recover_1_1_7_2/Modified_Face&Box_2_1/Top][Recover_1_1_7_2/Modified_Face&Box_2_1/Front]"), model.selection("FACE", "Recover_1_1_7_2/Modified_Face&Box_2_1/Right")], RADIUS_1, RADIUS_2) @@ -127,9 +125,7 @@ model.testNbSubShapes(Fillet_6, GeomAPI_Shape.FACE, [23]) model.testNbSubShapes(Fillet_6, GeomAPI_Shape.EDGE, [95]) model.testNbSubShapes(Fillet_6, GeomAPI_Shape.VERTEX, [190]) model.testResultsVolumes(Fillet_6, [1565.568094166]) -refPoint = GeomAPI_Pnt(2.7448, 2.7448, 5) -midPoint = Fillet_6.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +model.checkMiddlePoint(Fillet_6.defaultResult().shape(), 2.58156073, 2.58159465, 4.83676073) Recover_2 = model.addRecover(Part_1_doc, Fillet_6, [Compound_1.result()], True) Fillet_7 = model.addFillet(Part_1_doc, [model.selection("EDGE", "[Recover_2_1_8_1/Modified_Face&Box_3_1/Back][Recover_2_1_8_1/Modified_Face&Box_3_1/Top]"), model.selection("FACE", "Recover_2_1_8_2/Modified_Face&Box_3_1/Left")], RADIUS_1, RADIUS_2) diff --git a/src/FeaturesPlugin/Test/TestFillet_MultiLevelCompound_v95_3.py b/src/FeaturesPlugin/Test/TestFillet_MultiLevelCompound_v95_3.py index a60997187..6f905b64c 100644 --- a/src/FeaturesPlugin/Test/TestFillet_MultiLevelCompound_v95_3.py +++ b/src/FeaturesPlugin/Test/TestFillet_MultiLevelCompound_v95_3.py @@ -112,9 +112,7 @@ model.testNbSubShapes(Fillet_5, GeomAPI_Shape.FACE, [12]) model.testNbSubShapes(Fillet_5, GeomAPI_Shape.EDGE, [53]) model.testNbSubShapes(Fillet_5, GeomAPI_Shape.VERTEX, [106]) model.testResultsVolumes(Fillet_5, [976.519471836586]) -refPoint = GeomAPI_Pnt(54.98720346, 4.918055722, 4.987203302) -midPoint = Fillet_5.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +model.checkMiddlePoint(Fillet_5.defaultResult().shape(), 54.98720346, 4.918055722, 4.987203302) Fillet_6 = model.addFillet(Part_1_doc, [model.selection("EDGE", "[Partition_1_1_2/Modified_Face&Box_2_1/Top][Box_2_1/Front]"), model.selection("FACE", "Box_2_1/Right")], RADIUS_1, RADIUS_2, keepSubResults = True) model.testNbResults(Fillet_6, 1) @@ -124,9 +122,7 @@ model.testNbSubShapes(Fillet_6, GeomAPI_Shape.FACE, [23]) model.testNbSubShapes(Fillet_6, GeomAPI_Shape.EDGE, [95]) model.testNbSubShapes(Fillet_6, GeomAPI_Shape.VERTEX, [190]) model.testResultsVolumes(Fillet_6, [1565.568094166]) -refPoint = GeomAPI_Pnt(2.7448, 2.7448, 5) -midPoint = Fillet_6.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +model.checkMiddlePoint(Fillet_6.defaultResult().shape(), 2.58156073, 2.58159465, 4.83676073) Fillet_7 = model.addFillet(Part_1_doc, [model.selection("EDGE", "[AngularCopy_1_1_1/MF:Rotated&Box_3_1/Back][AngularCopy_1_1_1/MF:Rotated&Box_3_1/Top]"), model.selection("FACE", "AngularCopy_1_1_2/MF:Rotated&Box_3_1/Left")], RADIUS_1, RADIUS_2, keepSubResults = True) model.testNbResults(Fillet_7, 1) @@ -136,9 +132,8 @@ model.testNbSubShapes(Fillet_7, GeomAPI_Shape.FACE, [23]) model.testNbSubShapes(Fillet_7, GeomAPI_Shape.EDGE, [98]) model.testNbSubShapes(Fillet_7, GeomAPI_Shape.VERTEX, [196]) model.testResultsVolumes(Fillet_7, [2976.0685684791988]) -refPoint = GeomAPI_Pnt(-20.9807621135, 42.806, 5) -midPoint = Fillet_7.defaultResult().shape().middlePoint() -assert(midPoint.distance(refPoint) < TOLERANCE) +model.checkMiddlePoint(Fillet_7.defaultResult().shape(), -20.9807621135, 42.806, 5) + model.end() model.begin() diff --git a/src/FeaturesPlugin/Test/TestFillet_MultiLevelCompound_v95_4.py b/src/FeaturesPlugin/Test/TestFillet_MultiLevelCompound_v95_4.py index d9c5835c8..24e9b8c09 100644 --- a/src/FeaturesPlugin/Test/TestFillet_MultiLevelCompound_v95_4.py +++ b/src/FeaturesPlugin/Test/TestFillet_MultiLevelCompound_v95_4.py @@ -142,7 +142,7 @@ VOLUME = 5565.117188528191 assertResult(Fillet_5) Fillet_6 = model.addFillet(Part_1_doc, [model.selection("EDGE", "[Compound_1_1_7_2/Modified_Face&Box_2_1/Top][Compound_1_1_7_2/Modified_Face&Box_2_1/Front]"), model.selection("FACE", "Compound_1_1_7_2/Modified_Face&Box_2_1/Right")], RADIUS_1, RADIUS_2, keepSubResults = True) -REFERENCE[6] = GeomAPI_Pnt(2.7448, 2.7448, 5) +REFERENCE[6] = GeomAPI_Pnt(2.58156073, 2.58159465, 4.83676073) NB_FACES += 6 NB_EDGES += 29 NB_VERTICES += 58 diff --git a/src/FeaturesPlugin/Test/TestRevolutionFuse_ByPlanesAndOffsets.py b/src/FeaturesPlugin/Test/TestRevolutionFuse_ByPlanesAndOffsets.py index 7c09c604d..552c6c8f9 100644 --- a/src/FeaturesPlugin/Test/TestRevolutionFuse_ByPlanesAndOffsets.py +++ b/src/FeaturesPlugin/Test/TestRevolutionFuse_ByPlanesAndOffsets.py @@ -44,7 +44,7 @@ SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.result(), Sk RevolutionFuse_1.setNestedSketch(Sketch_1) model.do() Shape = RevolutionFuse_1.results()[0].resultSubShapePair()[0].shape() -checkMiddlePoint(Shape, 5.000000277, 2.2088446592, 2.5458802675) +checkMiddlePoint(Shape, 5, 2.2080639645, 2.5532186547) RevolutionFuse_1.setPlanesAndOffsets(model.selection(), 0, model.selection("FACE", "Box_1_1/Bottom"), 0) model.do() diff --git a/src/FeaturesPlugin/Test/TestRevolutionFuse_ThroughAll.py b/src/FeaturesPlugin/Test/TestRevolutionFuse_ThroughAll.py index d4af62a64..13e32a063 100644 --- a/src/FeaturesPlugin/Test/TestRevolutionFuse_ThroughAll.py +++ b/src/FeaturesPlugin/Test/TestRevolutionFuse_ThroughAll.py @@ -53,7 +53,7 @@ RevolutionFuse_1.setNestedSketch(Sketch_1) model.do() Shape = RevolutionFuse_1.results()[0].resultSubShapePair()[0].shape() -checkMiddlePoint(Shape, 6.3892968486, 5.0, 6.3892968486) +checkMiddlePoint(Shape, 6.3943254561, 5.0, 6.3943306351) model.end() diff --git a/src/ModelHighAPI/Test/Test18451.py b/src/ModelHighAPI/Test/Test18451.py index b617f2cfa..ada271496 100644 --- a/src/ModelHighAPI/Test/Test18451.py +++ b/src/ModelHighAPI/Test/Test18451.py @@ -482,7 +482,7 @@ model.testNbSubShapes(Symmetry_2, GeomAPI_Shape.SOLID, [1]) model.testNbSubShapes(Symmetry_2, GeomAPI_Shape.FACE, [44]) model.testNbSubShapes(Symmetry_2, GeomAPI_Shape.EDGE, [192]) model.testNbSubShapes(Symmetry_2, GeomAPI_Shape.VERTEX, [384]) -model.testResultsVolumes(Symmetry_2, [0.714262940088946862715602037]) +model.testResultsVolumes(Symmetry_2, [0.71426763]) from ModelAPI import * aFactory = ModelAPI_Session.get().validators() diff --git a/src/PythonAPI/model/tests/tests.py b/src/PythonAPI/model/tests/tests.py index c944dadde..62a27838d 100644 --- a/src/PythonAPI/model/tests/tests.py +++ b/src/PythonAPI/model/tests/tests.py @@ -473,3 +473,14 @@ def checkFeaturesValidity(thePartDoc): assert error == '', "The feature {0} is in error: {1}".format(name, error) # raise an error if the the feature is not valid (without error message) assert aFactory.validate(feature), "The feature {0} is in error.".format(name) + +def checkMiddlePoint(theShape, theX, theY, theZ, theTolerance = 1.e-7): + """ Check coordinates of middle point of the given shape. + :param theShape the shape to check + :param theX, theY, theZ the expected coordinates + :param theTolerance comparison tolerance + """ + assert(theShape is not None) + midPoint = theShape.middlePoint() + isEqual = math.fabs(midPoint.x() - theX) < theTolerance and math.fabs(midPoint.y() - theY) < theTolerance and math.fabs(midPoint.z() - theZ) < theTolerance + assert(isEqual), "Middle point: actual ({}, {}, {}) != expected ({}, {}, {})".format(midPoint.x(), midPoint.y(), midPoint.z(), theX, theY, theZ)