X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FFeaturesPlugin%2FTest%2FTestBooleanFill.py;h=c181b37443318f5a35ee7f2c2b9970f3a6d0d9dd;hb=d2c5ce1931ca0695869fbf036af275fe282ab913;hp=524286a3511b6501124cf5dc40cccb6c73dc3f8e;hpb=d34842c50d5f335cca443c78910c16c54139c7d0;p=modules%2Fshaper.git diff --git a/src/FeaturesPlugin/Test/TestBooleanFill.py b/src/FeaturesPlugin/Test/TestBooleanFill.py index 524286a35..c181b3744 100644 --- a/src/FeaturesPlugin/Test/TestBooleanFill.py +++ b/src/FeaturesPlugin/Test/TestBooleanFill.py @@ -1,47 +1,42 @@ -""" -Test case for Boolean Fill feature. Written on High API. -""" -from ModelAPI import * -from GeomAPI import * - -import model - -# Get session -aSession = ModelAPI_Session.get() - -# 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() - +## 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 +## + +# -*- coding: utf-8 -*- + +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(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())