1 ## Copyright (C) 2018-20xx CEA/DEN, EDF R&D
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.
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.
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
17 ## See http:##www.salome-platform.org/ or
18 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
21 from salome.shaper import model
25 partSet = model.moduleDocument()
26 Part_1 = model.addPart(partSet)
27 Part_1_doc = Part_1.document()
28 Param_ExtrusionMin = model.addParameter(Part_1_doc, "ExtrusionMin", "0")
29 Param_ExtrusionMax = model.addParameter(Part_1_doc, "ExtrusionMax", "10")
30 Param_Radius = model.addParameter(Part_1_doc, "Radius", "40")
31 Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
32 SketchCircle_1 = Sketch_1.addCircle(47, -3, 25)
33 SketchCircle_2 = Sketch_1.addCircle(55, 30, 40)
34 SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_2.results()[1], "Radius")
36 Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), "ExtrusionMax", "ExtrusionMin")
37 Partition_1 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1_1"), model.selection("SOLID", "Extrusion_1_1_2"), model.selection("FACE", "PartSet/XOZ")])
41 model.testNbResults(Partition_1, 1)
42 model.testNbSubResults(Partition_1, [5])
43 model.testNbSubShapes(Partition_1, GeomAPI_Shape.SOLID, [5])
44 model.testNbSubShapes(Partition_1, GeomAPI_Shape.FACE, [28])
45 model.testResultsVolumes(Partition_1, [58449.978432021540356799960136414])
47 # update extrusion and check partition
48 Param_ExtrusionMin.setValue(-5)
49 Param_ExtrusionMax.setValue(15)
52 model.testNbResults(Partition_1, 1)
53 model.testNbSubResults(Partition_1, [5])
54 model.testNbSubShapes(Partition_1, GeomAPI_Shape.SOLID, [5])
55 model.testNbSubShapes(Partition_1, GeomAPI_Shape.FACE, [28])
56 model.testResultsVolumes(Partition_1, [58449.978432021540356799960136414])
58 # change radius of a circle and check partition
59 Param_Radius.setValue(50)
62 model.testNbResults(Partition_1, 1)
63 model.testNbSubResults(Partition_1, [6])
64 model.testNbSubShapes(Partition_1, GeomAPI_Shape.SOLID, [6])
65 model.testNbSubShapes(Partition_1, GeomAPI_Shape.FACE, [33])
66 model.testResultsVolumes(Partition_1, [81554.943249122647102922201156616])
69 model.testHaveNamingSubshapes(Partition_1, model, Part_1_doc)