]> SALOME platform Git repositories - modules/shaper.git/blobdiff - src/BuildPlugin/Test/TestSubShapes.py
Salome HOME
updated copyright message
[modules/shaper.git] / src / BuildPlugin / Test / TestSubShapes.py
index 5f6874641d3619fcdf99baa9b6b39159e00fbfae..5ecd81c73d52ee2a89e993fa98094cbb8445f877 100644 (file)
@@ -1,3 +1,22 @@
+# Copyright (C) 2014-2023  CEA, EDF
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+#
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+
 # Initialization of the test
 from ModelAPI import *
 from GeomDataAPI import *
@@ -8,8 +27,8 @@ import random
 
 def createPoint(theSketchFeature):
     aSketchPointFeature = theSketchFeature.addFeature("SketchPoint")
-    aPointCoordindates = geomDataAPI_Point2D(aSketchPointFeature.attribute("PointCoordindates"))
-    aPointCoordindates.setValue(random.uniform(0, 50), random.uniform(0, 50))
+    aPointCoordinates = geomDataAPI_Point2D(aSketchPointFeature.attribute("PointCoordinates"))
+    aPointCoordinates.setValue(random.uniform(0, 50), random.uniform(0, 50))
     return aSketchPointFeature
 
 def createLine(theSketchFeature):
@@ -115,7 +134,7 @@ aSession.startOperation()
 aSubShapesFeature = aPart.addFeature("SubShapes")
 aBaseShapeSelection = aSubShapesFeature.selection("base_shape")
 aBaseShapeSelection.setValue(aFaceResult, None)
-aSubShapesList = aSubShapesFeature.selectionList("sub_shapes")
+aSubShapesList = aSubShapesFeature.selectionList("subshapes")
 for aPoint in aPoints:
     aSubShapesList.append(aSketchResult, aPoint)
 aShapeExplorer = GeomAPI_ShapeExplorer(aSketchShape, GeomAPI_Shape.EDGE)
@@ -126,3 +145,24 @@ aSession.finishOperation()
 
 # Test results
 assert (len(aSubShapesFeature.results()) > 0)
+
+from salome.shaper import model
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
+SketchCircle_1 = Sketch_1.addCircle(-454.545454545455, 50.600343053173, 137.95899463189)
+SketchCircle_2 = Sketch_1.addCircle(-454.545454545455, 50.600343053173, 62.129572131303)
+SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchCircle_1.center(), SketchCircle_2.center())
+SketchPoint_1 = Sketch_1.addPoint(-490.566037735849, 50.600343053173)
+SketchPoint_2 = Sketch_1.addPoint(-423.670668953688, 50.600343053173)
+model.do()
+Face_1 = model.addFace(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchCircle_1_2")])
+Face_2 = model.addFace(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchCircle_2_2")])
+SubShapes_1 = model.addSubShapes(Part_1_doc, model.selection("FACE", "Face_1_1"), [model.selection("VERTEX", "Sketch_1/SketchPoint_1"), model.selection("VERTEX", "Sketch_1/SketchPoint_2")])
+SubShapes_1.setBaseShape(model.selection("FACE", "Face_2_1"))
+model.end()
+
+assert(model.checkPythonDump())