Salome HOME
Non planar faces 35156
[modules/shaper.git] / src / BuildPlugin / Test / TestNonPlanarFace.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 """Test de la création de faces gauches"""
21
22 import salome
23
24 salome.salome_init()
25
26 from SketchAPI import *
27
28 from salome.shaper import model
29
30 model.begin()
31 partSet = model.moduleDocument()
32
33 ### Create Part
34 Part_1 = model.addPart(partSet)
35 Part_1_doc = Part_1.document()
36
37 ### Create Point
38 l_noms = list()
39 l_coo = list()
40 l_coo.append((0, 0, 0))
41 l_coo.append((1, 8, 0))
42 l_coo.append((3, 10, 4))
43 l_coo.append((5, 5, 5))
44 l_coo.append((2, 3, 1))
45 for iaux, (coo_x,coo_y,coo_z) in enumerate(l_coo):
46   point = model.addPoint(Part_1_doc, coo_x,coo_y,coo_z)
47   nom = "P_{}".format(iaux)
48   point.setName(nom)
49   point.result().setName(nom)
50   l_noms.append(nom)
51
52 ### Create Interpolation
53 Interpolation_1_objects = list()
54 for nom in l_noms:
55   Interpolation_1_objects.append(model.selection("VERTEX", "all-in-{}".format(nom)))
56 Interpolation_1 = model.addInterpolation(Part_1_doc, Interpolation_1_objects, True, False)
57
58 ### Create Wire
59 Wire_1 = model.addWire(Part_1_doc, [model.selection("EDGE", "Interpolation_1_1")], False)
60
61 ### Create Face
62 Face_1 = model.addFace(Part_1_doc, [model.selection("WIRE", "Wire_1_1")])
63
64 model.end()
65
66 if salome.sg.hasDesktop():
67   salome.sg.updateObjBrowser()