Salome HOME
updated copyright message
[modules/shaper.git] / src / ModelAPI / Test / Test1064.py
index e4fb9291cad09331ec3d176bd0cb67ad3dc2dcb6..2546e32c5658b8f9542b96a74e044c8c1f628f4c 100644 (file)
@@ -1,7 +1,26 @@
+# Copyright (C) 2014-2023  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
+#
+
 """
       Test1064.py
       Unit test for testing the Part sub-shapes naming, described in the issue 1064
-      
+
 """
 #=========================================================================
 # Initialization of the test
@@ -9,6 +28,7 @@
 from ModelAPI import *
 from GeomDataAPI import *
 from GeomAlgoAPI import *
+from GeomAPI import *
 
 __updated__ = "2015-10-16"
 
@@ -50,14 +70,10 @@ aPart = aSession.activeDocument()
 #=========================================================================
 # Make extrusion on triangle
 #=========================================================================
-aSketchResult = aSketchFeature.firstResult()
-aSketchEdges = modelAPI_ResultConstruction(aSketchResult).shape()
-aSketchFaces = ShapeList()
-GeomAlgoAPI_SketchBuilder.createFaces(
-    origin.pnt(), dirx.dir(), norm.dir(), aSketchEdges, aSketchFaces)
+aSketchResult = modelAPI_ResultConstruction(aSketchFeature.firstResult())
 aSession.startOperation()
 anExtrusionFt = aPart.addFeature("Extrusion")
-anExtrusionFt.selectionList("base").append(aSketchResult, aSketchFaces[0])
+anExtrusionFt.selectionList("base").append(aSketchResult, aSketchResult.face(0))
 anExtrusionFt.string("CreationMethod").setValue("BySizes")
 anExtrusionFt.real("to_size").setValue(50)
 anExtrusionFt.real("from_size").setValue(0)
@@ -67,18 +83,20 @@ aSession.finishOperation()
 #=========================================================================
 # Make a plane in PartSet on lateral face of the Extrusion
 #=========================================================================
-aSession.startOperation()
+aSession.startOperation("Make Plane")
 aSession.setActiveDocument(aPartSet)
 aPlane = aPartSet.addFeature("Plane")
-aPlane.string("CreationMethod").setValue("PlaneByFaceAndDistance")
-aPlane.real("distance").setValue(0)
-aPlane.selection("planeFace").selectSubShape("face", "Part_1/Extrusion_1_1/LateralFace_3")
+aPlane.string("creation_method").setValue("by_other_plane")
+aPlane.string("by_other_plane_option").setValue("by_distance_from_other")
+aPlane.selection("plane").selectSubShape("face", "Part_1/_weak_name_5_Extrusion_1_1")
+aPlane.real("distance").setValue(0.001)
+aPlane.boolean("reverse").setValue(False)
 aSession.finishOperation()
 
 #=========================================================================
 # Update the sketch edges in order to update the plane on the lateral face automatically
 #=========================================================================
-aSession.startOperation()
+aSession.startOperation("UpdateLine")
 geomDataAPI_Point2D(aLine1.attribute("EndPoint")).setValue(400, 0)
 geomDataAPI_Point2D(aLine2.attribute("StartPoint")).setValue(400, 0)
 aSession.finishOperation()
@@ -102,3 +120,6 @@ assert(aPln.direction().z() == 0.)
 #=========================================================================
 # End of test
 #=========================================================================
+
+from salome.shaper import model
+assert(model.checkPythonDump())