1 # Copyright (C) 2020-2024 CEA, EDF
3 # This library is free software; you can redistribute it and/or
4 # modify it under the terms of the GNU Lesser General Public
5 # License as published by the Free Software Foundation; either
6 # version 2.1 of the License, or (at your option) any later version.
8 # This library is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 # Lesser General Public License for more details.
13 # You should have received a copy of the GNU Lesser General Public
14 # License along with this library; if not, write to the Free Software
15 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 from salome.shaper import model
23 partSet = model.moduleDocument()
26 Part_1 = model.addPart(partSet)
27 Part_1_doc = Part_1.document()
30 Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
33 SketchArc_1 = Sketch_1.addArc(56.24665913968287, -62.02452773486242, 35.57563613077872, -17.19150878248001, 88.70981046865168, -24.82997724138561, False)
36 SketchLine_1 = Sketch_1.addLine(88.70981046865168, -24.82997724138561, 35.57563613077872, -17.19150878248001)
37 Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_1.startPoint())
38 Sketch_1.setCoincident(SketchArc_1.startPoint(), SketchLine_1.endPoint())
42 Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", (56.24665913968287, -64.29248088508524, 0))], model.selection(), 50, 0)
45 Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", (56.24665913968287, -64.29248088508524, 50)))
47 ### Create SketchProjection
48 SketchProjection_1 = Sketch_2.addProjection(model.selection("VERTEX", (56.24665913968287, -62.02452773486242, 50)), False)
49 SketchPoint_1 = SketchProjection_1.createdFeature()
52 SketchArc_2 = Sketch_2.addArc(56.24665913968287, -62.02452773486242, 45.34418302532956, -36.70999577489869, 82.89389484228845, -54.98078276603709, False)
53 Sketch_2.setCoincident(SketchPoint_1.result(), SketchArc_2.center())
56 SketchLine_2 = Sketch_2.addLine(82.89389484228843, -54.98078276603709, 45.34418302532956, -36.70999577489869)
57 Sketch_2.setCoincident(SketchArc_2.endPoint(), SketchLine_2.startPoint())
58 Sketch_2.setCoincident(SketchArc_2.startPoint(), SketchLine_2.endPoint())
61 ### Create ExtrusionCut
62 ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, [model.selection("WIRE", (64.11903893380899, -45.84538927046789, 50))], model.selection(), 0, 10, [model.selection("SOLID", (55.99758335516852, -63.75630399502394, 25))])
68 model.testNbResults(ExtrusionCut_1, 1)
69 model.testNbSubResults(ExtrusionCut_1, [0])
70 model.testNbSubShapes(ExtrusionCut_1, GeomAPI_Shape.SOLID, [1])
71 model.testNbSubShapes(ExtrusionCut_1, GeomAPI_Shape.FACE, [7])
72 model.testNbSubShapes(ExtrusionCut_1, GeomAPI_Shape.EDGE, [24])
73 model.testNbSubShapes(ExtrusionCut_1, GeomAPI_Shape.VERTEX, [48])
74 model.testResultsVolumes(ExtrusionCut_1, [347314.47596])
76 assert(model.checkPythonDump())