1 # Copyright (C) 2020-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()
26 Part_1 = model.addPart(partSet)
27 Part_1_doc = Part_1.document()
30 Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
33 SketchLine_1 = Sketch_1.addLine(35.66344827586208, 18.52827586206897, -10.58758620689655, 18.52827586206897)
34 Sketch_1.setHorizontal(SketchLine_1.result())
36 ### Create SketchProjection
37 SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OY"), False)
38 SketchLine_2 = SketchProjection_1.createdFeature()
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())
48 Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("YOZ"))
51 SketchLine_3 = Sketch_2.addLine(46.66896551724138, 0, 49.59252615395944, 57.3324122669822)
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())
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)
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"]
72 Fillet1D = model.addFillet(Part_1_doc, [model.selection("VERTEX", v)], 1)
74 assert(Fillet1D.feature().error() != "")
76 ### Wire has no vertices applicable for 1D-fillet
78 Fillet1D = model.addFillet(Part_1_doc, [model.selection("WIRE", "Wire_1_1")], 1)
80 assert(Fillet1D.feature().error() != "")