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):
20 """Interface class for Translation features.
22 Translation(feature) -> feature interface without initialization
23 Translation(feature, main_objects, axis_object, distance) ->
24 feature interface initialized from arguments:
30 def __init__(self, feature, *args):
31 """x.__init__(...) initializes x; see x.__class__.__doc__ for signature"""
32 Interface.__init__(self, feature)
33 assert(self._feature.getKind() == "Translation")
35 self._main_objects = self._feature.data().selectionList("main_objects")
36 self._axis_object = self._feature.data().selection("axis_object")
37 self._distance = self._feature.data().real("distance")
39 assert(self._main_objects)
40 assert(self._axis_object)
41 assert(self._distance)
46 assert(len(args) == 3)
47 self.setMainObjects(args[0])
48 self.setAxisObject(args[1])
49 self.setDistance(args[2])
54 def setMainObjects(self, main_objects):
55 """Modify main_objects attribute of the feature.
59 self._fill_attribute(self._main_objects, main_objects)
62 def setAxisObject(self, axis_object):
63 """Modify axis_object attribute of the feature.
67 self._fill_attribute(self._axis_object, axis_object)
70 def setDistance(self, distance):
71 """Modify distance attribute of the feature.
75 self._fill_attribute(self._distance, distance)