]> SALOME platform Git repositories - modules/shaper.git/blob - src/ModelAPI/Test/Test2413.py
Salome HOME
Geometrical naming for edges and intersections debug.
[modules/shaper.git] / src / ModelAPI / Test / Test2413.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 salome.shaper import model
24
25 model.begin()
26 partSet = model.moduleDocument()
27 Part_1 = model.addPart(partSet)
28 Part_1_doc = Part_1.document()
29 Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
30 SketchLine_1 = Sketch_1.addLine(0, 0, 0, 50)
31 SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False)
32 SketchPoint_1 = SketchProjection_1.createdFeature()
33 SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchPoint_1.result())
34 SketchProjection_2 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OY"), False)
35 SketchLine_2 = SketchProjection_2.createdFeature()
36 SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.result())
37 SketchArc_1 = Sketch_1.addArc(0, 0, 0, 50, 50, 0, True)
38 SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchArc_1.center())
39 SketchLine_3 = Sketch_1.addLine(0, 0, 50, 0)
40 SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_3.startPoint())
41 SketchConstraintCoincidence_4.setName("SketchConstraintCoincidence_5")
42 SketchProjection_3 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OX"), False)
43 SketchLine_4 = SketchProjection_3.createdFeature()
44 SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.result())
45 SketchConstraintCoincidence_5.setName("SketchConstraintCoincidence_6")
46 SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_3.endPoint())
47 SketchConstraintCoincidence_6.setName("SketchConstraintCoincidence_7")
48 SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchArc_1.startPoint(), SketchLine_1.endPoint())
49 SketchConstraintCoincidence_7.setName("SketchConstraintCoincidence_8")
50 SketchConstraintRadius_1 = Sketch_1.setRadius(SketchArc_1.results()[1], 50)
51 model.do()
52 Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_3f-SketchArc_1_2f-SketchLine_1r")], model.selection(), 100, 0)
53 model.do()
54 Solid_1_objects = [model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3")]
55 Solid_1 = model.addSolid(Part_1_doc, Solid_1_objects)
56 # check that resulting build-solid feature is invalid: only one not-closed face is used
57 from ModelAPI import *
58 aFactory = ModelAPI_Session.get().validators()
59 assert(aFactory.validate(Solid_1.feature()) == False)
60 ModelAPI_Session.get().abortOperation()
61 # another try: to make a solid with a face inside
62 model.begin()
63 Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "Extrusion_1_1/To_Face"), 70, True)
64 Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Plane_1"))
65 SketchLine_5 = Sketch_2.addLine(14.9039069695087, 8.923908092675951, 26.86805702948195, 11.13714035991706)
66 SketchLine_6 = Sketch_2.addLine(26.86805702948195, 11.13714035991706, 18.50962242738747, 32.13572332177004)
67 SketchConstraintCoincidence_8 = Sketch_2.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint())
68 SketchConstraintCoincidence_8.setName("SketchConstraintCoincidence_9")
69 SketchLine_7 = Sketch_2.addLine(18.50962242738747, 32.13572332177004, 14.9039069695087, 8.923908092675951)
70 SketchConstraintCoincidence_9 = Sketch_2.setCoincident(SketchLine_6.endPoint(), SketchLine_7.startPoint())
71 SketchConstraintCoincidence_9.setName("SketchConstraintCoincidence_10")
72 SketchConstraintCoincidence_10 = Sketch_2.setCoincident(SketchLine_5.startPoint(), SketchLine_7.endPoint())
73 SketchConstraintCoincidence_10.setName("SketchConstraintCoincidence_11")
74 model.do()
75 Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_5r-SketchLine_6f-SketchLine_7f")])
76 Solid_1_objects = [model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3"), model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchArc_1_2"), model.selection("FACE", "Extrusion_1_1/To_Face"), model.selection("FACE", "Extrusion_1_1/From_Face"), model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1"), model.selection("FACE", "Face_1_1")]
77 Solid_1 = model.addSolid(Part_1_doc, Solid_1_objects)
78 model.do()
79 model.end()
80
81 assert(model.checkPythonDump())