]> SALOME platform Git repositories - modules/shaper.git/blob - src/FeaturesPlugin/Test/TestFusionFaces.py
Salome HOME
Merge branch 'Results_Hierarchy'
[modules/shaper.git] / src / FeaturesPlugin / Test / TestFusionFaces.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 from salome.shaper import model
22
23 # Create document
24 model.begin()
25 partSet = model.moduleDocument()
26 Part_1 = model.addPart(partSet)
27 Part_1_doc = Part_1.document()
28
29 # =============================================================================
30 # Test 1. Fusion faces for shell of 2 adjacent faces lying on plane
31 # =============================================================================
32 Box_1 = model.addBox(Part_1_doc, 10, 10, 10)
33 Box_2 = model.addBox(Part_1_doc, 10, 10, 10)
34 Translation_1 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Box_2_1")], model.selection("EDGE", "PartSet/OX"), 10)
35
36 Shell_1 = model.addShell(Part_1_doc, [model.selection("FACE", "Box_1_1/Top"), model.selection("FACE", "Translation_1_1/Translated_Face_1")])
37 model.do()
38
39 model.checkResult(Shell_1, model, 1, [0], [0], [2], [8], [16])
40
41 FusionFaces_1 = model.addFusionFaces(Part_1_doc, model.selection("SHELL", "Shell_1_1"))
42 model.do()
43
44 model.checkResult(FusionFaces_1, model, 1, [0], [0], [1], [4], [8])
45
46 # =============================================================================
47 # Test 2. Fusion faces for solid of 2 adjacent boxes
48 # =============================================================================
49 Fuse_1 = model.addFuse(Part_1_doc, [model.selection("SOLID", "Box_1_1"), model.selection("SOLID", "Translation_1_1")], [])
50 model.do()
51
52 model.checkResult(Fuse_1, model, 1, [0], [1], [10], [40], [80])
53
54 FusionFaces_2 = model.addFusionFaces(Part_1_doc, model.selection("SOLID", "Fuse_1_1"))
55 model.do()
56
57 model.checkResult(FusionFaces_2, model, 1, [0], [1], [6], [24], [48])
58
59 # =============================================================================
60 # Test 3. Fusion faces for shell of adjacent faces lying on cylindrical surface
61 # =============================================================================
62 Cylinder_1 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 5, 10)
63 Shell_2 = model.addShell(Part_1_doc, [model.selection("FACE", "Cylinder_1_1/Face_1")])
64 Point_1 = model.addPoint(Part_1_doc, 0, 0, 5)
65 Plane_1 = model.addPlane(Part_1_doc, model.selection("EDGE", "PartSet/OZ"), model.selection("VERTEX", "Point_1"), True)
66
67 Partition_1 = model.addPartition(Part_1_doc, [model.selection("SHELL", "Shell_2_1"), model.selection("FACE", "Plane_1")])
68 model.do()
69
70 model.checkResult(Partition_1, model, 1, [0], [0], [2], [8], [16])
71
72 FusionFaces_3 = model.addFusionFaces(Part_1_doc, model.selection("SHELL", "Partition_1_1"))
73 model.do()
74
75 model.checkResult(FusionFaces_3, model, 1, [0], [0], [1], [4], [8])
76
77 # =============================================================================
78 # Test 4. Check subshapes naming
79 # =============================================================================
80 #model.testHaveNamingSubshapes(FusionFaces_1, model, Part_1_doc)
81 #model.testHaveNamingSubshapes(FusionFaces_2, model, Part_1_doc)
82 #model.testHaveNamingSubshapes(FusionFaces_3, model, Part_1_doc)
83 model.end()
84
85 # =============================================================================
86 # Test 5. Check Python dump
87 # =============================================================================
88 assert(model.checkPythonDump())