from boolean import Subtraction as addSubtraction
from boolean import Intersection as addIntersection
+from partition import addPartition
+
from extrusion import addExtrusion
+from extrusion_boolean import addExtrusionCut, addExtrusionFuse
+from extrusion_sketch import addExtrusionSketch
+
from revolution import addRevolution
-from partition import addPartition
+from revolution_boolean import addRevolutionCut, addRevolutionFuse
+from revolution_sketch import addRevolutionSketch
--- /dev/null
+"""ExtrusionCut and ExtrusionFuse Interfaces
+Author: Sergey Pokhodenko
+Copyright (C) 2014-20xx CEA/DEN, EDF R&D
+"""
+
+from .roots import CompositeBoolean
+
+
+def addExtrusionCut(part, *args):
+ """Add an ExtrusionCut feature to the Part and return ExtrusionBoolean.
+
+ Pass all args to Extrusion __init__ function.
+ """
+ assert(args)
+ feature = part.addFeature("ExtrusionCut")
+ return ExtrusionBoolean(feature, *args)
+
+def addExtrusionFuse(part, *args):
+ """Add an ExtrusionFuse feature to the Part and return ExtrusionBoolean.
+
+ Pass all args to Extrusion __init__ function.
+ """
+ assert(args)
+ feature = part.addFeature("ExtrusionFuse")
+ return ExtrusionBoolean(feature, *args)
+
+
+class ExtrusionBoolean(CompositeBoolean):
+
+ def __init__(self, feature, *args):
+ CompositeBoolean.__init__(self, feature, *args)
+
+ self._CreationMethod = self._feature.string("CreationMethod")
+ self._to_size = self._feature.data().real("to_size")
+ self._from_size = self._feature.data().real("from_size")
+ self._to_object = self._feature.data().selection("to_object")
+ self._to_offset = self._feature.data().real("to_offset")
+ self._from_object = self._feature.data().selection("from_object")
+ self._from_offset = self._feature.data().real("from_offset")
+
+ if not args:
+ return
+
+ assert(len(args) == 4 or len(args) == 2)
+ if len(args) == 4:
+ self.setPlanesAndOffsets(*args)
+ elif len(args) == 2:
+ self.setSizes(*args)
+ pass
+
+ def __clear(self):
+ self._CreationMethod.setValue("BySizes")
+ self._fill_attribute(self._to_size, 0)
+ self._fill_attribute(self._from_size, 0)
+ self._fill_attribute(self._to_object, None)
+ self._fill_attribute(self._to_offset, 0)
+ self._fill_attribute(self._from_object, None)
+ self._fill_attribute(self._from_offset, 0)
+ pass
+
+ def setSizes(self, to_size, from_size):
+ """Modify the to_size, from_size attributes of the feature.
+
+ See __init__.
+ """
+ self.__clear()
+ self._CreationMethod.setValue("BySizes")
+ self._fill_attribute(self._to_size, to_size)
+ self._fill_attribute(self._from_size, from_size)
+ pass
+
+ def setPlanesAndOffsets(self, to_object, to_offset,
+ from_object, from_offset):
+ """Modify planes and offsets attributes of the feature.
+
+ See __init__.
+ """
+ self.__clear()
+ self._CreationMethod.setValue("ByPlanesAndOffsets")
+ self._fill_attribute(self._to_object, to_object)
+ self._fill_attribute(self._to_offset, to_offset)
+ self._fill_attribute(self._from_object, from_object)
+ self._fill_attribute(self._from_offset, from_offset)
+ pass
+
--- /dev/null
+"""ExtrusionSketch Interfaces
+Author: Sergey Pokhodenko
+Copyright (C) 2014-20xx CEA/DEN, EDF R&D
+"""
+
+from .roots import CompositeSketch
+
+
+def addExtrusionSketch(part, *args):
+ """Add an ExtrusionSketch feature to the Part and return ExtrusionSketch.
+
+ Pass all args to ExtrusionSketch __init__ function.
+ """
+ assert(args)
+ feature = part.addFeature("ExtrusionSketch")
+ return ExtrusionSketch(feature, *args)
+
+
+class ExtrusionSketch(CompositeSketch):
+
+ def __init__(self, feature, *args):
+ CompositeSketch.__init__(self, feature, *args)
+
+ self._CreationMethod = self._feature.string("CreationMethod")
+ self._to_size = self._feature.data().real("to_size")
+ self._from_size = self._feature.data().real("from_size")
+ self._to_object = self._feature.data().selection("to_object")
+ self._to_offset = self._feature.data().real("to_offset")
+ self._from_object = self._feature.data().selection("from_object")
+ self._from_offset = self._feature.data().real("from_offset")
+
+ if not args:
+ return
+
+ assert(len(args) == 4 or len(args) == 2)
+ if len(args) == 4:
+ self.setPlanesAndOffsets(*args)
+ elif len(args) == 2:
+ self.setSizes(*args)
+ pass
+
+ def __clear(self):
+ self._CreationMethod.setValue("BySizes")
+ self._fill_attribute(self._to_size, 0)
+ self._fill_attribute(self._from_size, 0)
+ self._fill_attribute(self._to_object, None)
+ self._fill_attribute(self._to_offset, 0)
+ self._fill_attribute(self._from_object, None)
+ self._fill_attribute(self._from_offset, 0)
+ pass
+
+ def setSizes(self, to_size, from_size):
+ """Modify the to_size, from_size attributes of the feature.
+
+ See __init__.
+ """
+ self.__clear()
+ self._CreationMethod.setValue("BySizes")
+ self._fill_attribute(self._to_size, to_size)
+ self._fill_attribute(self._from_size, from_size)
+ pass
+
+ def setPlanesAndOffsets(self, to_object, to_offset,
+ from_object, from_offset):
+ """Modify planes and offsets attributes of the feature.
+
+ See __init__.
+ """
+ self.__clear()
+ self._CreationMethod.setValue("ByPlanesAndOffsets")
+ self._fill_attribute(self._to_object, to_object)
+ self._fill_attribute(self._to_offset, to_offset)
+ self._fill_attribute(self._from_object, from_object)
+ self._fill_attribute(self._from_offset, from_offset)
+ pass
+
--- /dev/null
+"""RevolutionCut and RevolutionFuse Interface
+Author: Sergey Pokhodenko
+Copyright (C) 2014-20xx CEA/DEN, EDF R&D
+"""
+
+from .roots import CompositeBoolean
+
+
+def addRevolutionCut(part, *args):
+ """Add an RevolutionCut feature to the Part and return RevolutionBoolean.
+
+ Pass all args to RevolutionCut __init__ function.
+ """
+ assert(args)
+ feature = part.addFeature("RevolutionCut")
+ return RevolutionBoolean(feature, *args)
+
+def addRevolutionFuse(part, *args):
+ """Add an RevolutionFuse feature to the Part and return RevolutionBoolean.
+
+ Pass all args to RevolutionFuse __init__ function.
+ """
+ assert(args)
+ feature = part.addFeature("RevolutionFuse")
+ return RevolutionBoolean(feature, *args)
+
+
+class RevolutionBoolean(CompositeBoolean):
+
+ def __init__(self, feature, *args):
+ CompositeBoolean.__init__(self, feature, *args)
+
+ self._axis_object = self._feature.data().selection("axis_object")
+ self._CreationMethod = self._feature.string("CreationMethod")
+ self._to_angle = self._feature.data().real("to_angle")
+ self._from_angle = self._feature.data().real("from_angle")
+ self._to_object = self._feature.data().selection("to_object")
+ self._to_offset = self._feature.data().real("to_offset")
+ self._from_object = self._feature.data().selection("from_object")
+ self._from_offset = self._feature.data().real("from_offset")
+
+ if not args:
+ return
+
+ self.setAxisObject(args[0])
+
+ if len(args) == 4:
+ self.setPlanesAndOffsets(*args[1:])
+ elif len(args) == 2:
+ self.setAngles(*args[1:])
+ pass
+
+ def __clear(self):
+ self._CreationMethod.setValue("ByAngles")
+ self._fill_attribute(self._to_angle, 0)
+ self._fill_attribute(self._from_angle, 0)
+ self._fill_attribute(self._to_object, None)
+ self._fill_attribute(self._to_offset, 0)
+ self._fill_attribute(self._from_object, None)
+ self._fill_attribute(self._from_offset, 0)
+ pass
+
+ def setAxisObject(self, axis_object):
+ """Modify axis_object attribute of the feature.
+
+ See __init__.
+ """
+ self._fill_attribute(self._axis_object, axis_object)
+ pass
+
+ def setAngles(self, to_angle, from_angle):
+ """Modify the to_angle, from_angle attributes of the feature.
+
+ See __init__.
+ """
+ self.__clear()
+ self._CreationMethod.setValue("ByAngles")
+ self._fill_attribute(self._to_angle, to_angle)
+ self._fill_attribute(self._from_angle, from_angle)
+ pass
+
+ def setPlanesAndOffsets(self, to_object, to_offset,
+ from_object, from_offset):
+ """Modify planes and offsets attributes of the feature.
+
+ See __init__.
+ """
+ self.__clear()
+ self._CreationMethod.setValue("ByPlanesAndOffsets")
+ self._fill_attribute(self._to_object, to_object)
+ self._fill_attribute(self._to_offset, to_offset)
+ self._fill_attribute(self._from_object, from_object)
+ self._fill_attribute(self._from_offset, from_offset)
+ pass
+
--- /dev/null
+"""RevolutionSketch Interface
+Author: Sergey Pokhodenko
+Copyright (C) 2014-20xx CEA/DEN, EDF R&D
+"""
+
+from .roots import CompositeSketch
+
+
+def addRevolutionSketch(part, *args):
+ """Add an RevolutionSketch feature to the Part and return RevolutionSketch.
+
+ Pass all args to RevolutionSketch __init__ function.
+ """
+ assert(args)
+ feature = part.addFeature("RevolutionSketch")
+ return RevolutionSketch(feature, *args)
+
+
+class RevolutionSketch(CompositeSketch):
+
+ def __init__(self, feature, *args):
+ CompositeSketch.__init__(self, feature, *args)
+
+ self._axis_object = self._feature.data().selection("axis_object")
+ self._CreationMethod = self._feature.string("CreationMethod")
+ self._to_angle = self._feature.data().real("to_angle")
+ self._from_angle = self._feature.data().real("from_angle")
+ self._to_object = self._feature.data().selection("to_object")
+ self._to_offset = self._feature.data().real("to_offset")
+ self._from_object = self._feature.data().selection("from_object")
+ self._from_offset = self._feature.data().real("from_offset")
+
+ if not args:
+ return
+
+ self.setAxisObject(args[0])
+
+ if len(args) == 4:
+ self.setPlanesAndOffsets(*args[1:])
+ elif len(args) == 2:
+ self.setAngles(*args[1:])
+ pass
+
+ def __clear(self):
+ self._CreationMethod.setValue("ByAngles")
+ self._fill_attribute(self._to_angle, 0)
+ self._fill_attribute(self._from_angle, 0)
+ self._fill_attribute(self._to_object, None)
+ self._fill_attribute(self._to_offset, 0)
+ self._fill_attribute(self._from_object, None)
+ self._fill_attribute(self._from_offset, 0)
+ pass
+
+ def setAxisObject(self, axis_object):
+ """Modify axis_object attribute of the feature.
+
+ See __init__.
+ """
+ self._fill_attribute(self._axis_object, axis_object)
+ pass
+
+ def setAngles(self, to_angle, from_angle):
+ """Modify the to_angle, from_angle attributes of the feature.
+
+ See __init__.
+ """
+ self.__clear()
+ self._CreationMethod.setValue("ByAngles")
+ self._fill_attribute(self._to_angle, to_angle)
+ self._fill_attribute(self._from_angle, from_angle)
+ pass
+
+ def setPlanesAndOffsets(self, to_object, to_offset,
+ from_object, from_offset):
+ """Modify planes and offsets attributes of the feature.
+
+ See __init__.
+ """
+ self.__clear()
+ self._CreationMethod.setValue("ByPlanesAndOffsets")
+ self._fill_attribute(self._to_object, to_object)
+ self._fill_attribute(self._to_offset, to_offset)
+ self._fill_attribute(self._from_object, from_object)
+ self._fill_attribute(self._from_offset, from_offset)
+ pass
+
--- /dev/null
+
+
+from model.roots import Interface
+
+
+class CompositeBoolean(Interface):
+
+ def __init__(self, feature, *args):
+ Interface.__init__(self, feature)
+
+ self._sketch = self._feature.reference("sketch")
+ self._sketch_selection = self._feature.selection("sketch_selection")
+ self._boolean_objects = self._feature.selectionList("boolean_objects")
+
+ if not args:
+ return
+
+class CompositeSketch(Interface):
+
+ def __init__(self, feature, *args):
+ Interface.__init__(self, feature)
+
+ self._sketch = self._feature.reference("sketch")
+ self._sketch_selection = self._feature.selection("sketch_selection")
+
+ if not args:
+ return