Salome HOME
adbb6ad457d7931c904799b4c7fb35b901b51965
[modules/shaper.git] / src / BuildPlugin / Test / Test3271.py
1 # Copyright (C) 2020-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.selection("FACE", "PartSet/XOY"))
27 SketchLine_1 = Sketch_1.addLine(0.0004311969126985509, -0.007674652873749346, 0.002931492667495096, -0.004255130738512952)
28 SketchLine_2 = Sketch_1.addLine(0.002931492667495096, -0.004255130738512952, 0.008777772447092769, -0.005450125033084811)
29 SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint())
30 SketchArc_1 = Sketch_1.addArc(0.008423929073579738, -0.007181235691194688, 0.008777772447092769, -0.005450125033084811, 0.01017499654536136, -0.007417269487226177, True)
31 SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchArc_1.startPoint())
32 SketchConstraintTangent_1 = Sketch_1.setTangent(SketchLine_2.result(), SketchArc_1.results()[1])
33 SketchArc_2 = Sketch_1.addArc(0.008003525163087695, -0.007124567668711833, 0.01017499654536136, -0.007417269487226177, 0.007858546066652927, -0.00931087583093235, True)
34 SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchArc_2.startPoint())
35 SketchConstraintTangent_2 = Sketch_1.setTangent(SketchArc_1.results()[1], SketchArc_2.results()[1])
36 SketchArc_3 = Sketch_1.addArc(0.007693833531605691, -0.01179476743082126, 0.007858546066652927, -0.00931087583093235, 0.005279452926115063, -0.01118845563724384, False)
37 SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchArc_2.endPoint(), SketchArc_3.startPoint())
38 SketchConstraintTangent_3 = Sketch_1.setTangent(SketchArc_2.results()[1], SketchArc_3.results()[1])
39 SketchEllipticArc_1 = Sketch_1.addEllipticArc(0.003574951141940773, -0.01155552979705393, 0.002239383243347156, -0.01179560634192411, 0.005279452926115063, -0.01118845563724384, 0.002020289862486981, -0.01123808958696058, False)
40 [SketchPoint_1, SketchPoint_2, SketchPoint_3, SketchPoint_4, SketchPoint_5, SketchPoint_6, SketchPoint_7, SketchLine_3, SketchLine_4] = SketchEllipticArc_1.construction(center = "aux", firstFocus = "aux", secondFocus = "aux", majorAxisStart = "aux", majorAxisEnd = "aux", minorAxisStart = "aux", minorAxisEnd = "aux", majorAxis = "aux", minorAxis = "aux")
41 SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchArc_3.endPoint(), SketchEllipticArc_1.startPoint())
42 SketchLine_5 = Sketch_1.addLine(0.002020289862504265, -0.0112380895869727, 0.0004311969126985505, -0.007674652873749346)
43 SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchEllipticArc_1.endPoint(), SketchLine_5.startPoint())
44 SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_5.endPoint())
45 SketchCircle_1 = Sketch_1.addCircle(0.003364447146935956, -0.00551738944900832, 0.001819824088768701)
46 SketchCircle_2 = Sketch_1.addCircle(0.007829307057027779, -0.01091774381645273, 0.003225214826443006)
47 model.do()
48 Sketch_1.changeFacesOrder([[SketchLine_5.result(), SketchEllipticArc_1.result(), SketchCircle_2.results()[1], SketchArc_2.results()[1], SketchArc_1.results()[1], SketchLine_2.result(), SketchCircle_1.results()[1], SketchLine_1.result()],
49                            [SketchCircle_1.results()[1], SketchLine_2.result(), SketchLine_1.result()],
50                            [SketchLine_1.result(), SketchLine_2.result(), SketchCircle_1.results()[1], SketchCircle_1.results()[1]],
51                            [SketchArc_2.results()[1], SketchCircle_2.results()[1], SketchEllipticArc_1.result(), SketchArc_3.results()[1]],
52                            [SketchArc_3.results()[1], SketchEllipticArc_1.result(), SketchCircle_2.results()[1], SketchCircle_2.results()[1], SketchArc_2.results()[1]]
53                           ])
54 model.do()
55 Face_1 = model.addFace(Part_1_doc, [model.selection("COMPOUND", "all-in-Sketch_1")])
56 Vertex_1 = model.addVertex(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], True)
57 Edge_1 = model.addEdge(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], True)
58 Wire_1 = model.addWire(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], True)
59
60 model.end()
61
62 assert(len(Face_1.results()) == 5)
63 assert(len(Vertex_1.results()) == 25)
64 assert(len(Edge_1.results()) == 17)
65 assert(len(Wire_1.results()) == 3)
66
67 assert(model.checkPythonDump())