.
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])
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())
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)
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()
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())
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()
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()
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)
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)
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)
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)
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)
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)
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)
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()
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
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()
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()
-<<<<<<< HEAD
// Copyright (C) 2007-2024 CEA, EDF, OPEN CASCADE
-=======
-// Copyright (C) 2007-2023 CEA, EDF, OPEN CASCADE
->>>>>>> d24a43759... Porting to OCCT 7.8.0
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
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()
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)