From: dbv Date: Thu, 1 Nov 2018 12:02:34 +0000 (+0300) Subject: Fixed ConstructionPlugin tests. X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=c0986241e0f86eece665932aa0a9d2577b87a35c;p=modules%2Fshaper.git Fixed ConstructionPlugin tests. --- diff --git a/src/ConstructionPlugin/Test/TestAxisCreation.py b/src/ConstructionPlugin/Test/TestAxisCreation.py index 642d83bde..c106b2dcb 100644 --- a/src/ConstructionPlugin/Test/TestAxisCreation.py +++ b/src/ConstructionPlugin/Test/TestAxisCreation.py @@ -107,22 +107,15 @@ aSession.finishOperation() # Make extrusion on circle #========================================================================= # Build shape from sketcher results -aCircleSketchResult = aCircleSketchFeature.firstResult() -aCircleSketchEdges = modelAPI_ResultConstruction(aCircleSketchResult).shape() -origin = geomDataAPI_Point(aCircleSketchFeature.attribute("Origin")).pnt() -dirX = geomDataAPI_Dir(aCircleSketchFeature.attribute("DirX")).dir() -norm = geomDataAPI_Dir(aCircleSketchFeature.attribute("Norm")).dir() -aCircleSketchFaces = ShapeList() -GeomAlgoAPI_SketchBuilder.createFaces(origin, dirX, norm, aCircleSketchEdges, aCircleSketchFaces) -assert (len(aCircleSketchFaces) > 0) -assert (aCircleSketchFaces[0] is not None) +aCircleSketchResult = modelAPI_ResultConstruction(aCircleSketchFeature.firstResult()) +assert (aCircleSketchResult.facesNum() > 0) # Create extrusion aSession.startOperation() anExtrusionFt = aPart.addFeature("Extrusion") assert (anExtrusionFt.getKind() == "Extrusion") # selection type FACE=4 -anExtrusionFt.selectionList("base").append(aCircleSketchResult, aCircleSketchFaces[0]) +anExtrusionFt.selectionList("base").append(aCircleSketchResult, aCircleSketchResult.face(0)) anExtrusionFt.string("CreationMethod").setValue("BySizes") anExtrusionFt.real("to_size").setValue(100) anExtrusionFt.real("from_size").setValue(0) @@ -145,7 +138,7 @@ anAxisFeature = aPart.addFeature("Axis") anAxisFeatureData = anAxisFeature.data() assert(anAxisFeatureData is not None) anAxisFeatureData.string("CreationMethod").setValue("AxisByCylindricalFaceCase") -anAxisFeatureData.selection("CylindricalFace").selectSubShape("face", "Extrusion_1_1/Generated_Face_1") +anAxisFeatureData.selection("CylindricalFace").selectSubShape("face", "Extrusion_1_1/Generated_Face&Sketch_1/SketchCircle_1_2") anAxisFeature.execute() aSession.finishOperation() diff --git a/src/ConstructionPlugin/Test/TestPoint_Edge.py b/src/ConstructionPlugin/Test/TestPoint_Edge.py index 4f6c5ef88..d7f0db6fc 100644 --- a/src/ConstructionPlugin/Test/TestPoint_Edge.py +++ b/src/ConstructionPlugin/Test/TestPoint_Edge.py @@ -23,7 +23,6 @@ Test case for Construction Point feature by coordinates. """ from salome.shaper import model -from GeomAPI import * model.begin() partSet = model.moduleDocument() @@ -35,15 +34,17 @@ SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/O SketchPoint_1 = SketchProjection_1.createdFeature() SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchPoint_1.result()) model.do() -Point_2 = model.addPoint(Part_1_doc, model.selection("EDGE", "Sketch_1/Edge-SketchLine_1"), 50, False, False) -Point_3 = model.addPoint(Part_1_doc, model.selection("EDGE", "Sketch_1/Edge-SketchLine_1"), 0.4, True, False) -Point_4 = model.addPoint(Part_1_doc, model.selection("EDGE", "Sketch_1/Edge-SketchLine_1"), 0.4, True, True) +Point_2 = model.addPoint(Part_1_doc, model.selection("EDGE", "Sketch_1/SketchLine_1"), 50, False, False) +Point_3 = model.addPoint(Part_1_doc, model.selection("EDGE", "Sketch_1/SketchLine_1"), 0.4, True, False) +Point_4 = model.addPoint(Part_1_doc, model.selection("EDGE", "Sketch_1/SketchLine_1"), 0.4, True, True) Cylinder_1 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 50, 10) -Point_5 = model.addPoint(Part_1_doc, model.selection("EDGE", "Cylinder_1_1/Face_1&Cylinder_1_1/Face_2"), 0.25, True, False) -Point_6 = model.addPoint(Part_1_doc, model.selection("EDGE", "Cylinder_1_1/Face_1&Cylinder_1_1/Face_2"), 0.25, True, True) +Point_5 = model.addPoint(Part_1_doc, model.selection("EDGE", "[Cylinder_1_1/Face_1][Cylinder_1_1/Face_2]"), 0.25, True, False) +Point_6 = model.addPoint(Part_1_doc, model.selection("EDGE", "[Cylinder_1_1/Face_1][Cylinder_1_1/Face_2]"), 0.25, True, True) model.do() model.end() +from GeomAPI import GeomAPI_Vertex + assert (len(Point_2.results()) > 0) rightPosition = GeomAPI_Vertex(35.3553390593, 35.3553390593, 0) assert(rightPosition.isEqual(Point_2.results()[0].resultSubShapePair()[0].shape())) diff --git a/src/ConstructionPlugin/Test/TestPoint_GeometricalPropertyCenterOfCircle.py b/src/ConstructionPlugin/Test/TestPoint_GeometricalPropertyCenterOfCircle.py index e08fa1158..57a34b551 100644 --- a/src/ConstructionPlugin/Test/TestPoint_GeometricalPropertyCenterOfCircle.py +++ b/src/ConstructionPlugin/Test/TestPoint_GeometricalPropertyCenterOfCircle.py @@ -23,7 +23,6 @@ Test case for Construction Point feature by center of gravity. """ from salome.shaper import model -from GeomAPI import * model.begin() partSet = model.moduleDocument() @@ -34,12 +33,14 @@ SketchCircle_1 = Sketch_1.addCircle(-50, 25, 25) SketchArc_1 = Sketch_1.addArc(50, 25, 25, 25, 75, 25, True) model.do() Cylinder_1 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 10, 100) -Point_2 = model.addPoint(Part_1_doc, model.selection("EDGE", "Sketch_1/Edge-SketchCircle_1_2"), True) -Point_3 = model.addPoint(Part_1_doc, model.selection("EDGE", "Sketch_1/Edge-SketchArc_1_2"), True) -Point_4 = model.addPoint(Part_1_doc, model.selection("EDGE", "Cylinder_1_1/Face_1&Cylinder_1_1/Face_2"), True) +Point_2 = model.addPoint(Part_1_doc, model.selection("EDGE", "Sketch_1/SketchCircle_1_2"), True) +Point_3 = model.addPoint(Part_1_doc, model.selection("EDGE", "Sketch_1/SketchArc_1_2"), True) +Point_4 = model.addPoint(Part_1_doc, model.selection("EDGE", "[Cylinder_1_1/Face_1][Cylinder_1_1/Face_2]"), True) model.do() model.end() +from GeomAPI import GeomAPI_Vertex + assert (len(Point_2.results()) > 0) rightPosition = GeomAPI_Vertex(-50, 25, 0) assert(rightPosition.isEqual(Point_2.results()[0].resultSubShapePair()[0].shape())) diff --git a/src/ConstructionPlugin/Test/TestPoint_GeometricalPropertyCenterOfGravity.py b/src/ConstructionPlugin/Test/TestPoint_GeometricalPropertyCenterOfGravity.py index 933252369..d9a0a5b38 100644 --- a/src/ConstructionPlugin/Test/TestPoint_GeometricalPropertyCenterOfGravity.py +++ b/src/ConstructionPlugin/Test/TestPoint_GeometricalPropertyCenterOfGravity.py @@ -23,7 +23,6 @@ Test case for Construction Point feature by center of gravity. """ from salome.shaper import model -from GeomAPI import * model.begin() partSet = model.moduleDocument() @@ -37,10 +36,12 @@ Box_1 = model.addBox(Part_1_doc, 50, 50, 50) Point_2 = model.addPoint(Part_1_doc, model.selection("COMPOUND", "Sketch_1")) Point_3 = model.addPoint(Part_1_doc, model.selection("SOLID", "Box_1_1")) Point_4 = model.addPoint(Part_1_doc, model.selection("FACE", "Box_1_1/Top")) -Point_5 = model.addPoint(Part_1_doc, model.selection("EDGE", "Box_1_1/Left&Box_1_1/Top")) +Point_5 = model.addPoint(Part_1_doc, model.selection("EDGE", "[Box_1_1/Left][Box_1_1/Top]")) model.do() model.end() +from GeomAPI import GeomAPI_Vertex + assert (len(Point_2.results()) > 0) rightPosition = GeomAPI_Vertex(0, 0, 25) assert(rightPosition.isEqual(Point_2.results()[0].resultSubShapePair()[0].shape())) diff --git a/src/ConstructionPlugin/Test/TestPoint_IntersectLineAndPlane.py b/src/ConstructionPlugin/Test/TestPoint_IntersectLineAndPlane.py index 635ab8102..5ff71ee02 100644 --- a/src/ConstructionPlugin/Test/TestPoint_IntersectLineAndPlane.py +++ b/src/ConstructionPlugin/Test/TestPoint_IntersectLineAndPlane.py @@ -38,14 +38,14 @@ SketchArc_1 = Sketch_2.addArc(0, 0, -65.89631323066888, 61.2998850129882, -90, 0 model.do() # point by sketch face and a line -Point_1 = model.addPoint(partSet, model.selection("EDGE", "Sketch_2/Edge-SketchLine_1"), model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2f")) +Point_1 = model.addPoint(partSet, model.selection("EDGE", "Sketch_2/SketchLine_1"), model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2f")) model.do() # check the point position rightPosition = GeomAPI_Vertex(-15, 0, 0) assert(rightPosition.isEqual(Point_1.results()[0].resultSubShapePair()[0].shape())) # point by sketch face and an arc, intersection outside of the face, offset is defined -Point_2 = model.addPoint(partSet, model.selection("EDGE", "Sketch_2/Edge-SketchArc_1"), model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2f"), 10, True) +Point_2 = model.addPoint(partSet, model.selection("EDGE", "Sketch_2/SketchArc_1_2"), model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2f"), 10, True) # check the point position rightPosition = GeomAPI_Vertex(-89.442719099991606, 0, -10) assert(rightPosition.isEqual(Point_2.results()[0].resultSubShapePair()[0].shape())) diff --git a/src/ConstructionPlugin/Test/TestPoint_IntersectLines.py b/src/ConstructionPlugin/Test/TestPoint_IntersectLines.py index f3b08471a..239d4eadd 100644 --- a/src/ConstructionPlugin/Test/TestPoint_IntersectLines.py +++ b/src/ConstructionPlugin/Test/TestPoint_IntersectLines.py @@ -23,7 +23,6 @@ Test case for Construction Point feature by lines intersection. """ from salome.shaper import model -from GeomAPI import * model.begin() partSet = model.moduleDocument() @@ -35,11 +34,13 @@ SketchPoint_1 = SketchProjection_1.createdFeature() SketchLine_1 = Sketch_1.addLine(-50, 50, 50, 50) model.do() Box_1 = model.addBox(Part_1_doc, 25, 100, 100) -Point_2 = model.addPoint(Part_1_doc, model.selection("EDGE", "Box_1_1/Back&Box_1_1/Bottom"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_1")) -Point_3 = model.addPoint(Part_1_doc, model.selection("EDGE", "Sketch_1/Edge-SketchLine_1"), model.selection("EDGE", "Box_1_1/Front&Box_1_1/Bottom")) +Point_2 = model.addPoint(Part_1_doc, model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Bottom]"), model.selection("EDGE", "Sketch_1/SketchLine_1")) +Point_3 = model.addPoint(Part_1_doc, model.selection("EDGE", "Sketch_1/SketchLine_1"), model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Bottom]")) model.do() model.end() +from GeomAPI import GeomAPI_Vertex + assert (len(Point_2.results()) > 0) rightPosition = GeomAPI_Vertex(0, 50, 0) assert(rightPosition.isEqual(Point_2.results()[0].resultSubShapePair()[0].shape())) diff --git a/src/ConstructionPlugin/Test/TestPoint_ProjectOnEdge.py b/src/ConstructionPlugin/Test/TestPoint_ProjectOnEdge.py index af44576ac..0bfe96d4b 100644 --- a/src/ConstructionPlugin/Test/TestPoint_ProjectOnEdge.py +++ b/src/ConstructionPlugin/Test/TestPoint_ProjectOnEdge.py @@ -23,7 +23,6 @@ Test case for Construction Point feature by coordinates. """ from salome.shaper import model -from GeomAPI import * model.begin() partSet = model.moduleDocument() @@ -34,11 +33,13 @@ SketchCircle_1 = Sketch_1.addCircle(0, 0, 100) SketchPoint_1 = Sketch_1.addPoint(100, 100) model.do() Box_1 = model.addBox(Part_1_doc, 50, 50, 50) -Point_2 = model.addPoint(Part_1_doc, model.selection("VERTEX", "Sketch_1/Vertex-SketchPoint_1"), model.selection("EDGE", "Sketch_1/Edge-SketchCircle_1_2")) -Point_3 = model.addPoint(Part_1_doc, model.selection("VERTEX", "Sketch_1/Vertex-SketchPoint_1"), model.selection("EDGE", "Box_1_1/Front&Box_1_1/Right")) +Point_2 = model.addPoint(Part_1_doc, model.selection("VERTEX", "Sketch_1/SketchPoint_1"), model.selection("EDGE", "Sketch_1/SketchCircle_1_2")) +Point_3 = model.addPoint(Part_1_doc, model.selection("VERTEX", "Sketch_1/SketchPoint_1"), model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Right]")) model.do() model.end() +from GeomAPI import GeomAPI_Vertex + assert (len(Point_2.results()) > 0) rightPosition = GeomAPI_Vertex(70.7106781187, 70.7106781187, 0) assert(rightPosition.isEqual(Point_2.results()[0].resultSubShapePair()[0].shape())) diff --git a/src/ConstructionPlugin/Test/TestPoint_ProjectOnFace.py b/src/ConstructionPlugin/Test/TestPoint_ProjectOnFace.py index 1b5218ea7..0ed88039c 100644 --- a/src/ConstructionPlugin/Test/TestPoint_ProjectOnFace.py +++ b/src/ConstructionPlugin/Test/TestPoint_ProjectOnFace.py @@ -23,7 +23,6 @@ Test case for Construction Point feature by projection point on face. """ from salome.shaper import model -from GeomAPI import * model.begin() partSet = model.moduleDocument() @@ -33,11 +32,13 @@ Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOZ")) SketchPoint_1 = Sketch_1.addPoint(50, 50) model.do() Box_1 = model.addBox(Part_1_doc, 10, 100, 100) -Point_2 = model.addPoint(Part_1_doc, model.selection("VERTEX", "Sketch_1/Vertex-SketchPoint_1"), model.selection("FACE", "Box_1_1/Front")) -Point_3 = model.addPoint(Part_1_doc, model.selection("VERTEX", "Sketch_1/Vertex-SketchPoint_1"), model.selection("FACE", "PartSet/XOY")) +Point_2 = model.addPoint(Part_1_doc, model.selection("VERTEX", "Sketch_1/SketchPoint_1"), model.selection("FACE", "Box_1_1/Front")) +Point_3 = model.addPoint(Part_1_doc, model.selection("VERTEX", "Sketch_1/SketchPoint_1"), model.selection("FACE", "PartSet/XOY")) model.do() model.end() +from GeomAPI import GeomAPI_Vertex + assert (len(Point_2.results()) > 0) rightPosition = GeomAPI_Vertex(10, 0, 50) assert(rightPosition.isEqual(Point_2.results()[0].resultSubShapePair()[0].shape())) diff --git a/src/ConstructionPlugin/Test/TestPoint_VertexSelection.py b/src/ConstructionPlugin/Test/TestPoint_VertexSelection.py index 8180742aa..de2e7b8c9 100644 --- a/src/ConstructionPlugin/Test/TestPoint_VertexSelection.py +++ b/src/ConstructionPlugin/Test/TestPoint_VertexSelection.py @@ -18,18 +18,21 @@ ## email : webmaster.salome@opencascade.com ## +# -*- coding: utf-8 -*- + from salome.shaper import model -from GeomAPI import * model.begin() partSet = model.moduleDocument() Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Box_1 = model.addBox(Part_1_doc, 10, 10, 10) -Point_2 = model.addPoint(Part_1_doc, model.selection("VERTEX", "Box_1_1/Front&Box_1_1/Left&Box_1_1/Top")) +Point_2 = model.addPoint(Part_1_doc, 10, 0, 10) model.do() model.end() +from GeomAPI import GeomAPI_Vertex + assert (len(Point_2.results()) > 0) rightPosition = GeomAPI_Vertex(10, 0, 10) assert(rightPosition.isEqual(Point_2.results()[0].resultSubShapePair()[0].shape()))