Salome HOME
updated copyright message
[modules/shaper.git] / src / FeaturesPlugin / Test / Test2650.py
1 # Copyright (C) 2014-2023  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 email : webmaster.salome@opencascade.com
18 #
19
20 from salome.shaper import model
21
22 model.begin()
23 partSet = model.moduleDocument()
24 Part_1 = model.addPart(partSet)
25 Part_1_doc = Part_1.document()
26 Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOZ"))
27 SketchLine_1 = Sketch_1.addLine(10.96877310597264, 4.388320842434023, 10.96877310597264, 75.63259202833271)
28 model.do()
29 Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
30 SketchLine_2 = Sketch_2.addLine(20.69511709668412, -6.720507935503198, 19.39808085030927, 19.46570269579372)
31 SketchLine_3 = Sketch_2.addLine(19.39808085030927, 19.46570269579372, 61.20243103906213, 28.02128023393725)
32 SketchConstraintCoincidence_1 = Sketch_2.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint())
33 SketchLine_4 = Sketch_2.addLine(61.20243103906213, 28.02128023393725, 64.54729867171925, -32.684941224703)
34 SketchConstraintCoincidence_2 = Sketch_2.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint())
35 SketchLine_5 = Sketch_2.addLine(64.54729867171925, -32.684941224703, 20.69511709668412, -6.720507935503198)
36 SketchConstraintCoincidence_3 = Sketch_2.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint())
37 SketchConstraintCoincidence_4 = Sketch_2.setCoincident(SketchLine_2.startPoint(), SketchLine_5.endPoint())
38 model.do()
39 Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "PartSet/XOY"), model.selection("VERTEX", "Sketch_1/SketchLine_1_EndVertex"))
40 Sketch_3 = model.addSketch(Part_1_doc, model.selection("FACE", "Plane_1"))
41 SketchLine_6 = Sketch_3.addLine(18.78449167586506, 11.40320166178118, 18.60732592394469, -15.47067574876233)
42 SketchLine_7 = Sketch_3.addLine(18.60732592394469, -15.47067574876233, 57.06415928764967, -9.455161348995592)
43 SketchConstraintCoincidence_5 = Sketch_3.setCoincident(SketchLine_6.endPoint(), SketchLine_7.startPoint())
44 SketchLine_8 = Sketch_3.addLine(57.06415928764967, -9.455161348995592, 56.5687276408287, 11.2362868340608)
45 SketchConstraintCoincidence_6 = Sketch_3.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint())
46 SketchLine_9 = Sketch_3.addLine(56.5687276408287, 11.2362868340608, 18.78449167586506, 11.40320166178118)
47 SketchConstraintCoincidence_7 = Sketch_3.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint())
48 SketchConstraintCoincidence_8 = Sketch_3.setCoincident(SketchLine_6.startPoint(), SketchLine_9.endPoint())
49 model.do()
50 Pipe_1 = model.addPipe(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_5r-SketchLine_4r-SketchLine_3r-SketchLine_2r"), model.selection("FACE", "Sketch_3/Face-SketchLine_6r-SketchLine_7f-SketchLine_8f-SketchLine_9f")], model.selection("EDGE", "Sketch_1/SketchLine_1"), [model.selection("VERTEX", "Sketch_1/SketchLine_1_StartVertex"), model.selection("VERTEX", "Sketch_1/SketchLine_1_EndVertex")])
51 model.do()
52 model.end()
53
54 from GeomAPI import  GeomAPI_Shape
55
56 model.testNbResults(Pipe_1, 1)
57 model.testNbSubResults(Pipe_1, [0])
58 model.testNbSubShapes(Pipe_1, GeomAPI_Shape.SOLID, [1])
59 model.testNbSubShapes(Pipe_1, GeomAPI_Shape.FACE, [6])
60 model.testNbSubShapes(Pipe_1, GeomAPI_Shape.EDGE, [24])
61 model.testNbSubShapes(Pipe_1, GeomAPI_Shape.VERTEX, [48])
62
63 assert(model.checkPythonDump())