Salome HOME
Copyright update 2022
[modules/shaper.git] / src / FeaturesPlugin / Test / Test2751.py
1 # Copyright (C) 2014-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 SketchAPI import *
21
22 from salome.shaper import model
23
24 model.begin()
25 partSet = model.moduleDocument()
26 Part_1 = model.addPart(partSet)
27 Part_1_doc = Part_1.document()
28 model.addParameter(Part_1_doc, "r", "20")
29 model.addParameter(Part_1_doc, "l", "40")
30 model.addParameter(Part_1_doc, "r2", "3")
31 model.addParameter(Part_1_doc, "a", "10")
32 model.addParameter(Part_1_doc, "h", "5")
33 model.addParameter(Part_1_doc, "n", "2")
34 Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
35 SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False)
36 SketchPoint_1 = SketchProjection_1.createdFeature()
37 SketchProjection_2 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OX"), False)
38 SketchLine_1 = SketchProjection_2.createdFeature()
39 SketchProjection_3 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OY"), False)
40 SketchLine_2 = SketchProjection_3.createdFeature()
41 SketchArc_1 = Sketch_1.addArc(0, 0, 20, 0, 0, 20, False)
42 SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchPoint_1.result(), SketchArc_1.center())
43 SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.result(), SketchArc_1.startPoint())
44 SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_2.result(), SketchArc_1.endPoint())
45 SketchArc_2 = Sketch_1.addArc(0, 0, 60, 0, 0, 60, False)
46 SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchAPI_Line(SketchLine_2).startPoint(), SketchArc_2.center())
47 SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_1.result(), SketchArc_2.startPoint())
48 SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_2.result(), SketchArc_2.endPoint())
49 SketchLine_3 = Sketch_1.addLine(0, 20, 0, 60)
50 SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_3.startPoint())
51 SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchArc_2.endPoint(), SketchLine_3.endPoint())
52 SketchLine_4 = Sketch_1.addLine(20, 0, 60, 0)
53 SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchArc_1.startPoint(), SketchLine_4.startPoint())
54 SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchArc_2.startPoint(), SketchLine_4.endPoint())
55 SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_4.result(), "l")
56 SketchConstraintRadius_1 = Sketch_1.setRadius(SketchArc_1.results()[1], "r")
57 model.do()
58 Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", (30, 30, 0))])
59 Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE_2", (30, 30, 0)))
60 SketchCircle_1 = Sketch_2.addCircle(24.6201938253052, 4.341204441673258, 3)
61 SketchLine_5 = Sketch_2.addLine(24.6201938253052, 4.341204441673258, 54.16442641567144, 9.550649771681169)
62 SketchLine_5.setAuxiliary(True)
63 SketchConstraintCoincidence_11 = Sketch_2.setCoincident(SketchCircle_1.center(), SketchLine_5.startPoint())
64 SketchConstraintRadius_2 = Sketch_2.setRadius(SketchCircle_1.results()[1], "r2")
65 SketchProjection_4 = Sketch_2.addProjection(model.selection("EDGE", "PartSet/OX"), False)
66 SketchLine_6 = SketchProjection_4.createdFeature()
67 SketchProjection_5 = Sketch_2.addProjection(model.selection("VERTEX", (20, 0, 0)), False)
68 SketchPoint_2 = SketchProjection_5.createdFeature()
69 SketchMultiTranslation_1 = Sketch_2.addTranslation([SketchCircle_1.results()[1]], SketchCircle_1.center(), SketchLine_5.endPoint(), "n")
70 [SketchCircle_2] = SketchMultiTranslation_1.translated()
71 SketchConstraintLength_2 = Sketch_2.setLength(SketchLine_5.result(), "(l-2*h)/(n-1)")
72 SketchLine_7 = Sketch_2.addLine(0, 0, 24.6201938253052, 4.341204441673258)
73 SketchLine_7.setAuxiliary(True)
74 SketchConstraintCoincidence_12 = Sketch_2.setCoincident(SketchAPI_Line(SketchLine_6).startPoint(), SketchLine_7.startPoint())
75 SketchConstraintCoincidence_13 = Sketch_2.setCoincident(SketchCircle_1.center(), SketchLine_7.endPoint())
76 SketchConstraintCollinear_1 = Sketch_2.setCollinear(SketchLine_5.result(), SketchLine_7.result())
77 SketchConstraintAngle_1 = Sketch_2.setAngle(SketchLine_6.result(), SketchLine_7.result(), "a")
78 SketchPoint_3 = Sketch_2.addPoint(19.69615506024416, 3.472963553338606)
79 SketchConstraintCoincidence_14 = Sketch_2.setCoincident(SketchPoint_3.coordinates(), SketchLine_7.result())
80 SketchProjection_6 = Sketch_2.addProjection(model.selection("EDGE", (14.14213562373095, 14.14213562373095, 0)), False)
81 SketchArc_3 = SketchProjection_6.createdFeature()
82 SketchConstraintCoincidence_15 = Sketch_2.setCoincident(SketchPoint_3.coordinates(), SketchArc_3.results()[1])
83 SketchConstraintDistance_1 = Sketch_2.setDistance(SketchPoint_3.coordinates(), SketchLine_7.endPoint(), "h", True)
84 model.do()
85 Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "all-in-Sketch_2")], model.selection(), 10, 0)
86 AngularCopy_1 = model.addMultiRotation(Part_1_doc, [model.selection("COMPOUND", "all-in-Extrusion_1")], model.selection("EDGE", "PartSet/OZ"), "(90-2*a)/(n-1)", "n")
87 Split_1 = model.addSplit(Part_1_doc, [model.selection("FACE", (30, 30, 0))], [model.selection("COMPOUND", (29.25281542867235, 29.25281542867235, 5))])
88 model.end()
89
90 assert(model.checkPythonDump())