]> SALOME platform Git repositories - modules/shaper.git/blob - src/ModelAPI/Test/Test2491.py
Salome HOME
Fix for #19707 : fatal error gp_Dir() input vector has zero norm when loading python...
[modules/shaper.git] / src / ModelAPI / Test / Test2491.py
1 # Copyright (C) 2014-2020  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 Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
29 SketchLine_1 = Sketch_1.addLine(-17.23654191510763, 16.36770059625792, -4.760492650097915, 19.42518236023452)
30 SketchLine_2 = Sketch_1.addLine(20, 2.492755359431925e-15, 20, -31)
31 SketchLine_3 = Sketch_1.addLine(-25.74772708486752, -20, -17.21320343559642, -20)
32 SketchLine_4 = Sketch_1.addLine(-13.67766952966368, -21.46446609406726, 2.928932188134523, -38.07106781186547)
33 SketchArc_1 = Sketch_1.addArc(-17.21320343559642, -25, -13.67766952966368, -21.46446609406726, -17.21320343559642, -20, False)
34 SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchArc_1.startPoint(), SketchLine_4.startPoint())
35 SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_3.endPoint())
36 SketchConstraintTangent_1 = Sketch_1.setTangent(SketchArc_1.results()[1], SketchLine_4.result())
37 SketchConstraintTangent_2 = Sketch_1.setTangent(SketchArc_1.results()[1], SketchLine_3.result())
38 SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_3.result())
39 SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_2.result())
40 SketchArc_2 = Sketch_1.addArc(0, 6.520200294596256e-23, -4.760492650097915, 19.42518236023452, 20, 2.492755359431925e-15, True)
41 SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchArc_2.startPoint())
42 SketchArc_3 = Sketch_1.addArc(-12, -5, -29.79117622747561, -17.94117647058824, -17.23654191510763, 16.36770059625792, True)
43 SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchArc_3.endPoint(), SketchLine_1.startPoint())
44 SketchConstraintCoincidence_4.setName("SketchConstraintCoincidence_5")
45 SketchConstraintTangent_3 = Sketch_1.setTangent(SketchArc_3.results()[1], SketchLine_1.result())
46 SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchArc_2.endPoint(), SketchLine_2.startPoint())
47 SketchConstraintCoincidence_5.setName("SketchConstraintCoincidence_6")
48 SketchArc_4 = Sketch_1.addArc(-25.74772708486752, -15, -29.79117622747561, -17.94117647058824, -25.74772708486752, -20, False)
49 SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchArc_4.startPoint(), SketchArc_3.startPoint())
50 SketchConstraintCoincidence_6.setName("SketchConstraintCoincidence_7")
51 SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchArc_4.endPoint(), SketchLine_3.startPoint())
52 SketchConstraintCoincidence_7.setName("SketchConstraintCoincidence_8")
53 SketchConstraintTangent_4 = Sketch_1.setTangent(SketchArc_4.results()[1], SketchLine_3.result())
54 SketchConstraintTangent_5 = Sketch_1.setTangent(SketchArc_4.results()[1], SketchArc_3.results()[1])
55 SketchArc_5 = Sketch_1.addArc(10, -31, 20, -31, 2.928932188134523, -38.07106781186547, True)
56 SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchArc_5.startPoint())
57 SketchConstraintCoincidence_8.setName("SketchConstraintCoincidence_9")
58 SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchArc_5.endPoint(), SketchLine_4.endPoint())
59 SketchConstraintCoincidence_9.setName("SketchConstraintCoincidence_10")
60 SketchConstraintTangent_6 = Sketch_1.setTangent(SketchArc_5.results()[1], SketchLine_4.result())
61 SketchConstraintTangent_7 = Sketch_1.setTangent(SketchLine_2.result(), SketchArc_5.results()[1])
62 SketchConstraintTangent_8 = Sketch_1.setTangent(SketchLine_1.result(), SketchArc_2.results()[1])
63 SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_2.result(), 31)
64 SketchConstraintTangent_9 = Sketch_1.setTangent(SketchArc_2.results()[1], SketchLine_2.result())
65 SketchConstraintAngle_1 = Sketch_1.setAngle(SketchLine_3.result(), SketchLine_4.result(), 135)
66 SketchConstraintRadius_1 = Sketch_1.setRadius(SketchArc_1.results()[1], 5)
67 SketchConstraintEqual_1 = Sketch_1.setEqual(SketchArc_4.results()[1], SketchArc_1.results()[1])
68 SketchConstraintRadius_2 = Sketch_1.setRadius(SketchArc_5.results()[1], 10)
69 SketchConstraintRadius_3 = Sketch_1.setRadius(SketchArc_2.results()[1], 20)
70 SketchConstraintRadius_4 = Sketch_1.setRadius(SketchArc_3.results()[1], 22)
71 SketchCircle_1 = Sketch_1.addCircle(-22, -5, 7.5)
72 SketchLine_5 = Sketch_1.addLine(-22, -5, -12, -5)
73 SketchLine_5.setAuxiliary(True)
74 SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchCircle_1.center(), SketchLine_5.startPoint())
75 SketchConstraintCoincidence_10.setName("SketchConstraintCoincidence_11")
76 SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchArc_3.center(), SketchLine_5.endPoint())
77 SketchConstraintCoincidence_11.setName("SketchConstraintCoincidence_12")
78 SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_5.result())
79 SketchConstraintRadius_5 = Sketch_1.setRadius(SketchCircle_1.results()[1], 7.5)
80 SketchCircle_2 = Sketch_1.addCircle(0, 6.520200294596256e-23, 10)
81 SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchArc_2.center(), SketchCircle_2.center())
82 SketchConstraintCoincidence_12.setName("SketchConstraintCoincidence_13")
83 SketchConstraintRadius_6 = Sketch_1.setRadius(SketchCircle_2.results()[1], 10)
84 SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance(SketchCircle_2.center(), SketchArc_3.center(), 5)
85 SketchCircle_3 = Sketch_1.addCircle(7, -25, 7.5)
86 SketchConstraintRadius_7 = Sketch_1.setRadius(SketchCircle_3.results()[1], 7.5)
87 SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance(SketchArc_2.center(), SketchCircle_3.center(), 7)
88 SketchConstraintDistance_1 = Sketch_1.setDistance(SketchCircle_2.center(), SketchLine_3.result(), 20, True)
89 SketchConstraintDistanceVertical_2 = Sketch_1.setVerticalDistance(SketchArc_2.center(), SketchCircle_3.center(), 25)
90 SketchConstraintDistanceHorizontal_2 = Sketch_1.setHorizontalDistance(SketchLine_5.endPoint(), SketchArc_2.center(), 12)
91 SketchConstraintDistanceHorizontal_3 = Sketch_1.setHorizontalDistance(SketchCircle_1.center(), SketchArc_2.center(), 22)
92 SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False)
93 SketchPoint_1 = SketchProjection_1.createdFeature()
94 SketchConstraintCoincidence_13 = Sketch_1.setCoincident(SketchCircle_2.center(), SketchAPI_Point(SketchPoint_1).coordinates())
95 SketchConstraintCoincidence_13.setName("SketchConstraintCoincidence_14")
96 model.do()
97 Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchArc_3_2f-SketchArc_4_2f-SketchLine_3f-SketchArc_1_2r-SketchLine_4f-SketchArc_5_2f-SketchLine_2r-SketchArc_2_2f-SketchLine_1r-SketchCircle_1_2r-SketchCircle_2_2r-SketchCircle_3_2r")], model.selection(), 6.5, 0)
98 Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2"))
99 SketchLine_6 = Sketch_2.addLine(14.45330132699559, 5.092287733454298, -12.15814035598059, 5.092287733454298)
100 SketchLine_7 = Sketch_2.addLine(-12.15814035598059, 5.092287733454298, -12.15814035598059, 23.78152371848275)
101 SketchLine_8 = Sketch_2.addLine(-12.15814035598059, 23.78152371848275, 14.45330132699559, 23.78152371848275)
102 SketchLine_9 = Sketch_2.addLine(14.45330132699559, 23.78152371848275, 14.45330132699559, 5.092287733454298)
103 SketchConstraintCoincidence_14 = Sketch_2.setCoincident(SketchLine_9.endPoint(), SketchLine_6.startPoint())
104 SketchConstraintCoincidence_14.setName("SketchConstraintCoincidence_15")
105 SketchConstraintCoincidence_15 = Sketch_2.setCoincident(SketchLine_6.endPoint(), SketchLine_7.startPoint())
106 SketchConstraintCoincidence_15.setName("SketchConstraintCoincidence_16")
107 SketchConstraintCoincidence_16 = Sketch_2.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint())
108 SketchConstraintCoincidence_16.setName("SketchConstraintCoincidence_17")
109 SketchConstraintCoincidence_17 = Sketch_2.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint())
110 SketchConstraintCoincidence_17.setName("SketchConstraintCoincidence_18")
111 SketchConstraintHorizontal_3 = Sketch_2.setHorizontal(SketchLine_6.result())
112 SketchConstraintVertical_2 = Sketch_2.setVertical(SketchLine_7.result())
113 SketchConstraintHorizontal_4 = Sketch_2.setHorizontal(SketchLine_8.result())
114 SketchConstraintVertical_3 = Sketch_2.setVertical(SketchLine_9.result())
115 model.do()
116 ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_9r-SketchLine_8r-SketchLine_7r-SketchLine_6r")], model.selection(), 0, 100, [model.selection("SOLID", "Extrusion_1_1")])
117 model.do()
118 model.testHaveNamingSubshapes(Extrusion_1, model, Part_1_doc)
119 model.end()
120 assert(model.checkPythonDump())