Salome HOME
Unit tests:
[modules/shaper.git] / src / PythonAPI / model / features / extrusion_boolean.py
index a5b4d1e0937af2995b1760e09e7764f706d8ed4e..199d1e1d990a691e361646e63f3cac7c3f929e54 100644 (file)
@@ -7,9 +7,32 @@ 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.
+    """Add an ExtrusionCut feature to the Part.
+
+    .. function:: addExtrusionCut(part, sketch, sketch_selection, boolean_objects, to_size, from_size)
+
+    Args:
+        part (ModelAPI_Document): part document
+        sketch (ModelAPI_Object): sketch feature
+        sketch_selection (Selection): sketch objects
+        boolean_objects (list of Selection): boolean objects
+        to_size (double): upper size of the extrusion
+        from_size (double): lower size of the extrusion
+
+    .. function:: addExtrusionCut(part, sketch, sketch_selection, boolean_objects, to_object, to_offset, from_object, from_offset)
+
+    Args:
+        part (ModelAPI_Document): part document
+        sketch (ModelAPI_Object): sketch feature
+        sketch_selection (Selection): sketch objects
+        boolean_objects (list of Selection): boolean objects
+        to_object (Selection): upper plane
+        to_offset (double): offset from upper plane
+        from_object (Selection): lower plane
+        from_offset (double): offset from lower plane
+
+    Returns:
+        ExtrusionBoolean: extrusion boolean object
     """
     assert(args)
     feature = part.addFeature("ExtrusionCut")
@@ -18,7 +41,30 @@ def addExtrusionCut(part, *args):
 def addExtrusionFuse(part, *args):
     """Add an ExtrusionFuse feature to the Part and return ExtrusionBoolean.
 
-    Pass all args to Extrusion __init__ function.
+    .. function:: addExtrusionFuse(part, sketch, sketch_selection, boolean_objects, to_size, from_size)
+
+    Args:
+        part (ModelAPI_Document): part document
+        sketch (ModelAPI_Object): sketch feature
+        sketch_selection (Selection): sketch objects
+        boolean_objects (list of Selection): boolean objects
+        to_size (double): upper size of the extrusion
+        from_size (double): lower size of the extrusion
+
+    .. function:: addExtrusionFuse(part, sketch, sketch_selection, boolean_objects, to_object, to_offset, from_object, from_offset)
+
+    Args:
+        part (ModelAPI_Document): part document
+        sketch (ModelAPI_Object): sketch feature
+        sketch_selection (Selection): sketch objects
+        boolean_objects (list of Selection): boolean objects
+        to_object (Selection): upper plane
+        to_offset (double): offset from upper plane
+        from_object (Selection): lower plane
+        from_offset (double): offset from lower plane
+
+    Returns:
+        ExtrusionBoolean: extrusion boolean object
     """
     assert(args)
     feature = part.addFeature("ExtrusionFuse")
@@ -29,30 +75,21 @@ class ExtrusionBoolean(CompositeBoolean):
     """Interface class for ExtrusionBoolean features.
 
     Supported features:
-    - ExtrusionCut
-    - ExtrusionFuse
-
-    ExtrusionBoolean(feature) -> feature interface without initialization
-    ExtrusionBoolean(feature,
-                     sketch, sketch_selection, boolean_objects,
-                     to_size, from_size) ->
-        feature interface initialized from arguments:
-        - sketch
-        - sketch_selection
-        - boolean_objects
-        - to_size
-        - from_size
-    ExtrusionBoolean(feature,
-                     sketch, sketch_selection, boolean_objects,
-                     to_object, to_offset, from_object, from_offset) ->
-        feature interface initialized from arguments:
-        - sketch
-        - sketch_selection
-        - boolean_objects
-        - to_object
-        - to_offset
-        - from_object
-        - from_offset
+
+    * ExtrusionCut
+    * ExtrusionFuse
+
+    .. function:: ExtrusionBoolean(feature)
+
+        Create interface for the feature without initialization.
+
+    .. function:: ExtrusionBoolean(feature, sketch, sketch_selection, boolean_objects, to_size, from_size)
+
+        Create interface for the feature and initialize the feature with arguments.
+
+    .. function:: ExtrusionBoolean(feature, sketch, sketch_selection, boolean_objects, to_object, to_offset, from_object, from_offset)
+
+        Create interface for the feature and initialize the feature with arguments.
     """
 
     def __init__(self, feature, *args):
@@ -85,17 +122,17 @@ class ExtrusionBoolean(CompositeBoolean):
         elif len(args) == 2:
             self.setSizes(*args)
 
-        self._execute()
+        self.execute()
         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)
+        self._fillAttribute(self._to_size, 0)
+        self._fillAttribute(self._from_size, 0)
+        self._fillAttribute(self._to_object, None)
+        self._fillAttribute(self._to_offset, 0)
+        self._fillAttribute(self._from_object, None)
+        self._fillAttribute(self._from_offset, 0)
         pass
 
     def setSizes(self, to_size, from_size):
@@ -105,8 +142,8 @@ class ExtrusionBoolean(CompositeBoolean):
         """
         self.__clear()
         self._CreationMethod.setValue("BySizes")
-        self._fill_attribute(self._to_size, to_size)
-        self._fill_attribute(self._from_size, from_size)
+        self._fillAttribute(self._to_size, to_size)
+        self._fillAttribute(self._from_size, from_size)
         pass
 
     def setPlanesAndOffsets(self, to_object, to_offset,
@@ -117,9 +154,9 @@ class ExtrusionBoolean(CompositeBoolean):
         """
         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)
+        self._fillAttribute(self._to_object, to_object)
+        self._fillAttribute(self._to_offset, to_offset)
+        self._fillAttribute(self._from_object, from_object)
+        self._fillAttribute(self._from_offset, from_offset)
         pass