1 # Copyright (C) 2019-2022 CEA/DEN, EDF R&D
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()
24 Part_1 = model.addPart(partSet)
25 Part_1_doc = Part_1.document()
26 Point_2 = model.addPoint(Part_1_doc, -106.704990237, 59.3180779141, 313.27249047)
27 Point_2.setName("Point_30")
28 Point_2.result().setName("Point_30")
29 Point_3 = model.addPoint(Part_1_doc, -101.376950979, 62.2815769566, 321)
30 Point_3.setName("Point_31")
31 Point_3.result().setName("Point_31")
32 Point_4 = model.addPoint(Part_1_doc, -100.200106232, 69.3301090863, 329.729339172)
33 Point_4.setName("Point_32")
34 Point_4.result().setName("Point_32")
35 Point_5 = model.addPoint(Part_1_doc, -71.22799999999999, 49.284, 328.95)
36 Point_5.setName("Point_33")
37 Point_5.result().setName("Point_33")
38 Point_6 = model.addPoint(Part_1_doc, -74.8174225795, 47.3826420932, 326)
39 Point_6.setName("Point_34")
40 Point_6.result().setName("Point_34")
41 Point_7 = model.addPoint(Part_1_doc, -82.6510873528, 45.946338858, 320.314271667)
42 Point_7.setName("Point_35")
43 Point_7.result().setName("Point_35")
44 Polyline_1_objects = [model.selection("VERTEX", "Point_30"), model.selection("VERTEX", "Point_31"), model.selection("VERTEX", "Point_32"), model.selection("VERTEX", "Point_33"), model.selection("VERTEX", "Point_34"), model.selection("VERTEX", "Point_35")]
45 Polyline_1 = model.addPolyline3D(Part_1_doc, Polyline_1_objects, True)
46 Polyline_1.setName("Polyline_8")
47 Polyline_1.result().setName("Polyline_8_1")
48 Polyline_2 = model.addPolyline3D(Part_1_doc, [model.selection("VERTEX", "Point_31"), model.selection("VERTEX", "Point_34")], False)
49 Polyline_2.setName("Polyline_11")
50 Polyline_2.result().setName("Polyline_11_1")
51 Point_8 = model.addPoint(Part_1_doc, model.selection("EDGE", "Polyline_11_1/Generated_Edge&Point_31/Point_31"), 0.5, True, False)
52 Point_8.setName("Point_36")
53 Point_8.result().setName("Point_36")
54 Scale_1 = model.addScale(Part_1_doc, [model.selection("WIRE", "Polyline_8_1")] , model.selection("VERTEX", "Point_36"), 1.05)
55 Scale_1.setName("Scale_4")
56 Scale_1.result().setName("Scale_4_1")
57 Polyline_3 = model.addPolyline3D(Part_1_doc, [model.selection("VERTEX", "[Scale_4_1/ME:Scaled&Point_33/Point_33]e[Scale_4_1/ME:Scaled&Point_35/Point_35]e"), model.selection("VERTEX", "[Scale_4_1/ME:Scaled&Point_30/Point_30]e[Scale_4_1/ME:Scaled&Point_32/Point_32]e")], False)
58 Polyline_3.setName("Polyline_10")
59 Polyline_3.result().setName("Polyline_10_1")
60 Recover_1 = model.addRecover(Part_1_doc, Polyline_3, [Scale_1.result()])
61 Recover_1.setName("Recover_10")
62 Recover_1.result().setName("Recover_10_1")
63 Pipe_1 = model.addPipe(Part_1_doc, [model.selection("EDGE", "Recover_10_1/Modified_Edge&Point_31/Point_31"), model.selection("EDGE", "Polyline_10_1/Generated_Edge&weak_name_1")], model.selection("EDGE", "Recover_10_1/Modified_Edge&Point_33/Point_33"), [])
64 Pipe_1.setName("Pipe_3")
65 Pipe_1.result().setName("Pipe_3_1")
66 Recover_2 = model.addRecover(Part_1_doc, Pipe_1, [Recover_1.result()])
67 Recover_2.setName("Recover_11")
68 Recover_2.result().setName("Recover_11_1")
69 Pipe_2 = model.addPipe(Part_1_doc, [model.selection("EDGE", "Recover_11_1/Modified_Edge&Point_32/Point_32"), model.selection("EDGE", "Recover_11_1/Modified_Edge&Point_35/Point_35")], model.selection("EDGE", "Pipe_3_1/From_Edge_1"), [])
70 Pipe_2.setName("Pipe_4")
71 Pipe_2.result().setName("Pipe_4_1")
74 assert(Pipe_2.feature().error() == "")
78 model.testNbResults(Pipe_2, 1)
79 model.testNbSubResults(Pipe_2, [0])
80 model.testNbSubShapes(Pipe_2, GeomAPI_Shape.SOLID, [0])
81 model.testNbSubShapes(Pipe_2, GeomAPI_Shape.FACE, [1])
82 model.testNbSubShapes(Pipe_2, GeomAPI_Shape.EDGE, [4])
83 model.testNbSubShapes(Pipe_2, GeomAPI_Shape.VERTEX, [8])
84 model.testResultsAreas(Pipe_2, [280.91366299542733])
86 assert(model.checkPythonDump())