Salome HOME
High level objects history implementation for Translation, Rotation and Scale features.
[modules/shaper.git] / src / FeaturesPlugin / Test / TestBooleanFill.py
index 26caead92fe1b5237149b15733c51da1a6470ffc..c181b37443318f5a35ee7f2c2b9970f3a6d0d9dd 100644 (file)
@@ -1,45 +1,42 @@
-"""
-Test case for Boolean Fill feature. Written on High API.
-"""
-from ModelAPI import *
-from GeomAPI import *
+## 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>
+##
 
-import model
+# -*- coding: utf-8 -*-
 
-# Get session
-aSession = ModelAPI_Session.get()
+from salome.shaper import model
 
-# Create a part
-aDocument = aSession.activeDocument()
-aSession.startOperation()
-model.addPart(aDocument)
-aDocument = aSession.activeDocument()
-aSession.finishOperation()
-
-# Create a sketch with circle to extrude
-aSession.startOperation()
-anOrigin = GeomAPI_Pnt(0, 0, 0)
-aDirX = GeomAPI_Dir(1, 0, 0)
-aNorm = GeomAPI_Dir(0, 0, 1)
-aCircleSketch = model.addSketch(aDocument, GeomAPI_Ax3(anOrigin, aDirX, aNorm))
-aCircleSketch.addCircle(0, 0, 50)
-aSession.finishOperation()
-
-# Create a sketch with triangle to extrude
-aSession.startOperation()
-aTriangleSketch = model.addSketch(aDocument, GeomAPI_Ax3(anOrigin, aDirX, aNorm))
-aTriangleSketch.addLine(25, 25, 100, 25)
-aTriangleSketch.addLine(100, 25, 60, 75)
-aTriangleSketch.addLine(60, 75, 25, 25)
-aSession.finishOperation()
-
-# Make extrusion on circle (cylinder) and triangle (prism)
-aSession.startOperation()
-anExtrusion = model.addExtrusion(aDocument, aCircleSketch.result() + aTriangleSketch.result(), 100)
-aSession.finishOperation()
-
-# Fill prism with cylinder
-aSession.startOperation()
-aBoolean = model.addFill(aDocument, [anExtrusion.result()[0]], [anExtrusion.result()[1]])
-assert (len(aBoolean.result()) > 0)
-aSession.finishOperation()
+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(0, 0, 50)
+model.do()
+Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
+SketchLine_1 = Sketch_2.addLine(25, 25, 100, 25)
+SketchLine_2 = Sketch_2.addLine(100, 25, 60, 75)
+SketchLine_3 = Sketch_2.addLine(60, 75, 25, 25)
+model.do()
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1"), model.selection("COMPOUND", "Sketch_2")], model.selection(), 100, 0)
+Fill_1 = model.addFill(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1")], [model.selection("SOLID", "Extrusion_1_2")])
+model.do()
+model.end()
+assert (len(Fill_1.results()) > 0)
+assert(model.checkPythonDump())