Salome HOME
45feab940a4a5762e2adfa7726bc88544981f6c7
[modules/shaper.git] / src / FeaturesPlugin / Test / TestPointCloud.py
1 # Copyright (C) 2014-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 """
21       Unit test of makeVertexInsideFace
22 """
23
24 from salome.shaper import model
25 from GeomAPI import *
26
27 model.begin()
28 partSet = model.moduleDocument()
29
30 ### Create Part
31 Part_1 = model.addPart(partSet)
32 Part_1_doc = Part_1.document()
33
34 ### Create Sphere
35 Sphere_1 = model.addSphere(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), 10)
36
37 ### Get Points Cloud
38 PC_1 = model.makeVertexInsideFace(Part_1_doc, model.selection("FACE", "Sphere_1_1/Face_1"), 100)
39
40 model.end()
41
42 ### Check result
43 err = PC_1.feature().error()
44 if err != "":
45     print(err)
46     # this test should not fail with old OCCT
47     assert("Improper OCCT version" in err)
48 else:
49     model.testNbResults(PC_1, 1)
50     model.testNbSubResults(PC_1, [0])
51     model.testNbSubShapes(PC_1, GeomAPI_Shape.SOLID, [0])
52     model.testNbSubShapes(PC_1, GeomAPI_Shape.FACE, [0])
53     model.testNbSubShapes(PC_1, GeomAPI_Shape.EDGE, [0])
54     model.testNbSubShapes(PC_1, GeomAPI_Shape.VERTEX, [100])
55
56     assert(model.checkPythonDump())