Salome HOME
Update copyrights
[modules/shaper.git] / src / FeaturesPlugin / Test / Test2724.py
1 # Copyright (C) 2014-2019  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 # -*- coding: utf-8 -*-
21
22 from SketchAPI import *
23
24 from salome.shaper import model
25
26 model.begin()
27 partSet = model.moduleDocument()
28 model.addParameter(partSet, "b", "80")
29 model.addParameter(partSet, "a", "100")
30 model.addParameter(partSet, "c", "b-a")
31 Sketch_1 = model.addSketch(partSet, model.defaultPlane("XOY"))
32 SketchLine_1 = Sketch_1.addLine(-60, -20, -60.00000000000001, 80)
33 SketchLine_2 = Sketch_1.addLine(-60.00000000000001, 80, 0, 0)
34 SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint())
35 SketchLine_3 = Sketch_1.addLine(0, 0, 0, -100)
36 SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint())
37 SketchLine_4 = Sketch_1.addLine(0, -100, -60, -20)
38 SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint())
39 SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_1.startPoint())
40 SketchConstraintEqual_1 = Sketch_1.setEqual(SketchLine_1.result(), SketchLine_3.result())
41 SketchConstraintEqual_2 = Sketch_1.setEqual(SketchLine_4.result(), SketchLine_3.result())
42 SketchConstraintEqual_3 = Sketch_1.setEqual(SketchLine_2.result(), SketchLine_1.result())
43 SketchConstraintDistance_1 = Sketch_1.setDistance(SketchLine_3.endPoint(), SketchLine_3.startPoint(), "a", True)
44 SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "Origin"), False)
45 SketchPoint_1 = SketchProjection_1.createdFeature()
46 SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_3.startPoint(), SketchAPI_Point(SketchPoint_1).coordinates())
47 SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_3.result())
48 SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance(SketchLine_4.endPoint(), SketchLine_2.endPoint(), 60)
49 SketchConstraintMirror_1_objects = [SketchLine_4.result(), SketchLine_1.result(), SketchLine_2.result()]
50 SketchConstraintMirror_1 = Sketch_1.addMirror(SketchLine_3.result(), SketchConstraintMirror_1_objects)
51 [SketchLine_5, SketchLine_6, SketchLine_7] = SketchConstraintMirror_1.mirrored()
52 SketchMultiTranslation_1_objects = [SketchLine_1.result(), SketchLine_4.result(), SketchLine_3.result(), SketchLine_5.result(), SketchLine_6.result()]
53 SketchMultiTranslation_1 = Sketch_1.addTranslation(SketchMultiTranslation_1_objects, SketchLine_2.endPoint(), SketchLine_4.startPoint(), 4)
54 [SketchLine_8, SketchLine_9, SketchLine_10, SketchLine_11, SketchLine_12, SketchLine_13, SketchLine_14, SketchLine_15, SketchLine_16, SketchLine_5, SketchLine_17, SketchLine_18, SketchLine_19, SketchLine_6, SketchLine_20, SketchLine_21, SketchLine_22] = SketchMultiTranslation_1.translated()
55 model.do()
56 Part_1 = model.addPart(partSet)
57 Part_1_doc = Part_1.document()
58 Extrusion_1_objects = [model.selection("FACE", (-30, -10, 0)), model.selection("FACE", (30, -110, 0)), model.selection("FACE", (-30, -210, 0)), model.selection("FACE", (30, -310, 0))]
59 Extrusion_1 = model.addExtrusion(Part_1_doc, Extrusion_1_objects, model.selection(), "c", 0)
60 Translation_1 = model.addTranslation(Part_1_doc, [model.selection("SOLID", (30, -310, -9.999999999999998))], model.selection("EDGE", (-30, -360, 0)), "-c")
61 Box_1 = model.addBox(Part_1_doc, 10, 10, 10)
62 Placement_1 = model.addPlacement(Part_1_doc, [model.selection("SOLID", (-30.00000000000001, -10, -10))], model.selection("FACE", (5, 10, 5)), model.selection("FACE", (-30, 40, -10)), True, True)
63 Common_1 = model.addCommon(Part_1_doc, [model.selection("SOLID", (-30.00000000000001, -210, -10)), model.selection("SOLID", (18, -293.9999999999999, -9.999999999999998))])
64 model.do()
65 assert(model.checkPythonDump(model.ModelHighAPI.CHECK_WEAK))
66 model.end()