Salome HOME
Fix Platine test
[modules/shaper.git] / src / PythonAPI / model / features / placement.py
index 6122b83e53928c50b483316fe6e2469e3f5fd86c..4da0998e5d90ed2ea156e661aee3b869e145f1c6 100644 (file)
@@ -7,9 +7,20 @@ from model.roots import Interface
 
 
 def addPlacement(part, *args):
-    """Add an Placement feature to the Part and return Placement.
+    """Add a Placement feature to the Part.
 
-    Pass all args to Placement __init__ function.
+    .. function:: addPlacement(part, objects_list, start_shape, end_shape, reverse_direction, centering)
+
+    Args:
+        part (ModelAPI_Document): part document
+        objects_list (list of Selection): solid objects
+        start_shape (Selection): start face, edge or vertex
+        end_shape (Selection): end face, edge or vertex
+        reverse_direction (boolean): reverse placement direction
+        centering (boolean): center faces under placement
+
+    Returns:
+        Placement: placement object
     """
     assert(args)
     feature = part.addFeature("Placement")
@@ -17,8 +28,19 @@ def addPlacement(part, *args):
 
 
 class Placement(Interface):
+    """Interface class for Placement feature.
+
+    .. function:: Placement(feature)
+
+        Create interface for the feature without initialization.
+
+    .. function:: Placement(feature, objects_list, start_shape, end_shape, reverse_direction, centering)
+
+        Create interface for the feature and initialize the feature with arguments.
+    """
 
     def __init__(self, feature, *args):
+        """x.__init__(...) initializes x; see x.__class__.__doc__ for signature"""
         Interface.__init__(self, feature)
         assert(self._feature.getKind() == "Placement")
 
@@ -28,12 +50,23 @@ class Placement(Interface):
         self._reverse_direction = self._feature.data().boolean("placement_reverse_direction")
         self._centering = self._feature.data().boolean("placement_centering")
 
+        assert(self._objects_list)
+        assert(self._start_shape)
+        assert(self._end_shape)
+        assert(self._reverse_direction)
+        assert(self._centering)
+
+        if not args:
+            return
+
         assert(len(args) == 5)
         self.setObjectList(args[0])
         self.setStartShape(args[1])
         self.setEndShape(args[2])
         self.setReverseDirection(args[3])
         self.setCentering(args[4])
+
+        self.execute()
         pass
 
     def setObjectList(self, objects_list):
@@ -41,7 +74,7 @@ class Placement(Interface):
 
         See __init__.
         """
-        self._fill_attribute(self._objects_list, objects_list)
+        self._fillAttribute(self._objects_list, objects_list)
         pass
 
     def setStartShape(self, start_shape):
@@ -49,7 +82,7 @@ class Placement(Interface):
 
         See __init__.
         """
-        self._fill_attribute(self._start_shape, start_shape)
+        self._fillAttribute(self._start_shape, start_shape)
         pass
 
     def setEndShape(self, end_shape):
@@ -57,7 +90,7 @@ class Placement(Interface):
 
         See __init__.
         """
-        self._fill_attribute(self._end_shape, end_shape)
+        self._fillAttribute(self._end_shape, end_shape)
         pass
 
     def setReverseDirection(self, reverse_direction):
@@ -65,7 +98,7 @@ class Placement(Interface):
 
         See __init__.
         """
-        self._fill_attribute(self._reverse_direction, reverse_direction)
+        self._fillAttribute(self._reverse_direction, reverse_direction)
         pass
 
     def setCentering(self, centering):
@@ -73,5 +106,5 @@ class Placement(Interface):
 
         See __init__.
         """
-        self._fill_attribute(self._centering, centering)
+        self._fillAttribute(self._centering, centering)
         pass