]> SALOME platform Git repositories - modules/shaper.git/blob - src/FeaturesPlugin/Test/TestPartitionSubCompsolidWithPlane2.py
Salome HOME
Updated copyright comment
[modules/shaper.git] / src / FeaturesPlugin / Test / TestPartitionSubCompsolidWithPlane2.py
1 # Copyright (C) 2014-2024  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 from salome.shaper import model
21 from GeomAPI import *
22
23 model.begin()
24 partSet = model.moduleDocument()
25 Part_1 = model.addPart(partSet)
26 Part_1_doc = Part_1.document()
27 Param_ExtrusionMin = model.addParameter(Part_1_doc, "ExtrusionMin", "0")
28 Param_ExtrusionMax = model.addParameter(Part_1_doc, "ExtrusionMax", "10")
29 Param_Radius = model.addParameter(Part_1_doc, "Radius", "40")
30 Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
31 SketchCircle_1 = Sketch_1.addCircle(47, -3, 25)
32 SketchCircle_2 = Sketch_1.addCircle(55, 30, 40)
33 SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_2.results()[1], "Radius")
34 model.do()
35 Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), "ExtrusionMax", "ExtrusionMin")
36 Partition_1 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1_2"), model.selection("FACE", "PartSet/XOZ")])
37 model.do()
38
39 # check partition
40 model.testNbResults(Partition_1, 1)
41 model.testNbSubResults(Partition_1, [4])
42 model.testNbSubShapes(Partition_1, GeomAPI_Shape.SOLID, [4])
43 model.testNbSubShapes(Partition_1, GeomAPI_Shape.FACE, [22])
44 model.testResultsVolumes(Partition_1, [58449.978432346062618307769298553])
45
46 # update extrusion and check partition
47 Param_ExtrusionMin.setValue(-5)
48 Param_ExtrusionMax.setValue(15)
49 model.do()
50
51 model.testNbResults(Partition_1, 1)
52 model.testNbSubResults(Partition_1, [4])
53 model.testNbSubShapes(Partition_1, GeomAPI_Shape.SOLID, [4])
54 model.testNbSubShapes(Partition_1, GeomAPI_Shape.FACE, [22])
55 model.testResultsVolumes(Partition_1, [58449.978432346062618307769298553])
56
57 # change radius of a circle and check partition
58 Param_Radius.setValue(50)
59 model.do()
60
61 model.testNbResults(Partition_1, 1)
62 model.testNbSubResults(Partition_1, [5])
63 model.testNbSubShapes(Partition_1, GeomAPI_Shape.SOLID, [5])
64 model.testNbSubShapes(Partition_1, GeomAPI_Shape.FACE, [29])
65 model.testResultsVolumes(Partition_1, [81554.943249273565015755593776703])
66
67 # check naming
68 model.testHaveNamingSubshapes(Partition_1, model, Part_1_doc)
69
70 model.end()