1 # Copyright (C) 2014-2024 CEA, EDF
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 email : webmaster.salome@opencascade.com
20 from salome.shaper import model
21 from SketchAPI import *
25 partSet = model.moduleDocument()
27 ###===========Test with fillet on solide===========================================================
30 Part_1 = model.addPart(partSet)
31 Part_1_doc = Part_1.document()
34 Box_2 = model.addBox(Part_1_doc, 10, 10, 10)
37 Fillet_1_objects_4 = [model.selection("FACE", "Box_1_1/Left"),
38 model.selection("FACE", "Box_1_1/Front"),
39 model.selection("FACE", "Box_1_1/Top"),
40 model.selection("FACE", "Box_1_1/Right"),
41 model.selection("FACE", "Box_1_1/Bottom")]
42 Fillet_1 = model.addFillet(Part_1_doc, Fillet_1_objects_4, 2, keepSubResults = True)
47 Filters = model.filters(Part_1_doc, [model.addFilter(name = "ContinuousFaces", args = [model.selection("FACE", "Fillet_1_1/MF:Fillet&Box_1_1/Left"), 5.0 ])])
51 ResultFillet_1_1 = Fillet_1.result().resultSubShapePair()[0]
52 exp = GeomAPI_ShapeExplorer(ResultFillet_1_1.shape(), GeomAPI_Shape.FACE)
54 Reference[model.selection(ResultFillet_1_1, exp.current())] = True
56 model.checkFilter(Part_1_doc, model, Filters, Reference)
58 ###===========Test with Chamfer by an angle of 43° on solid and filters with angle 50 ===========
61 Part_2 = model.addPart(partSet)
62 Part_2_doc = Part_2.document()
65 Box_3 = model.addBox(Part_2_doc, 10, 10, 10)
68 Chamfer_1_objects = [model.selection("FACE", "Box_1_1/Left"),
69 model.selection("FACE", "Box_1_1/Front"),
70 model.selection("FACE", "Box_1_1/Top"),
71 model.selection("FACE", "Box_1_1/Right"),
72 model.selection("FACE", "Box_1_1/Bottom")]
73 Chamfer_2 = model.addChamfer(Part_2_doc, Chamfer_1_objects, False, 2, 43, keepSubResults = True)
78 Filters = model.filters(Part_2_doc, [model.addFilter(name = "ContinuousFaces", args = [model.selection("FACE", "Chamfer_1_1/MF:Chamfer&Box_1_1/Left"), 50.0 ])])
82 ResultChamfer_2_1 = Chamfer_2.result().resultSubShapePair()[0]
83 exp = GeomAPI_ShapeExplorer(ResultChamfer_2_1.shape(), GeomAPI_Shape.FACE)
85 Reference[model.selection(ResultChamfer_2_1, exp.current())] = True
87 model.checkFilter(Part_2_doc, model, Filters, Reference)