Salome HOME
12090f50c2e1d9feccd2eb71fa44509007104e3e
[modules/shaper.git] / src / BuildPlugin / Test / TestNonPlanarFace_Edges.py
1 # Copyright (C) 2017-2023  CEA, EDF
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 import sys
21 import salome
22
23 salome.salome_init()
24 import salome_notebook
25 notebook = salome_notebook.NoteBook()
26 sys.path.insert(0, r'/home/eksu/S2')
27
28 ###
29 ### SHAPER component
30 ###
31
32 from salome.shaper import model
33
34 model.begin()
35 partSet = model.moduleDocument()
36
37 ### Create Part
38 Part_1 = model.addPart(partSet)
39 Part_1_doc = Part_1.document()
40
41 ### Create Points
42 Point_2 = model.addPoint(Part_1_doc, 0, 0, 0)
43 Point_3 = model.addPoint(Part_1_doc, 10, 0, 0)
44 Point_4 = model.addPoint(Part_1_doc, 0, 10, 0)
45 Point_5 = model.addPoint(Part_1_doc, 10, 10, 3)
46
47 ### Create Edges
48 Edge_1 = model.addEdge(Part_1_doc, model.selection("VERTEX", "Point_1"), model.selection("VERTEX", "Point_2"))
49 Edge_2 = model.addEdge(Part_1_doc, model.selection("VERTEX", "Edge_1_1/Modified_Vertex&Point_2/Point_2"), model.selection("VERTEX", "Point_4"))
50 Edge_3 = model.addEdge(Part_1_doc, model.selection("VERTEX", "Edge_2_1/Modified_Vertex&Point_4/Point_4"), model.selection("VERTEX", "Point_3"))
51 Edge_4 = model.addEdge(Part_1_doc, model.selection("VERTEX", "Point_3"), model.selection("VERTEX", "Point_1"))
52
53 ### Create Wire
54 Wire_1_objects = [model.selection("EDGE", "Edge_1_1"),
55                   model.selection("EDGE", "Edge_2_1"),
56                   model.selection("EDGE", "Edge_4_1"),
57                   model.selection("EDGE", "Edge_3_1")]
58 Wire_1 = model.addWire(Part_1_doc, Wire_1_objects, False)
59
60 ### Create Face
61 Face_1_objects = [model.selection("EDGE", "Wire_1_1/Modified_Edge&Edge_1_1/Edge_1_1"),
62                   model.selection("EDGE", "Wire_1_1/Modified_Edge&Edge_2_1/Edge_2_1"),
63                   model.selection("EDGE", "Wire_1_1/Modified_Edge&Edge_4_1/Edge_4_1"),
64                   model.selection("EDGE", "Wire_1_1/Modified_Edge&Edge_3_1/Edge_3_1")]
65 Face_1 = model.addFace(Part_1_doc, Face_1_objects)
66
67 model.end()
68
69 ###
70 ### SHAPERSTUDY component
71 ###
72
73 model.publishToShaperStudy()
74 import SHAPERSTUDY
75 Face_1_1, = SHAPERSTUDY.shape(model.featureStringId(Face_1))
76
77 if salome.sg.hasDesktop():
78   salome.sg.updateObjBrowser()