Salome HOME
7e937751d580956363b3fb14949edd9e07452150
[modules/shaper.git] / src / FeaturesPlugin / Test / TestFillet1D_ErrorMsg.py
1 # Copyright (C) 2020-2022  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
25 ### Create Part
26 Part_1 = model.addPart(partSet)
27 Part_1_doc = Part_1.document()
28
29 ### Create Sketch
30 Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
31
32 ### Create SketchLine
33 SketchLine_1 = Sketch_1.addLine(35.66344827586208, 18.52827586206897, -10.58758620689655, 18.52827586206897)
34 Sketch_1.setHorizontal(SketchLine_1.result())
35
36 ### Create SketchProjection
37 SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OY"), False)
38 SketchLine_2 = SketchProjection_1.createdFeature()
39
40 ### Create SketchArc
41 SketchArc_1 = Sketch_1.addArc(-10.58758620689655, 34.59034482758621, -10.58758620689655, 18.52827586206897, 0, 46.66896551724138, True)
42 Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchArc_1.startPoint())
43 Sketch_1.setTangent(SketchLine_1.result(), SketchArc_1.results()[1])
44 Sketch_1.setCoincident(SketchLine_2.result(), SketchArc_1.endPoint())
45 model.do()
46
47 ### Create Sketch
48 Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("YOZ"))
49
50 ### Create SketchLine
51 SketchLine_3 = Sketch_2.addLine(46.66896551724138, 0, 49.59252615395944, 57.3324122669822)
52
53 ### Create SketchProjection
54 SketchProjection_2 = Sketch_2.addProjection(model.selection("VERTEX", "Sketch_1/SketchArc_1_2_StartVertex"), False)
55 SketchPoint_1 = SketchProjection_2.createdFeature()
56 Sketch_2.setCoincident(SketchLine_3.startPoint(), SketchPoint_1.result())
57 model.do()
58
59 ### Create Wire
60 Wire_1_objects = [model.selection("EDGE", "Sketch_1/SketchLine_1"), model.selection("EDGE", "Sketch_1/SketchArc_1_2"), model.selection("EDGE", "Sketch_2/SketchLine_3")]
61 Wire_1 = model.addWire(Part_1_doc, Wire_1_objects, False)
62 model.end()
63
64
65 ### Check errors on 1D-fillet
66 vertices = ["Sketch_1/SketchLine_1_StartVertex",
67             "Sketch_2/SketchLine_3_EndVertex",
68             "[Wire_1_1/Modified_Edge&Sketch_1/SketchLine_1]e[Wire_1_1/Modified_Edge&Sketch_1/SketchArc_1_2]e",
69             "[Wire_1_1/Modified_Edge&Sketch_1/SketchArc_1_2]e[Wire_1_1/Modified_Edge&Sketch_2/SketchLine_3]e"]
70 for v in vertices:
71   model.begin()
72   Fillet1D = model.addFillet(Part_1_doc, [model.selection("VERTEX", v)], 1)
73   model.end()
74   assert(Fillet1D.feature().error() != "")
75
76 ### Wire has no vertices applicable for 1D-fillet
77 model.begin()
78 Fillet1D = model.addFillet(Part_1_doc, [model.selection("WIRE", "Wire_1_1")], 1)
79 model.end()
80 assert(Fillet1D.feature().error() != "")