Salome HOME
updated copyright message
[modules/shaper.git] / src / FeaturesPlugin / Test / TestBooleanFuse_CompSolid_Face.py
1 # Copyright (C) 2018-2023  CEA, EDF
2 #
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.
7 #
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.
12 #
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
16 #
17 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 #
19
20 from salome.shaper import model
21 from GeomAPI import GeomAPI_Shape
22
23 model.begin()
24 partSet = model.moduleDocument()
25 Part_1 = model.addPart(partSet)
26 Part_1_doc = Part_1.document()
27 Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
28 SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OX"), False)
29 SketchLine_1 = SketchProjection_1.createdFeature()
30 SketchCircle_1 = Sketch_1.addCircle(52.27216563767099, 0, 18.66006927176168)
31 SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.result(), SketchCircle_1.center())
32 SketchCircle_2 = Sketch_1.addCircle(79.68333887668101, 0, 24.16077154338278)
33 SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.result(), SketchCircle_2.center())
34 model.do()
35 Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 10, 0)
36 Sketch_2 = model.addSketch(Part_1_doc, model.standardPlane("XOZ"))
37 SketchLine_2 = Sketch_2.addLine(73.13136007081269, -14.25937060400964, 2.118687665902372, -14.25937060400964)
38 SketchLine_3 = Sketch_2.addLine(2.118687665902372, -14.25937060400964, 2.118687665902372, 26.70061277610758)
39 SketchLine_4 = Sketch_2.addLine(2.118687665902372, 26.70061277610758, 73.13136007081269, 26.70061277610758)
40 SketchLine_5 = Sketch_2.addLine(73.13136007081269, 26.70061277610758, 73.13136007081269, -14.25937060400964)
41 SketchConstraintCoincidence_3 = Sketch_2.setCoincident(SketchLine_5.endPoint(), SketchLine_2.startPoint())
42 SketchConstraintCoincidence_4 = Sketch_2.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint())
43 SketchConstraintCoincidence_5 = Sketch_2.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint())
44 SketchConstraintCoincidence_6 = Sketch_2.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint())
45 SketchConstraintHorizontal_1 = Sketch_2.setHorizontal(SketchLine_2.result())
46 SketchConstraintVertical_1 = Sketch_2.setVertical(SketchLine_3.result())
47 SketchConstraintHorizontal_2 = Sketch_2.setHorizontal(SketchLine_4.result())
48 SketchConstraintVertical_2 = Sketch_2.setVertical(SketchLine_5.result())
49 model.do()
50 Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_5r-SketchLine_4r-SketchLine_3r-SketchLine_2r")])
51 Cylinder_1 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 5, 10)
52 Fuse_1 = model.addFuse(Part_1_doc, [model.selection("SOLID", "Cylinder_1_1")], [model.selection("FACE", "Face_1_1")])
53
54 model.testNbResults(Fuse_1, 1)
55 model.testNbSubResults(Fuse_1, [2])
56 model.testNbSubShapes(Fuse_1, GeomAPI_Shape.SOLID, [1])
57 model.testNbSubShapes(Fuse_1, GeomAPI_Shape.FACE, [4])
58 model.testNbSubShapes(Fuse_1, GeomAPI_Shape.EDGE, [16])
59 model.testNbSubShapes(Fuse_1, GeomAPI_Shape.VERTEX, [32])
60 model.testResultsVolumes(Fuse_1, [785.398163397447774514148477465])
61
62 Fuse_2 = model.addFuse(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1_3"), model.selection("SOLID", "Extrusion_1_1_1")], [model.selection("FACE", "Fuse_1_1_1")])
63
64 model.testNbResults(Fuse_2, 1)
65 model.testNbSubResults(Fuse_2, [2])
66 model.testNbSubShapes(Fuse_2, GeomAPI_Shape.SOLID, [2])
67 model.testNbSubShapes(Fuse_2, GeomAPI_Shape.FACE, [19])
68 model.testNbSubShapes(Fuse_2, GeomAPI_Shape.EDGE, [82])
69 model.testNbSubShapes(Fuse_2, GeomAPI_Shape.VERTEX, [164])
70 model.testResultsVolumes(Fuse_2, [25803.607097738855372881516814232])
71 model.end()