From: azv Date: Wed, 31 Oct 2018 11:33:08 +0000 (+0300) Subject: Update unit tests for GeomAPI module X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=efd4884d10b02815763fb12680bbc88a20249953;p=modules%2Fshaper.git Update unit tests for GeomAPI module --- diff --git a/src/GeomAPI/Test/Test2675.py b/src/GeomAPI/Test/Test2675.py index d1c6fae9c..2af1a04a9 100644 --- a/src/GeomAPI/Test/Test2675.py +++ b/src/GeomAPI/Test/Test2675.py @@ -77,8 +77,8 @@ SketchConstraintDistance_3 = Sketch_1.setDistance(SketchCircle_2.center(), Sketc SketchConstraintCoincidence_15 = Sketch_1.setCoincident(SketchPoint_2.coordinates(), SketchCircle_1.results()[1]) SketchConstraintDistance_4 = Sketch_1.setDistance(SketchCircle_1.center(), SketchLine_2.endPoint(), 325) model.do() -Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_2_2f-SketchLine_7r")], model.selection("EDGE", "PartSet/OZ"), 360, 0) -Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Revolution_1_1/Generated_Face_1")]) +Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_2_2f-SketchCircle_2_2f-SketchLine_7r")], model.selection("EDGE", "PartSet/OZ"), 360, 0) +Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_1/SketchLine_7")]) from GeomAPI import * diff --git a/src/GeomAPI/Test/TestBox.py b/src/GeomAPI/Test/TestBox.py index a8412a4cd..32948b25a 100644 --- a/src/GeomAPI/Test/TestBox.py +++ b/src/GeomAPI/Test/TestBox.py @@ -91,7 +91,7 @@ ParamHeight = model.addParameter(Part_1_doc, "Height", "25") ParamAngle = model.addParameter(Part_1_doc, "Angle", "30") Box_1 = model.addBox(Part_1_doc, "BoxSize", "BoxSize", "BoxSize") Sketch_1 = model.addSketch(Part_1_doc, model.selection("FACE", "Box_1_1/Top")) -SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "Box_1_1/Front&Box_1_1/Right&Box_1_1/Top"), False) +SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "[Box_1_1/Front][Box_1_1/Right][Box_1_1/Top]"), False) SketchPoint_1 = SketchProjection_1.createdFeature() SketchLine_1 = Sketch_1.addLine(30, 10, 10, 10) SketchLine_2 = Sketch_1.addLine(10, 10, 10, 20) @@ -109,7 +109,7 @@ SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_4.result()) SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_1.result(), "Width") SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_2.result(), "Depth") model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_2r-SketchLine_3r-SketchLine_4r")], model.selection(), "Height", 0) +Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r")], model.selection(), "Height", 0) model.do() # Test 1. Check boxes @@ -119,13 +119,13 @@ aCornerPara = GeomAPI.GeomAPI_Pnt(ParamSize.value(), ParamSize.value(), ParamSiz checkBox(Extrusion_1, aCornerPara, ParamWidth.value(), ParamDepth.value(), ParamHeight.value()) # Test 2. Rotate box to keep it still axes-aligned -Rotation_1 = model.addRotation(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1")], model.selection("EDGE", "Extrusion_1_1/Generated_Face_4&Extrusion_1_1/Generated_Face_1"), 90) +Rotation_1 = model.addRotation(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1")], model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1]"), 90) aCornerPara.setX(aCornerPara.x() + ParamWidth.value() - ParamDepth.value()) aCornerPara.setY(aCornerPara.y() - ParamWidth.value()) checkBox(Rotation_1, aCornerPara, ParamDepth.value(), ParamWidth.value(), ParamHeight.value()) # Test 3. Rotate boxes -Axis_4 = model.addAxis(Part_1_doc, model.selection("VERTEX", "Box_1_1/Back&Box_1_1/Left&Box_1_1/Bottom"), model.selection("VERTEX", "Box_1_1/Front&Box_1_1/Right&Box_1_1/Top")) +Axis_4 = model.addAxis(Part_1_doc, model.selection("VERTEX", "[Box_1_1/Back][Box_1_1/Left][Box_1_1/Bottom]"), model.selection("VERTEX", "[Box_1_1/Front][Box_1_1/Right][Box_1_1/Top]")) Rotation_2 = model.addRotation(Part_1_doc, [model.selection("SOLID", "Box_1_1")], model.selection("EDGE", "Axis_1"), "Angle") Rotation_3 = model.addRotation(Part_1_doc, [model.selection("SOLID", "Rotation_1_1")], model.selection("EDGE", "Axis_1"), "Angle") @@ -155,11 +155,11 @@ aCornerPara1 = GeomAPI.GeomAPI_Pnt(aCornerPara1.x() * (aCosAngle + (1 - aCosAngl checkRotatedBox(Rotation_3, aCornerPara, aCornerPara1) # Test 4. Compose a non-closed shell of the box faces and check it is not a box -Shell_objects = ["Rotation_3_1/Rotated_Face_1", "Rotation_3_1/Rotated_Face_2", "Rotation_3_1/Rotated_Face_3", "Rotation_3_1/Rotated_Face_4"] +Shell_objects = ["Rotation_3_1/MF:Rotated&Extrusion_1_1/To_Face", "Rotation_3_1/MF:Rotated&Extrusion_1_1/From_Face", "Rotation_3_1/MF:Rotated&Sketch_1/SketchLine_1", "Rotation_3_1/MF:Rotated&Sketch_1/SketchLine_2"] checkShellNotBox(Part_1_doc, Shell_objects) # Test 5. Compose a shell of all box faces -Shell_objects = ["Rotation_3_1/Rotated_Face_1", "Rotation_3_1/Rotated_Face_2", "Rotation_3_1/Rotated_Face_3", "Rotation_3_1/Rotated_Face_4", "Rotation_3_1/Rotated_Face_5", "Rotation_3_1/Rotated_Face_6"] +Shell_objects = ["Rotation_3_1/MF:Rotated&Extrusion_1_1/To_Face", "Rotation_3_1/MF:Rotated&Extrusion_1_1/From_Face", "Rotation_3_1/MF:Rotated&Sketch_1/SketchLine_1", "Rotation_3_1/MF:Rotated&Sketch_1/SketchLine_2", "Rotation_3_1/MF:Rotated&Sketch_1/SketchLine_3", "Rotation_3_1/MF:Rotated&Sketch_1/SketchLine_4"] checkShellRotatedBox(Part_1_doc, Shell_objects, aCornerPara, aCornerPara1) model.end() diff --git a/src/GeomAPI/Test/TestCone.py b/src/GeomAPI/Test/TestCone.py index 2c74a1955..7c92fb34d 100644 --- a/src/GeomAPI/Test/TestCone.py +++ b/src/GeomAPI/Test/TestCone.py @@ -153,10 +153,10 @@ anApex = GeomAPI.GeomAPI_Pnt(0, 0, ParamR1.value() / math.tan(aSemiAngle)) anAxis = GeomAPI.GeomAPI_Dir(0, 0, 1) checkConeAll(Part_1_doc, Cone_1, "Cone_1_1/Face_1", anApex, anAxis, aSemiAngle, ParamR2.value(), ParamR1.value(), ParamH.value()) checkCircleFace(Part_1_doc, "Cone_1_1/Face_2", GeomAPI.GeomAPI_Pnt(0, 0, ParamH.value()), ParamR2.value()) -checkCircleEdge(Part_1_doc, "Cone_1_1/Face_1&Cone_1_1/Face_2", GeomAPI.GeomAPI_Pnt(0, 0, ParamH.value()), ParamR2.value()) +checkCircleEdge(Part_1_doc, "[Cone_1_1/Face_1][Cone_1_1/Face_2]", GeomAPI.GeomAPI_Pnt(0, 0, ParamH.value()), ParamR2.value()) checkCircleFace(Part_1_doc, "Cone_1_1/Face_3", GeomAPI.GeomAPI_Pnt(0, 0, 0), ParamR1.value()) -checkCircleEdge(Part_1_doc, "Cone_1_1/Face_1&Cone_1_1/Face_3", GeomAPI.GeomAPI_Pnt(0, 0, 0), ParamR1.value()) -checkSegment(Part_1_doc, "Cone_1_1/Face_1", GeomAPI.GeomAPI_Pnt(ParamR1.value(), 0, 0), GeomAPI.GeomAPI_Pnt(ParamR2.value(), 0, ParamH.value())) +checkCircleEdge(Part_1_doc, "[Cone_1_1/Face_1][Cone_1_1/Face_3]", GeomAPI.GeomAPI_Pnt(0, 0, 0), ParamR1.value()) +checkSegment(Part_1_doc, "[Cone_1_1/Face_1][weak_name_3]", GeomAPI.GeomAPI_Pnt(ParamR1.value(), 0, 0), GeomAPI.GeomAPI_Pnt(ParamR2.value(), 0, ParamH.value())) # Test 2. Update cone radii ParamR1.setValue(0) @@ -165,8 +165,8 @@ aSemiAngle = semiAngle(ParamR1.value(), ParamR2.value(), ParamH.value()) anApex.setZ(0) checkConeAll(Part_1_doc, Cone_1, "Cone_1_1/Face_1", anApex, anAxis, aSemiAngle, ParamR1.value(), ParamR2.value(), ParamH.value()) checkCircleFace(Part_1_doc, "Cone_1_1/Face_2", GeomAPI.GeomAPI_Pnt(0, 0, ParamH.value()), ParamR2.value()) -checkCircleEdge(Part_1_doc, "Cone_1_1/Face_1&Cone_1_1/Face_2", GeomAPI.GeomAPI_Pnt(0, 0, ParamH.value()), ParamR2.value()) -checkSegment(Part_1_doc, "Cone_1_1/Face_1", GeomAPI.GeomAPI_Pnt(0, 0, 0), GeomAPI.GeomAPI_Pnt(ParamR2.value(), 0, ParamH.value())) +checkCircleEdge(Part_1_doc, "[Cone_1_1/Face_1][Cone_1_1/Face_2]", GeomAPI.GeomAPI_Pnt(0, 0, ParamH.value()), ParamR2.value()) +checkSegment(Part_1_doc, "[Cone_1_1/Face_1][weak_name_3]", GeomAPI.GeomAPI_Pnt(0, 0, 0), GeomAPI.GeomAPI_Pnt(ParamR2.value(), 0, ParamH.value())) checkVertex(Part_1_doc, "Cone_1_1/Vertex_2", GeomAPI.GeomAPI_Pnt(0, 0, 0)) ParamR2.setValue(50) @@ -176,20 +176,20 @@ aSemiAngle = semiAngle(ParamR1.value(), ParamR2.value(), ParamH.value()) anApex.setZ(-ParamR1.value() / math.tan(aSemiAngle)) checkConeAll(Part_1_doc, Cone_1, "Cone_1_1/Face_1", anApex, anAxis, aSemiAngle, ParamR1.value(), ParamR2.value(), ParamH.value()) checkCircleFace(Part_1_doc, "Cone_1_1/Face_2", GeomAPI.GeomAPI_Pnt(0, 0, ParamH.value()), ParamR2.value()) -checkCircleEdge(Part_1_doc, "Cone_1_1/Face_1&Cone_1_1/Face_2", GeomAPI.GeomAPI_Pnt(0, 0, ParamH.value()), ParamR2.value()) +checkCircleEdge(Part_1_doc, "[Cone_1_1/Face_1][Cone_1_1/Face_2]", GeomAPI.GeomAPI_Pnt(0, 0, ParamH.value()), ParamR2.value()) checkCircleFace(Part_1_doc, "Cone_1_1/Face_3", GeomAPI.GeomAPI_Pnt(0, 0, 0), ParamR1.value()) -checkCircleEdge(Part_1_doc, "Cone_1_1/Face_1&Cone_1_1/Face_3", GeomAPI.GeomAPI_Pnt(0, 0, 0), ParamR1.value()) -checkSegment(Part_1_doc, "Cone_1_1/Face_1", GeomAPI.GeomAPI_Pnt(ParamR1.value(), 0, 0), GeomAPI.GeomAPI_Pnt(ParamR2.value(), 0, ParamH.value())) +checkCircleEdge(Part_1_doc, "[Cone_1_1/Face_1][Cone_1_1/Face_3]", GeomAPI.GeomAPI_Pnt(0, 0, 0), ParamR1.value()) +checkSegment(Part_1_doc, "[Cone_1_1/Face_1][weak_name_3]", GeomAPI.GeomAPI_Pnt(ParamR1.value(), 0, 0), GeomAPI.GeomAPI_Pnt(ParamR2.value(), 0, ParamH.value())) # Test 3. Translate cone Translation_1 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Cone_1_1")], model.selection("EDGE", "PartSet/OX"), "Shift") anApex.setX(anApex.x() + ParamShift.value()) -checkConeAll(Part_1_doc, Translation_1, "Translation_1_1/Translated_Face_3", anApex, anAxis, aSemiAngle, ParamR1.value(), ParamR2.value(), ParamH.value()) -checkCircleFace(Part_1_doc, "Translation_1_1/Translated_Face_2", GeomAPI.GeomAPI_Pnt(ParamShift.value(), 0, ParamH.value()), ParamR2.value()) -checkCircleEdge(Part_1_doc, "Translation_1_1/Translated_Face_3&Translation_1_1/Translated_Face_2", GeomAPI.GeomAPI_Pnt(ParamShift.value(), 0, ParamH.value()), ParamR2.value()) -checkCircleFace(Part_1_doc, "Translation_1_1/Translated_Face_1", GeomAPI.GeomAPI_Pnt(ParamShift.value(), 0, 0), ParamR1.value()) -checkCircleEdge(Part_1_doc, "Translation_1_1/Translated_Face_3&Translation_1_1/Translated_Face_1", GeomAPI.GeomAPI_Pnt(ParamShift.value(), 0, 0), ParamR1.value()) -checkSegment(Part_1_doc, "Translation_1_1/Translated_Face_3", GeomAPI.GeomAPI_Pnt(ParamR1.value() + ParamShift.value(), 0, 0), GeomAPI.GeomAPI_Pnt(ParamR2.value() + ParamShift.value(), 0, ParamH.value())) +checkConeAll(Part_1_doc, Translation_1, "Translation_1_1/MF:Translated&Cone_1_1/Face_1", anApex, anAxis, aSemiAngle, ParamR1.value(), ParamR2.value(), ParamH.value()) +checkCircleFace(Part_1_doc, "Translation_1_1/MF:Translated&Cone_1_1/Face_2", GeomAPI.GeomAPI_Pnt(ParamShift.value(), 0, ParamH.value()), ParamR2.value()) +checkCircleEdge(Part_1_doc, "[Translation_1_1/MF:Translated&Cone_1_1/Face_1][Translation_1_1/MF:Translated&Cone_1_1/Face_2]", GeomAPI.GeomAPI_Pnt(ParamShift.value(), 0, ParamH.value()), ParamR2.value()) +checkCircleFace(Part_1_doc, "Translation_1_1/MF:Translated&Cone_1_1/Face_3", GeomAPI.GeomAPI_Pnt(ParamShift.value(), 0, 0), ParamR1.value()) +checkCircleEdge(Part_1_doc, "[Translation_1_1/MF:Translated&Cone_1_1/Face_1][Translation_1_1/MF:Translated&Cone_1_1/Face_3]", GeomAPI.GeomAPI_Pnt(ParamShift.value(), 0, 0), ParamR1.value()) +checkSegment(Part_1_doc, "[Translation_1_1/MF:Translated&Cone_1_1/Face_1][weak_name_3]", GeomAPI.GeomAPI_Pnt(ParamR1.value() + ParamShift.value(), 0, 0), GeomAPI.GeomAPI_Pnt(ParamR2.value() + ParamShift.value(), 0, ParamH.value())) # Test 4. Rotate cone Rotation_1 = model.addRotation(Part_1_doc, [model.selection("SOLID", "Translation_1_1")], model.selection("EDGE", "PartSet/OY"), "Angle") @@ -198,24 +198,24 @@ anAxis = GeomAPI.GeomAPI_Dir(math.sin(anAngle), 0, math.cos(anAngle)) x, z = anApex.x(), anApex.z() anApex.setX(x * math.cos(anAngle) + z * math.sin(anAngle)) anApex.setZ(-x * math.sin(anAngle) + z * math.cos(anAngle)) -checkConeAll(Part_1_doc, Rotation_1, "Rotation_1_1/Rotated_Face_3", anApex, anAxis, aSemiAngle, ParamR1.value(), ParamR2.value(), ParamH.value()) +checkConeAll(Part_1_doc, Rotation_1, "Rotation_1_1/MF:Rotated&Cone_1_1/Face_1", anApex, anAxis, aSemiAngle, ParamR1.value(), ParamR2.value(), ParamH.value()) aCenter = GeomAPI.GeomAPI_Pnt(ParamShift.value() * math.cos(anAngle) + ParamH.value() * math.sin(anAngle), 0, -ParamShift.value() * math.sin(anAngle) + ParamH.value() * math.cos(anAngle)) -checkCircleFace(Part_1_doc, "Rotation_1_1/Rotated_Face_2", aCenter, ParamR2.value()) -checkCircleEdge(Part_1_doc, "Rotation_1_1/Rotated_Face_3&Rotation_1_1/Rotated_Face_2", aCenter, ParamR2.value()) +checkCircleFace(Part_1_doc, "Rotation_1_1/MF:Rotated&Cone_1_1/Face_2", aCenter, ParamR2.value()) +checkCircleEdge(Part_1_doc, "[Rotation_1_1/MF:Rotated&Cone_1_1/Face_1][Rotation_1_1/MF:Rotated&Cone_1_1/Face_2]", aCenter, ParamR2.value()) aCenter = GeomAPI.GeomAPI_Pnt(ParamShift.value() * math.cos(anAngle), 0, -ParamShift.value() * math.sin(anAngle)) -checkCircleFace(Part_1_doc, "Rotation_1_1/Rotated_Face_1", aCenter, ParamR1.value()) -checkCircleEdge(Part_1_doc, "Rotation_1_1/Rotated_Face_3&Rotation_1_1/Rotated_Face_1", aCenter, ParamR1.value()) +checkCircleFace(Part_1_doc, "Rotation_1_1/MF:Rotated&Cone_1_1/Face_3", aCenter, ParamR1.value()) +checkCircleEdge(Part_1_doc, "[Rotation_1_1/MF:Rotated&Cone_1_1/Face_1][Rotation_1_1/MF:Rotated&Cone_1_1/Face_3]", aCenter, ParamR1.value()) # Test 5. Split cone by plane and check conical shell and elliptic face Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "PartSet/YOZ"), 20, False) Partition_1 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Rotation_1_1"), model.selection("FACE", "Plane_1")]) -checkConeShell(Part_1_doc, ["Partition_1_1_1/Modified_Face_2_2", "Partition_1_1_2/Modified_Face_2_2"], anApex, anAxis, aSemiAngle, ParamR1.value(), ParamR2.value(), ParamH.value()) +checkConeShell(Part_1_doc, ["Partition_1_1_1/Modified_Face&Cone_1_1/Face_1", "Partition_1_1_2/Modified_Face&Cone_1_1/Face_1"], anApex, anAxis, aSemiAngle, ParamR1.value(), ParamR2.value(), ParamH.value()) aFirstFocus = GeomAPI.GeomAPI_Pnt(20, 0, 31.062397266842858) aSecondFocus = GeomAPI.GeomAPI_Pnt(20, 0, -1.0935246846933797) aMajorRadius = 27.91915871311068 aMinorRadius = 22.824955511666207 -checkEllipseFace(Part_1_doc, "Partition_1_1_2/Modified_Face_2_1", aFirstFocus, aSecondFocus, aMajorRadius, aMinorRadius) -checkEllipseEdge(Part_1_doc, "Partition_1_1_1/Modified_Face_1_divided_1_e_1", aFirstFocus, aSecondFocus, aMajorRadius, aMinorRadius) +checkEllipseFace(Part_1_doc, "_weak_name_1_Partition_1_1_2", aFirstFocus, aSecondFocus, aMajorRadius, aMinorRadius) +checkEllipseEdge(Part_1_doc, "Partition_1_1_1/Generated_Edge&Cone_1_1/Face_1", aFirstFocus, aSecondFocus, aMajorRadius, aMinorRadius) model.end() diff --git a/src/GeomAPI/Test/TestCylinder.py b/src/GeomAPI/Test/TestCylinder.py index 726b837fa..c423f72e1 100644 --- a/src/GeomAPI/Test/TestCylinder.py +++ b/src/GeomAPI/Test/TestCylinder.py @@ -76,7 +76,7 @@ ParamR = model.addParameter(Part_1_doc, "R", "10") ParamAngle = model.addParameter(Part_1_doc, "Angle", "30") Cylinder_1 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), "2*R", "H") Sketch_1 = model.addSketch(Part_1_doc, model.selection("FACE", "Cylinder_1_1/Face_2")) -SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "Cylinder_1_1/Face_1&Cylinder_1_1/Face_2__cc"), False) +SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "[Cylinder_1_1/Face_1][Cylinder_1_1/Face_2]__cc"), False) SketchPoint_1 = SketchProjection_1.createdFeature() SketchCircle_1 = Sketch_1.addCircle(0, 0, 10) SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchPoint_1.result(), SketchCircle_1.center()) @@ -98,14 +98,14 @@ SketchConstraintHorizontal_2 = Sketch_2.setHorizontal(SketchLine_3.result()) SketchConstraintVertical_2 = Sketch_2.setVertical(SketchLine_4.result()) SketchConstraintLength_1 = Sketch_2.setLength(SketchLine_1.result(), "R/2") SketchConstraintLength_2 = Sketch_2.setLength(SketchLine_2.result(), "H") -SketchIntersectionPoint_1 = Sketch_2.addIntersectionPoint(model.selection("EDGE", "Extrusion_1_1/Generated_Face_1&Extrusion_1_1/To_Face_1"), False) +SketchIntersectionPoint_1 = Sketch_2.addIntersectionPoint(model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1/To_Face]"), False) [SketchPoint_2, SketchPoint_3] = SketchIntersectionPoint_1.intersectionPoints() SketchConstraintCoincidence_6 = Sketch_2.setCoincident(SketchAPI_Point(SketchPoint_2).coordinates(), SketchLine_1.result()) SketchProjection_2 = Sketch_2.addProjection(model.selection("EDGE", "PartSet/OZ"), False) SketchLine_5 = SketchProjection_2.createdFeature() SketchConstraintCoincidence_7 = Sketch_2.setCoincident(SketchLine_2.endPoint(), SketchLine_5.result()) model.do() -Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_1r-SketchLine_2r-SketchLine_3r-SketchLine_4r")], model.selection("EDGE", "PartSet/OZ"), 270, 0) +Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r")], model.selection("EDGE", "PartSet/OZ"), 270, 0) model.do() # Test 1. Check cylinders @@ -114,10 +114,10 @@ aLoc2 = GeomAPI.GeomAPI_Pnt(0, 0, 2 * ParamH.value()) aLoc3 = GeomAPI.GeomAPI_Pnt(0, 0, 3 * ParamH.value()) anAxis = GeomAPI.GeomAPI_Dir(0, 0, 1) checkCylinderAll(Part_1_doc, Cylinder_1, "Cylinder_1_1/Face_1", aLoc1, anAxis, 2 * ParamR.value(), ParamH.value()) -checkCylinderAll(Part_1_doc, Extrusion_1, "Extrusion_1_1/Generated_Face_1", aLoc2, anAxis, ParamR.value(), ParamH.value()) +checkCylinderAll(Part_1_doc, Extrusion_1, "Extrusion_1_1/Generated_Face&Sketch_1/SketchCircle_1_2", aLoc2, anAxis, ParamR.value(), ParamH.value()) checkNonCylinder(Revolution_1) -checkCylinderShell(Part_1_doc, ["Revolution_1_1/Generated_Face_4"], aLoc3, anAxis, 0.5 * ParamR.value(), ParamH.value()) -checkCylinderFace(Part_1_doc, "Revolution_1_1/Generated_Face_4", aLoc3, anAxis, 0.5 * ParamR.value(), ParamH.value()) +checkCylinderShell(Part_1_doc, ["Revolution_1_1/Generated_Face&Sketch_2/SketchLine_4"], aLoc3, anAxis, 0.5 * ParamR.value(), ParamH.value()) +checkCylinderFace(Part_1_doc, "Revolution_1_1/Generated_Face&Sketch_2/SketchLine_4", aLoc3, anAxis, 0.5 * ParamR.value(), ParamH.value()) # Test 2. Rotate cylinders Rotation_1 = model.addRotation(Part_1_doc, [model.selection("SOLID", "Cylinder_1_1")], model.selection("EDGE", "PartSet/OX"), "Angle") @@ -131,11 +131,11 @@ anAxis = GeomAPI.GeomAPI_Dir(0, anAxis.y() * aCosAngle - anAxis.z() * aSinAngle, aLoc1 = GeomAPI.GeomAPI_Pnt(0, aLoc1.y() * aCosAngle - aLoc1.z() * aSinAngle, aLoc1.y() * aSinAngle + aLoc1.z() * aCosAngle) aLoc2 = GeomAPI.GeomAPI_Pnt(0, aLoc2.y() * aCosAngle - aLoc2.z() * aSinAngle, aLoc2.y() * aSinAngle + aLoc2.z() * aCosAngle) aLoc3 = GeomAPI.GeomAPI_Pnt(0, aLoc3.y() * aCosAngle - aLoc3.z() * aSinAngle, aLoc3.y() * aSinAngle + aLoc3.z() * aCosAngle) -checkCylinderAll(Part_1_doc, Rotation_1, "Rotation_1_1/Rotated_Face_3", aLoc1, anAxis, 2 * ParamR.value(), ParamH.value()) -checkCylinderAll(Part_1_doc, Rotation_2, "Rotation_2_1/Rotated_Face_3", aLoc2, anAxis, ParamR.value(), ParamH.value()) +checkCylinderAll(Part_1_doc, Rotation_1, "Rotation_1_1/MF:Rotated&Cylinder_1_1/Face_1", aLoc1, anAxis, 2 * ParamR.value(), ParamH.value()) +checkCylinderAll(Part_1_doc, Rotation_2, "Rotation_2_1/MF:Rotated&Sketch_1/SketchCircle_1_2", aLoc2, anAxis, ParamR.value(), ParamH.value()) checkNonCylinder(Rotation_3) -checkCylinderShell(Part_1_doc, ["Rotation_3_1/Rotated_Face_5"], aLoc3, anAxis, 0.5 * ParamR.value(), ParamH.value()) -checkCylinderFace(Part_1_doc, "Rotation_3_1/Rotated_Face_5", aLoc3, anAxis, 0.5 * ParamR.value(), ParamH.value()) +checkCylinderShell(Part_1_doc, ["Rotation_3_1/MF:Rotated&Sketch_2/SketchLine_4"], aLoc3, anAxis, 0.5 * ParamR.value(), ParamH.value()) +checkCylinderFace(Part_1_doc, "Rotation_3_1/MF:Rotated&Sketch_2/SketchLine_4", aLoc3, anAxis, 0.5 * ParamR.value(), ParamH.value()) # Test 3. Split cylinder and compose a shell Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "PartSet/XOY"), "2.2*H", False) @@ -143,7 +143,9 @@ Plane_5 = model.addPlane(Part_1_doc, model.selection("FACE", "PartSet/XOZ"), "H" Partition_1_objects = [model.selection("SOLID", "Rotation_3_1"), model.selection("FACE", "Plane_1"), model.selection("FACE", "Plane_2")] Partition_1 = model.addPartition(Part_1_doc, Partition_1_objects) -Shell_1_objects = ["Partition_1_1_1/Modified_Face_3_5", "Partition_1_1_4/Modified_Face_3_3", "Partition_1_1_2/Modified_Face_1_divided_2_1"] +Shell_1_objects = ["Partition_1_1_1/Modified_Face&Sketch_2/SketchLine_4", + "Partition_1_1_4/Modified_Face&Sketch_2/SketchLine_4", + "(Partition_1_1_2/Modified_Face&Revolution_1_1/To_Face)(Partition_1_1_2/Modified_Face&Sketch_2/SketchLine_1)"] checkCylinderShell(Part_1_doc, Shell_1_objects, aLoc3, anAxis, 0.5 * ParamR.value(), ParamH.value()) model.end() diff --git a/src/GeomAPI/Test/TestPolygon.py b/src/GeomAPI/Test/TestPolygon.py index c05c38864..7f6600626 100644 --- a/src/GeomAPI/Test/TestPolygon.py +++ b/src/GeomAPI/Test/TestPolygon.py @@ -88,15 +88,15 @@ model.do() # Test 1. Check face/wire of box is a rectangle checkRectangleFace(Part_1_doc, "Box_1_1/Top") -Wire_edges = ["Box_1_1/Left&Box_1_1/Top", "Box_1_1/Front&Box_1_1/Top", "Box_1_1/Right&Box_1_1/Top", "Box_1_1/Back&Box_1_1/Top"] +Wire_edges = ["[Box_1_1/Left][Box_1_1/Top]", "[Box_1_1/Front][Box_1_1/Top]", "[Box_1_1/Right][Box_1_1/Top]", "[Box_1_1/Back][Box_1_1/Top]"] checkRectangleWire(Part_1_doc, Wire_edges) # Test 2. Build a polygon from edges -Wire_edges = ["Box_1_1/Left&Box_1_1/Bottom", "Box_1_1/Front&Box_1_1/Left", "Box_1_1/Left&Box_1_1/Top", "Box_1_1/Back&Box_1_1/Top", "Box_1_1/Right&Box_1_1/Top"] +Wire_edges = ["[Box_1_1/Left][Box_1_1/Bottom]", "[Box_1_1/Front][Box_1_1/Left]", "[Box_1_1/Left][Box_1_1/Top]", "[Box_1_1/Back][Box_1_1/Top]", "[Box_1_1/Right][Box_1_1/Top]"] checkPolygonWire(Part_1_doc, Wire_edges) # Test 3. Build a polygon from vertices -Poly_vertices = ["Box_1_1/Back&Box_1_1/Left&Box_1_1/Bottom", "Box_1_1/Front&Box_1_1/Left&Box_1_1/Bottom", "Box_1_1/Front&Box_1_1/Right&Box_1_1/Bottom", "Box_1_1/Front&Box_1_1/Right&Box_1_1/Top", "Box_1_1/Front&Box_1_1/Left&Box_1_1/Top", "Box_1_1/Back&Box_1_1/Right&Box_1_1/Top"] +Poly_vertices = ["[Box_1_1/Back][Box_1_1/Left][Box_1_1/Bottom]", "[Box_1_1/Front][Box_1_1/Left][Box_1_1/Bottom]", "[Box_1_1/Front][Box_1_1/Right][Box_1_1/Bottom]", "[Box_1_1/Front][Box_1_1/Right][Box_1_1/Top]", "[Box_1_1/Front][Box_1_1/Left][Box_1_1/Top]", "[Box_1_1/Back][Box_1_1/Right][Box_1_1/Top]"] checkPolyline(Part_1_doc, Poly_vertices) model.end() diff --git a/src/GeomAPI/Test/TestSphere.py b/src/GeomAPI/Test/TestSphere.py index 961ed55e1..1990fbc20 100644 --- a/src/GeomAPI/Test/TestSphere.py +++ b/src/GeomAPI/Test/TestSphere.py @@ -68,7 +68,9 @@ def checkSphereAll(theDocument, theFeature, theFaceName, theCenter, theRadius): checkSphereShell(theDocument, theFaceName, theCenter, theRadius) checkSphereFace(theDocument, theFaceName, theCenter, theRadius) - checkArc(theDocument, theFaceName, theCenter, theRadius) + + anArcName = "[" + theFaceName + "][weak_name_3]" + checkArc(theDocument, anArcName, theCenter, theRadius) model.begin() @@ -93,32 +95,32 @@ SketchConstraintRadius_1 = Sketch_1.setRadius(SketchArc_1.results()[1], "R") model.do() # Test 1. Compose sphere -Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchArc_1_2f-SketchLine_1f")], model.selection("EDGE", "Sketch_1/Edge-SketchLine_1"), "Aperture", 0) +Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchArc_1_2r-SketchLine_1f")], model.selection("EDGE", "Sketch_1/SketchLine_1"), "Aperture", 0) aCenter = GeomAPI.GeomAPI_Pnt(0, 0, 0) -checkSphereAll(Part_1_doc, Revolution_1, "Revolution_1_1/Generated_Face_2", aCenter, ParamR.value()) +checkSphereAll(Part_1_doc, Revolution_1, "Revolution_1_1/Generated_Face&Sketch_1/SketchArc_1_2", aCenter, ParamR.value()) # Test 2. Translate sphere Translation_1 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Revolution_1_1")], model.selection("EDGE", "PartSet/OX"), "Shift") aCenter.setX(aCenter.x() + ParamShift.value()) -checkSphereAll(Part_1_doc, Translation_1, "Translation_1_1/Translated_Face_1", aCenter, ParamR.value()) +checkSphereAll(Part_1_doc, Translation_1, "Translation_1_1/MF:Translated&Sketch_1/SketchArc_1_2", aCenter, ParamR.value()) # Test 3. Rotate sphere Rotation_1 = model.addRotation(Part_1_doc, [model.selection("SOLID", "Translation_1_1")], model.selection("EDGE", "PartSet/OY"), "Angle") anAngle = ParamAngle.value() * math.pi / 180.0 aCenter.setX(ParamShift.value() * math.cos(anAngle)) aCenter.setZ(-ParamShift.value() * math.sin(anAngle)) -checkSphereAll(Part_1_doc, Rotation_1, "Rotation_1_1/Rotated_Face_1", aCenter, ParamR.value()) +checkSphereAll(Part_1_doc, Rotation_1, "Rotation_1_1/MF:Rotated&Sketch_1/SketchArc_1_2", aCenter, ParamR.value()) # Test 4. Check result by changing parameters ParamR.setValue(100) model.do() -checkSphereAll(Part_1_doc, Rotation_1, "Rotation_1_1/Rotated_Face_1", aCenter, ParamR.value()) +checkSphereAll(Part_1_doc, Rotation_1, "Rotation_1_1/MF:Rotated&Sketch_1/SketchArc_1_2", aCenter, ParamR.value()) ParamAperture.setValue(270) model.do() -checkSphereFace(Part_1_doc, "Rotation_1_1/Rotated_Face_3", aCenter, ParamR.value()) -checkSphereShell(Part_1_doc, "Rotation_1_1/Rotated_Face_3", aCenter, ParamR.value()) -checkArc(Part_1_doc, "Rotation_1_1/Rotated_Face_3&Rotation_1_1/Rotated_Face_1", aCenter, ParamR.value()) -checkArc(Part_1_doc, "Rotation_1_1/Rotated_Face_3&Rotation_1_1/Rotated_Face_2", aCenter, ParamR.value()) +checkSphereFace(Part_1_doc, "Rotation_1_1/MF:Rotated&Sketch_1/SketchArc_1_2", aCenter, ParamR.value()) +checkSphereShell(Part_1_doc, "Rotation_1_1/MF:Rotated&Sketch_1/SketchArc_1_2", aCenter, ParamR.value()) +checkArc(Part_1_doc, "[Rotation_1_1/MF:Rotated&Sketch_1/SketchArc_1_2][Rotation_1_1/MF:Rotated&Revolution_1_1/From_Face]", aCenter, ParamR.value()) +checkArc(Part_1_doc, "[Rotation_1_1/MF:Rotated&Sketch_1/SketchArc_1_2][Rotation_1_1/MF:Rotated&Revolution_1_1/To_Face]", aCenter, ParamR.value()) model.end() diff --git a/src/GeomAPI/Test/TestTorus.py b/src/GeomAPI/Test/TestTorus.py index 25c7f3edc..a710df35b 100644 --- a/src/GeomAPI/Test/TestTorus.py +++ b/src/GeomAPI/Test/TestTorus.py @@ -84,12 +84,15 @@ aCosAngle = math.cos(anAngle) aSinAngle = math.sin(anAngle) aCenter = GeomAPI.GeomAPI_Pnt(0, aCenter.y() * aCosAngle - aCenter.z() * aSinAngle, aCenter.y() * aSinAngle + aCenter.z() * aCosAngle) anAxis = GeomAPI.GeomAPI_Dir(0, anAxis.y() * aCosAngle - anAxis.z() * aSinAngle, anAxis.y() * aSinAngle + anAxis.z() * aCosAngle) -checkTorusAll(Part_1_doc, Rotation_1, "Rotation_1_1/Rotated_Face_1", aCenter, anAxis, ParamRMax.value(), ParamRMin.value()) +checkTorusAll(Part_1_doc, Rotation_1, "Rotation_1_1/MF:Rotated&Torus_1_1/Face_1", aCenter, anAxis, ParamRMax.value(), ParamRMin.value()) # Test 3. Split torus and compose a shell Partition_1_objects = [model.selection("SOLID", "Rotation_1_1"), model.selection("FACE", "PartSet/YOZ"), model.selection("FACE", "PartSet/XOZ"), model.selection("FACE", "PartSet/XOY")] Partition_1 = model.addPartition(Part_1_doc, Partition_1_objects) -Shell_1_objects = ["Partition_1_1_6/Modified_Face_4_4", "Partition_1_1_7/Modified_Face_4_3", "Partition_1_1_7/Modified_Face_1_divided_2_1", "Partition_1_1_5/Modified_Face_4_4"] +Shell_1_objects = ["Partition_1_1_6/Modified_Face&Torus_1_1/Face_1", + "Partition_1_1_7/Modified_Face&Torus_1_1/Face_1&weak_name_2", + "Partition_1_1_7/Modified_Face&Torus_1_1/Face_1&weak_name_1", + "Partition_1_1_5/Modified_Face&Torus_1_1/Face_1"] checkTorusShell(Part_1_doc, Shell_1_objects, aCenter, anAxis, ParamRMax.value(), ParamRMin.value()) model.end()