Salome HOME
Merge commit 'refs/tags/V9_2_0^{}'
[modules/shaper.git] / src / FeaturesPlugin / Test / Test1467.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 salome.shaper import model
24
25 model.begin()
26 partSet = model.moduleDocument()
27 Part_1 = model.addPart(partSet)
28 Part_1_doc = Part_1.document()
29 Point_2 = model.addPoint(Part_1_doc, 5, 20, 0)
30 Point_3 = model.addPoint(Part_1_doc, 0, 40, 30)
31 Point_4 = model.addPoint(Part_1_doc, 10, 50, 70)
32 Vertex_1 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Point_1")])
33 Vertex_2 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "PartSet/Origin")])
34 Vertex_3 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Point_2")])
35 Vertex_4 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Point_3")])
36 Sketch_1 = model.addSketch(Part_1_doc, model.standardPlane("YOZ"))
37 SketchLine_1 = Sketch_1.addLine(14.65001594578831, -16.75950688440132, 21.53989436538019, 4.084511469683225)
38 SketchLine_1.setName("SketchLine_2")
39 SketchLine_1.result().setName("SketchLine_1")
40 SketchLine_2 = Sketch_1.addLine(21.53989436538019, 4.084511469683225, 17.92440575878417, 20.67042582762886)
41 SketchLine_2.setName("SketchLine_3")
42 SketchLine_2.result().setName("SketchLine_3")
43 SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint())
44 SketchConstraintCoincidence_1.setName("SketchConstraintCoincidence_2")
45 SketchLine_3 = Sketch_1.addLine(17.92440575878417, 20.67042582762886, 6.041293582700577, 31.26820121140768)
46 SketchLine_3.setName("SketchLine_4")
47 SketchLine_3.result().setName("SketchLine_4")
48 SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint())
49 SketchConstraintCoincidence_2.setName("SketchConstraintCoincidence_3")
50 SketchArc_1 = Sketch_1.addArc(15.73021805614924, 42.13223372900752, 6.041293582700577, 31.26820121140768, 1.302016307518145, 40.2010542198842, True)
51 SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchArc_1.startPoint(), SketchLine_3.endPoint())
52 SketchConstraintCoincidence_3.setName("SketchConstraintCoincidence_4")
53 SketchConstraintTangent_1 = Sketch_1.setTangent(SketchArc_1.results()[1], SketchLine_3.result())
54 SketchArc_2 = Sketch_1.addArc(5.884297127208473, -13.86204556507233, 14.65001594578831, -16.75950688440132, -3.31891814825968, -14.59275556007859, True)
55 SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchArc_2.startPoint(), SketchLine_1.startPoint())
56 SketchConstraintCoincidence_4.setName("SketchConstraintCoincidence_9")
57 SketchConstraintTangent_2 = Sketch_1.setTangent(SketchArc_2.results()[1], SketchLine_1.result())
58 SketchConstraintRigid_1 = Sketch_1.setFixed(SketchArc_1.startPoint())
59 SketchConstraintRigid_2 = Sketch_1.setFixed(SketchLine_2.endPoint())
60 model.do()
61 Wire_1_objects = [model.selection("EDGE", "Sketch_1/SketchArc_2_2"), model.selection("EDGE", "Sketch_1/SketchLine_1"), model.selection("EDGE", "Sketch_1/SketchLine_3"), model.selection("EDGE", "Sketch_1/SketchLine_4"), model.selection("EDGE", "Sketch_1/SketchArc_1_2")]
62 Wire_1 = model.addWire(Part_1_doc, Wire_1_objects)
63 Sketch_2 = model.addSketch(Part_1_doc, model.standardPlane("XOY"))
64 SketchLine_4 = Sketch_2.addLine(9.525599451781, 2.539525405208, -21.231656152164, 2.539525405208)
65 SketchLine_4.setName("SketchLine_5")
66 SketchLine_4.result().setName("SketchLine_5")
67 SketchLine_5 = Sketch_2.addLine(-21.231656152164, 2.539525405208, -21.231656152164, -7.57049842757)
68 SketchLine_5.setName("SketchLine_6")
69 SketchLine_5.result().setName("SketchLine_6")
70 SketchLine_6 = Sketch_2.addLine(-21.231656152164, -7.57049842757, 9.525599451781, -7.57049842757)
71 SketchLine_6.setName("SketchLine_7")
72 SketchLine_6.result().setName("SketchLine_7")
73 SketchLine_7 = Sketch_2.addLine(9.525599451781, -7.57049842757, 9.525599451781, 2.539525405208)
74 SketchLine_7.setName("SketchLine_8")
75 SketchLine_7.result().setName("SketchLine_8")
76 SketchConstraintCoincidence_5 = Sketch_2.setCoincident(SketchLine_7.endPoint(), SketchLine_4.startPoint())
77 SketchConstraintCoincidence_5.setName("SketchConstraintCoincidence_5")
78 SketchConstraintCoincidence_6 = Sketch_2.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint())
79 SketchConstraintCoincidence_6.setName("SketchConstraintCoincidence_6")
80 SketchConstraintCoincidence_7 = Sketch_2.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint())
81 SketchConstraintCoincidence_7.setName("SketchConstraintCoincidence_7")
82 SketchConstraintCoincidence_8 = Sketch_2.setCoincident(SketchLine_6.endPoint(), SketchLine_7.startPoint())
83 SketchConstraintCoincidence_8.setName("SketchConstraintCoincidence_8")
84 SketchConstraintHorizontal_1 = Sketch_2.setHorizontal(SketchLine_4.result())
85 SketchConstraintVertical_1 = Sketch_2.setVertical(SketchLine_5.result())
86 SketchConstraintHorizontal_2 = Sketch_2.setHorizontal(SketchLine_6.result())
87 SketchConstraintVertical_2 = Sketch_2.setVertical(SketchLine_7.result())
88 model.do()
89 Pipe_1 = model.addPipe(Part_1_doc, [model.selection("COMPOUND", "Sketch_2")], model.selection("WIRE", "Wire_1_1"))
90 Pipe_2 = model.addPipe(Part_1_doc, [model.selection("COMPOUND", "Sketch_2")], model.selection("EDGE", "Sketch_1/SketchArc_2_2"))
91 Cut_1 = model.addCut(Part_1_doc, [model.selection("SOLID", "Pipe_2_1")], [model.selection("SOLID", "Pipe_1_1")])
92 model.do()
93 model.end()
94
95 # Check that the small pipe is a part of the big one
96 assert(len(Cut_1.results()) == 0)