]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Add feature rotation without tests.
authorspo <sergey.pokhodenko@opencascade.com>
Tue, 27 Oct 2015 13:50:45 +0000 (16:50 +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/rotation.py [new file with mode: 0644]

index e581a2e6559f810e462656c3c7df200ea6aa874f..7b2d341a9ee04cd317b4fc99a971108032796b59 100644 (file)
@@ -16,3 +16,4 @@ from revolution_boolean import addRevolutionCut, addRevolutionFuse
 from revolution_sketch import addRevolutionSketch
 
 from placement import addPlacement
+from rotation import addRotation
diff --git a/src/PythonAPI/model/features/rotation.py b/src/PythonAPI/model/features/rotation.py
new file mode 100644 (file)
index 0000000..9df8c31
--- /dev/null
@@ -0,0 +1,57 @@
+"""Rotation Interface
+Author: Sergey Pokhodenko
+Copyright (C) 2014-20xx CEA/DEN, EDF R&D
+"""
+
+from model.roots import Interface
+
+
+def addRotation(part, *args):
+    """Add an Rotation feature to the Part and return Rotation.
+
+    Pass all args to Rotation __init__ function.
+    """
+    assert(args)
+    feature = part.addFeature("Rotation")
+    return Rotation(feature, *args)
+
+
+class Rotation(Interface):
+
+    def __init__(self, feature, *args):
+        Interface.__init__(self, feature)
+        assert(self._feature.getKind() == "Rotation")
+
+        self._main_objects = self._feature.data().selectionList("main_objects")
+        self._axis_object = self._feature.data().selection("axis_object")
+        self._angle = self._feature.data().real("angle")
+
+        assert(len(args) == 3)
+        self.setMainObjects(args[0])
+        self.setAxisObject(args[1])
+        self.setAngle(args[2])
+        pass
+
+    def setMainObjects(self, main_objects):
+        """Modify main_objects attribute of the feature.
+
+        See __init__.
+        """
+        self._fill_attribute(self._main_objects, main_objects)
+        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 setAngle(self, angle):
+        """Modify angle attribute of the feature.
+
+        See __init__.
+        """
+        self._fill_attribute(self._angle, angle)
+        pass