1 """Translation Interface
2 Author: Sergey Pokhodenko
3 Copyright (C) 2014-20xx CEA/DEN, EDF R&D
6 from model.roots import Interface
9 def addTranslation(part, *args):
10 """Add an Translation feature to the Part and return Translation.
12 Pass all args to Translation __init__ function.
15 feature = part.addFeature("Translation")
16 return Translation(feature, *args)
19 class Translation(Interface):
21 def __init__(self, feature, *args):
22 Interface.__init__(self, feature)
23 assert(self._feature.getKind() == "Translation")
25 self._main_objects = self._feature.data().selectionList("main_objects")
26 self._axis_object = self._feature.data().selection("axis_object")
27 self._distance = self._feature.data().real("distance")
29 assert(len(args) == 3)
30 self.setMainObjects(args[0])
31 self.setAxisObject(args[1])
32 self.setDistance(args[2])
35 def setMainObjects(self, main_objects):
36 """Modify main_objects attribute of the feature.
40 self._fill_attribute(self._main_objects, main_objects)
43 def setAxisObject(self, axis_object):
44 """Modify axis_object attribute of the feature.
48 self._fill_attribute(self._axis_object, axis_object)
51 def setDistance(self, distance):
52 """Modify distance attribute of the feature.
56 self._fill_attribute(self._distance, distance)