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