]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Add feature Placement without tests.
authorspo <sergey.pokhodenko@opencascade.com>
Tue, 27 Oct 2015 13:45:00 +0000 (16:45 +0300)
committerspo <sergey.pokhodenko@opencascade.com>
Tue, 27 Oct 2015 14:01:44 +0000 (17:01 +0300)
src/PythonAPI/model/features/__init__.py
src/PythonAPI/model/features/placement.py [new file with mode: 0644]

index f38dee15eeb0e620cb869efa96f49fbac49b2bcb..e581a2e6559f810e462656c3c7df200ea6aa874f 100644 (file)
@@ -14,3 +14,5 @@ from extrusion_sketch import addExtrusionSketch
 from revolution import addRevolution
 from revolution_boolean import addRevolutionCut, addRevolutionFuse
 from revolution_sketch import addRevolutionSketch
+
+from placement import addPlacement
diff --git a/src/PythonAPI/model/features/placement.py b/src/PythonAPI/model/features/placement.py
new file mode 100644 (file)
index 0000000..6122b83
--- /dev/null
@@ -0,0 +1,77 @@
+"""Placement Interface
+Author: Sergey Pokhodenko
+Copyright (C) 2014-20xx CEA/DEN, EDF R&D
+"""
+
+from model.roots import Interface
+
+
+def addPlacement(part, *args):
+    """Add an Placement feature to the Part and return Placement.
+
+    Pass all args to Placement __init__ function.
+    """
+    assert(args)
+    feature = part.addFeature("Placement")
+    return Placement(feature, *args)
+
+
+class Placement(Interface):
+
+    def __init__(self, feature, *args):
+        Interface.__init__(self, feature)
+        assert(self._feature.getKind() == "Placement")
+
+        self._objects_list = self._feature.data().selectionList("placement_objects_list")
+        self._start_shape = self._feature.data().selection("placement_start_shape")
+        self._end_shape = self._feature.data().selection("placement_end_shape")
+        self._reverse_direction = self._feature.data().boolean("placement_reverse_direction")
+        self._centering = self._feature.data().boolean("placement_centering")
+
+        assert(len(args) == 5)
+        self.setObjectList(args[0])
+        self.setStartShape(args[1])
+        self.setEndShape(args[2])
+        self.setReverseDirection(args[3])
+        self.setCentering(args[4])
+        pass
+
+    def setObjectList(self, objects_list):
+        """Modify placement_objects_list attribute of the feature.
+
+        See __init__.
+        """
+        self._fill_attribute(self._objects_list, objects_list)
+        pass
+
+    def setStartShape(self, start_shape):
+        """Modify start_shape attribute of the feature.
+
+        See __init__.
+        """
+        self._fill_attribute(self._start_shape, start_shape)
+        pass
+
+    def setEndShape(self, end_shape):
+        """Modify end_shape attribute of the feature.
+
+        See __init__.
+        """
+        self._fill_attribute(self._end_shape, end_shape)
+        pass
+
+    def setReverseDirection(self, reverse_direction):
+        """Modify reverse_direction attribute of the feature.
+
+        See __init__.
+        """
+        self._fill_attribute(self._reverse_direction, reverse_direction)
+        pass
+
+    def setCentering(self, centering):
+        """Modify centering attribute of the feature.
+
+        See __init__.
+        """
+        self._fill_attribute(self._centering, centering)
+        pass