From: spo Date: Tue, 27 Oct 2015 13:45:00 +0000 (+0300) Subject: Add feature Placement without tests. X-Git-Tag: V_2.1.0~206^2~54 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=4c7ef3371c67a34f8694aac3a5a4f6b5e53f6d6b;p=modules%2Fshaper.git Add feature Placement without tests. --- diff --git a/src/PythonAPI/model/features/__init__.py b/src/PythonAPI/model/features/__init__.py index f38dee15e..e581a2e65 100644 --- a/src/PythonAPI/model/features/__init__.py +++ b/src/PythonAPI/model/features/__init__.py @@ -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 index 000000000..6122b83e5 --- /dev/null +++ b/src/PythonAPI/model/features/placement.py @@ -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