]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Fixed ConstructionPlugin tests.
authordbv <dbv@opencascade.com>
Thu, 1 Nov 2018 12:02:34 +0000 (15:02 +0300)
committermpv <mpv@opencascade.com>
Mon, 19 Nov 2018 08:45:52 +0000 (11:45 +0300)
src/ConstructionPlugin/Test/TestAxisCreation.py
src/ConstructionPlugin/Test/TestPoint_Edge.py
src/ConstructionPlugin/Test/TestPoint_GeometricalPropertyCenterOfCircle.py
src/ConstructionPlugin/Test/TestPoint_GeometricalPropertyCenterOfGravity.py
src/ConstructionPlugin/Test/TestPoint_IntersectLineAndPlane.py
src/ConstructionPlugin/Test/TestPoint_IntersectLines.py
src/ConstructionPlugin/Test/TestPoint_ProjectOnEdge.py
src/ConstructionPlugin/Test/TestPoint_ProjectOnFace.py
src/ConstructionPlugin/Test/TestPoint_VertexSelection.py

index 642d83bde2f2c73dccb4e13df86a46334d4eb885..c106b2dcbf2f7d5595ecaf451e1d1dccccbb8240 100644 (file)
@@ -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()
 
index 4f6c5ef88d3778e524a88c5f0ab5030bcb39c7d2..d7f0db6fcd3c14fbe9cdebaa30a014fa92c7914c 100644 (file)
@@ -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()))
index e08fa1158e6a2dad2b82438bb83ae1594ea28b40..57a34b5510ea45ffed5f9f8e03229c038b299a07 100644 (file)
@@ -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()))
index 933252369cc1a72db0c86021354c8bbb6707539f..d9a0a5b3819b54c4fe52b9e178b20d2a2ae911b0 100644 (file)
@@ -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()))
index 635ab81022712e7006f9cb2fb7e094be06f9ef2d..5ff71ee02fa813c05363b12a9e89aebdbf835401 100644 (file)
@@ -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()))
index f3b08471afcb13373e704090d330aa15934c9a02..239d4eadd3007404d11ea68aefe4f0792d2bd840 100644 (file)
@@ -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()))
index af44576ac973d54707d09c2608334c299f3f80c3..0bfe96d4bd6fb0d3d1d0250a114f05fda1b49981 100644 (file)
@@ -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()))
index 1b5218ea7caf9aaea793ef10e250bfde2d7095c3..0ed88039c048389216e7f7464265c2baa220f4f2 100644 (file)
@@ -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()))
index 8180742aa599c5960b67a217896c39f00f9da20f..de2e7b8c96c618bb9b8f9929a419caff59a05693 100644 (file)
 ## email : webmaster.salome@opencascade.com<mailto: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()))