1 """RevolutionSketch Interface
2 Author: Sergey Pokhodenko
3 Copyright (C) 2014-20xx CEA/DEN, EDF R&D
6 from .roots import CompositeSketch
9 def addRevolutionSketch(part, *args):
10 """Add an RevolutionSketch feature to the Part and return RevolutionSketch.
12 Pass all args to RevolutionSketch __init__ function.
15 feature = part.addFeature("RevolutionSketch")
16 return RevolutionSketch(feature, *args)
19 class RevolutionSketch(CompositeSketch):
21 def __init__(self, feature, *args):
22 CompositeSketch.__init__(self, feature, *args)
24 self._axis_object = self._feature.data().selection("axis_object")
25 self._CreationMethod = self._feature.string("CreationMethod")
26 self._to_angle = self._feature.data().real("to_angle")
27 self._from_angle = self._feature.data().real("from_angle")
28 self._to_object = self._feature.data().selection("to_object")
29 self._to_offset = self._feature.data().real("to_offset")
30 self._from_object = self._feature.data().selection("from_object")
31 self._from_offset = self._feature.data().real("from_offset")
36 self.setAxisObject(args[0])
39 self.setPlanesAndOffsets(*args[1:])
41 self.setAngles(*args[1:])
45 self._CreationMethod.setValue("ByAngles")
46 self._fill_attribute(self._to_angle, 0)
47 self._fill_attribute(self._from_angle, 0)
48 self._fill_attribute(self._to_object, None)
49 self._fill_attribute(self._to_offset, 0)
50 self._fill_attribute(self._from_object, None)
51 self._fill_attribute(self._from_offset, 0)
54 def setAxisObject(self, axis_object):
55 """Modify axis_object attribute of the feature.
59 self._fill_attribute(self._axis_object, axis_object)
62 def setAngles(self, to_angle, from_angle):
63 """Modify the to_angle, from_angle attributes of the feature.
68 self._CreationMethod.setValue("ByAngles")
69 self._fill_attribute(self._to_angle, to_angle)
70 self._fill_attribute(self._from_angle, from_angle)
73 def setPlanesAndOffsets(self, to_object, to_offset,
74 from_object, from_offset):
75 """Modify planes and offsets attributes of the feature.
80 self._CreationMethod.setValue("ByPlanesAndOffsets")
81 self._fill_attribute(self._to_object, to_object)
82 self._fill_attribute(self._to_offset, to_offset)
83 self._fill_attribute(self._from_object, from_object)
84 self._fill_attribute(self._from_offset, from_offset)