Salome HOME
updated copyright message
[modules/shaper.git] / src / FeaturesPlugin / Test / TestNormalToFace.py
1 # Copyright (C) 2014-2023  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 """
21       Unit test of ...
22 """
23 #=========================================================================
24 # Initialization of the test
25 #=========================================================================
26
27
28 import os
29 import math
30
31 from ModelAPI import *
32 from salome.shaper import model
33
34
35 __updated__ = "2020-11-12"
36
37 #=========================================================================
38 # Initialization of the test
39 #=========================================================================
40 model.begin()
41 partSet = model.moduleDocument()
42
43 ### Create Part
44 Part_1 = model.addPart(partSet)
45 Part_1_doc = Part_1.document()
46
47 ### Create Box
48 Box_1 = model.addBox(Part_1_doc, 10, 10, 10)
49 model.do()
50
51 #=========================================================================
52 # Test 1. Create a normal to a face with only a face
53 #=========================================================================
54 Normal_1 = model.getNormal(Part_1_doc, model.selection("FACE", "Box_1_1/Top"))
55 model.do()
56
57 #=========================================================================
58 # Test 2. Create a normal to a face with a face and a vertex
59 #=========================================================================
60 Normal_2 = model.getNormal(Part_1_doc, model.selection("FACE", "Box_1_1/Front"), model.selection("VERTEX", "[Box_1_1/Front][Box_1_1/Right][Box_1_1/Bottom]"))
61 model.do()
62
63 model.end()
64
65 assert (len(Normal_1.results()) > 0)
66 assert(Normal_1.feature().error() == "")
67 anAxisResult = modelAPI_ResultConstruction(Normal_1.feature().firstResult())
68 assert (anAxisResult is not None)
69
70 assert (len(Normal_2.results()) > 0)
71 assert(Normal_2.feature().error() == "")
72 anAxisResult = modelAPI_ResultConstruction(Normal_2.feature().firstResult())
73 assert (anAxisResult is not None)
74
75 #=========================================================================
76 # End of test
77 #=========================================================================