1 """Boolean operations Interface
2 Author: Daniel Brunier-Coulin
3 Copyright (C) 2014-20xx CEA/DEN, EDF R&D
7 from GeomAlgoAPI import *
11 """Abstract root class of Boolean Features."""
12 def __init__(self, part, object, tool, type):
13 self.my = part.addFeature("Boolean")
14 self.my.data().reference("main_object").setValue(object)
15 self.my.data().reference("tool_object").setValue(tool)
16 self.my.data().integer("bool_type").setValue(type)
18 if ModelAPI_Session.get().validators().validate(self.my):
21 raise Exception("cannot make the Boolean")
24 class Addition(Boolean):
26 def __init__(self, part, object, tool):
27 """Inserts an addition to the given Part and executes the operation.
28 This operation adds tool to the given object.
30 Boolean.__init__(self, part, object, tool, GeomAlgoAPI_Boolean.BOOL_FUSE)
33 class Subtraction(Boolean):
35 def __init__(self, part, object, tool):
36 """Inserts a subtraction to the given Part and executes the operation.
37 This operation subtracts tool to the given object.
39 Boolean.__init__(self, part, object, tool, GeomAlgoAPI_Boolean.BOOL_CUT)
42 class Intersection(Boolean):
44 def __init__(self, part, object, tool):
45 """Inserts an intersection to the given Part and executes the operation.
46 This operation intersects tool to the given object.
48 Boolean.__init__(self, part, object, tool, GeomAlgoAPI_Boolean.BOOL_COMMON)