Salome HOME
Copyright update 2020
[modules/shaper.git] / src / BuildPlugin / Test / TestFace.py
index 0dfab8afc6a57a3d72c2ce0cb4673395efe80000..f78512a855ee1a23c52d4c5a50623031697262e4 100644 (file)
@@ -1,22 +1,21 @@
-## Copyright (C) 2014-2017  CEA/DEN, EDF R&D
-##
-## 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<mailto:webmaster.salome@opencascade.com>
-##
+# Copyright (C) 2014-2020  CEA/DEN, EDF R&D
+#
+# 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 *
@@ -114,11 +113,21 @@ assert (len(aFaceFeature2.results()) > 0)
 # =============================================================================
 # Test 3. Create face from face of solid
 # =============================================================================
+aSession.startOperation()
+aCylinder = aPart.addFeature("Cylinder")
+aCylinder.string("CreationMethod").setValue("Cylinder")
+aCylinder.selection("base_point").selectSubShape("VERTEX", "PartSet/Origin")
+aCylinder.selection("axis").selectSubShape("EDGE", "PartSet/OZ")
+aCylinder.real("radius").setValue(5)
+aCylinder.real("height").setValue(10)
+aSession.finishOperation()
+aCylinderResult = aCylinder.firstResult()
+aCylinderShape = aCylinderResult.shape()
 
 aSession.startOperation()
 aFaceFeature3 = aPart.addFeature("Face")
 aBaseObjectsList = aFaceFeature3.selectionList("base_objects")
-aBaseObjectsList.append("Cylinder_1_1/Face_1", "FACE")
+aBaseObjectsList.append("Cylinder_2_1/Face_1", "FACE")
 aSession.finishOperation()
 assert (len(aFaceFeature3.results()) > 0)
 
@@ -126,6 +135,17 @@ assert (len(aFaceFeature3.results()) > 0)
 # Test 4. Verify error is reported if selection of face feature is mixed (edges and face)
 # =============================================================================
 
+aSession.startOperation()
+aCylinder = aPart.addFeature("Cylinder")
+aCylinder.string("CreationMethod").setValue("Cylinder")
+aCylinder.selection("base_point").selectSubShape("VERTEX", "PartSet/Origin")
+aCylinder.selection("axis").selectSubShape("EDGE", "PartSet/OZ")
+aCylinder.real("radius").setValue(5)
+aCylinder.real("height").setValue(10)
+aSession.finishOperation()
+aCylinderResult = aCylinder.firstResult()
+aCylinderShape = aCylinderResult.shape()
+
 aSession.startOperation()
 aFaceFeature4 = aPart.addFeature("Face")
 aBaseObjectsList = aFaceFeature4.selectionList("base_objects")
@@ -133,7 +153,7 @@ aShapeExplorer = GeomAPI_ShapeExplorer(aSketchShape, GeomAPI_Shape.EDGE)
 while aShapeExplorer.more():
     aBaseObjectsList.append(aSketchResult, aShapeExplorer.current())
     aShapeExplorer.next()
-aBaseObjectsList.append("Cylinder_1_1/Face_3", "FACE")
+aBaseObjectsList.append("Cylinder_3_1/Face_3", "FACE")
 aSession.finishOperation()
 assert (len(aFaceFeature4.results()) == 0)
 # remove failed feature