Salome HOME
Merge remote-tracking branch 'origin/Toolbars_Management'
[modules/shaper.git] / src / FeaturesPlugin / Test / TestPartitionFace2Solid.py
1 ## Copyright (C) 2014-2017  CEA/DEN, EDF R&D
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
18 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
19 ##
20
21 # -*- coding: utf-8 -*-
22
23 from SketchAPI import *
24
25 from salome.shaper import model
26
27 model.begin()
28 partSet = model.moduleDocument()
29 Part_1 = model.addPart(partSet)
30 Part_1_doc = Part_1.document()
31 Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
32 SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OY"), False)
33 SketchLine_1 = SketchProjection_1.createdFeature()
34 SketchArc_1 = Sketch_1.addArc(0, -23.6272731038225, 7.84836794507966, 9.071298990348682, 0, 10, False)
35 SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.result(), SketchArc_1.center())
36 SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.result(), SketchArc_1.endPoint())
37 SketchProjection_2 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OX"), False)
38 SketchLine_2 = SketchProjection_2.createdFeature()
39 SketchArc_2 = Sketch_1.addArc(5.671059039631239, 0, 7.84836794507966, 9.071298990348682, 15, 0, True)
40 SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_2.result(), SketchArc_2.center())
41 SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchArc_1.startPoint(), SketchArc_2.startPoint())
42 SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_2.result(), SketchArc_2.endPoint())
43 SketchConstraintTangent_1 = Sketch_1.setTangent(SketchArc_1.results()[1], SketchArc_2.results()[1])
44 SketchConstraintDistance_1 = Sketch_1.setDistance(SketchAPI_Line(SketchLine_2).startPoint(), SketchArc_2.endPoint(), 15, True)
45 SketchConstraintDistance_2 = Sketch_1.setDistance(SketchAPI_Line(SketchLine_2).startPoint(), SketchArc_1.endPoint(), 10, True)
46 SketchConstraintMirror_1 = Sketch_1.addMirror(SketchLine_2.result(), [SketchArc_2.results()[1], SketchArc_1.results()[1]])
47 [SketchArc_3, SketchArc_4] = SketchConstraintMirror_1.mirrored()
48 SketchConstraintMirror_2_objects = [SketchArc_1.results()[1], SketchArc_2.results()[1], SketchArc_3.results()[1], SketchArc_4.results()[1]]
49 SketchConstraintMirror_2 = Sketch_1.addMirror(SketchLine_1.result(), SketchConstraintMirror_2_objects)
50 [SketchArc_5, SketchArc_6, SketchArc_7, SketchArc_8] = SketchConstraintMirror_2.mirrored()
51 model.do()
52 Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 12, 12)
53 Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/To_Face"))
54 SketchLine_3 = Sketch_2.addLine(7.498934040825037, 4.111344571723496, -7.530337532973568, 4.111344571723496)
55 SketchLine_4 = Sketch_2.addLine(-7.530337532973568, 4.111344571723496, -7.530337532973568, -4.489390918751097)
56 SketchLine_5 = Sketch_2.addLine(-7.530337532973568, -4.489390918751097, 7.498934040825037, -4.489390918751097)
57 SketchLine_6 = Sketch_2.addLine(7.498934040825037, -4.489390918751097, 7.498934040825037, 4.111344571723496)
58 SketchConstraintCoincidence_6 = Sketch_2.setCoincident(SketchLine_6.endPoint(), SketchLine_3.startPoint())
59 SketchConstraintCoincidence_7 = Sketch_2.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint())
60 SketchConstraintCoincidence_8 = Sketch_2.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint())
61 SketchConstraintCoincidence_9 = Sketch_2.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint())
62 SketchConstraintHorizontal_1 = Sketch_2.setHorizontal(SketchLine_3.result())
63 SketchConstraintVertical_1 = Sketch_2.setVertical(SketchLine_4.result())
64 SketchConstraintHorizontal_2 = Sketch_2.setHorizontal(SketchLine_5.result())
65 SketchConstraintVertical_2 = Sketch_2.setVertical(SketchLine_6.result())
66 SketchCircle_1 = Sketch_2.addCircle(-0.133117930244568, 0.08984026389066591, 1.099112071963378)
67 model.do()
68 Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_3r-SketchLine_4f-SketchLine_5f-SketchLine_6f-SketchCircle_1_2r")], model.selection(), model.selection(), 5, model.selection(), 10)
69 Sketch_3 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
70 SketchLine_7 = Sketch_3.addLine(21.55890075100801, 30.21822825485694, -17.43219636481839, 31.63011070278906)
71 SketchLine_8 = Sketch_3.addLine(-17.43219636481839, 31.63011070278906, -12.33809712604348, -45.93749869468675)
72 SketchConstraintCoincidence_10 = Sketch_3.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint())
73 SketchLine_9 = Sketch_3.addLine(-12.33809712604348, -45.93749869468675, 30.10255255530162, -25.9120009302625)
74 SketchConstraintCoincidence_11 = Sketch_3.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint())
75 SketchLine_10 = Sketch_3.addLine(30.10255255530162, -25.9120009302625, 21.55890075100801, 30.21822825485694)
76 SketchConstraintCoincidence_12 = Sketch_3.setCoincident(SketchLine_9.endPoint(), SketchLine_10.startPoint())
77 SketchConstraintCoincidence_13 = Sketch_3.setCoincident(SketchLine_7.startPoint(), SketchLine_10.endPoint())
78 model.do()
79 Face_1_objects = [model.selection("EDGE", "Sketch_3/SketchLine_7"), model.selection("EDGE", "Sketch_3/SketchLine_8"), model.selection("EDGE", "Sketch_3/SketchLine_9"), model.selection("EDGE", "Sketch_3/SketchLine_10")]
80 Face_1 = model.addFace(Part_1_doc, Face_1_objects)
81 Partition_1_objects = [model.selection("FACE", "Face_1_1"), model.selection("SOLID", "Extrusion_2_1"), model.selection("SOLID", "Extrusion_1_1")]
82 Partition_1 = model.addPartition(Part_1_doc, Partition_1_objects)
83 model.do()
84
85 model.checkResult(Partition_1,model,1,[2],[4],[42],[198],[396])
86 model.testHaveNamingSubshapes(Partition_1,model,Part_1_doc)
87
88 model.end()
89
90 assert(model.checkPythonDump())