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):
15 self.my = part.addFeature("Boolean")
16 self.my.data().reference("main_object").setValue(object)
17 self.my.data().reference("tool_object").setValue(tool)
18 self.my.data().integer("bool_type").setValue(type)
20 if ModelAPI_Session.get().validators().validate(self.my):
23 raise Exception("cannot make the Boolean")
26 class Addition(Boolean):
27 """Inserts an addition to the given Part and executes the operation.
28 This operation adds tool to the given object.
31 def __init__(self, part, object, tool):
33 Boolean.__init__(self, part, object, tool, GeomAlgoAPI_Boolean.BOOL_FUSE)
36 class Subtraction(Boolean):
37 """Inserts a subtraction to the given Part and executes the operation.
38 This operation subtracts tool to the given object.
41 def __init__(self, part, object, tool):
43 Boolean.__init__(self, part, object, tool, GeomAlgoAPI_Boolean.BOOL_CUT)
46 class Intersection(Boolean):
47 """Inserts an intersection to the given Part and executes the operation.
48 This operation intersects tool to the given object.
51 def __init__(self, part, object, tool):
53 Boolean.__init__(self, part, object, tool, GeomAlgoAPI_Boolean.BOOL_COMMON)