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):
20 """Interface class for RevolutionSketch features.
22 RevolutionSketch(feature) -> feature interface without initialization
23 RevolutionSketch(feature,
24 sketch, sketch_selection,
25 to_angle, from_angle) ->
26 feature interface initialized from arguments:
31 RevolutionSketch(feature,
32 sketch, sketch_selection,
33 to_object, to_offset, from_object, from_offset) ->
34 feature interface initialized from arguments:
43 def __init__(self, feature, *args):
44 """x.__init__(...) initializes x; see x.__class__.__doc__ for signature"""
45 CompositeSketch.__init__(self, feature, *args[:2])
48 self._axis_object = self._feature.data().selection("axis_object")
49 self._CreationMethod = self._feature.string("CreationMethod")
50 self._to_angle = self._feature.data().real("to_angle")
51 self._from_angle = self._feature.data().real("from_angle")
52 self._to_object = self._feature.data().selection("to_object")
53 self._to_offset = self._feature.data().real("to_offset")
54 self._from_object = self._feature.data().selection("from_object")
55 self._from_offset = self._feature.data().real("from_offset")
57 assert(self._axis_object)
58 assert(self._CreationMethod)
59 assert(self._to_angle)
60 assert(self._from_angle)
61 assert(self._to_object)
62 assert(self._to_offset)
63 assert(self._from_object)
64 assert(self._from_offset)
69 assert(len(args) in (3, 5))
73 self.setAxisObject(axis_object)
76 self.setPlanesAndOffsets(*args)
84 self._CreationMethod.setValue("ByAngles")
85 self._fill_attribute(self._to_angle, 0)
86 self._fill_attribute(self._from_angle, 0)
87 self._fill_attribute(self._to_object, None)
88 self._fill_attribute(self._to_offset, 0)
89 self._fill_attribute(self._from_object, None)
90 self._fill_attribute(self._from_offset, 0)
93 def setAxisObject(self, axis_object):
94 """Modify axis_object attribute of the feature.
98 self._fill_attribute(self._axis_object, axis_object)
101 def setAngles(self, to_angle, from_angle):
102 """Modify the to_angle, from_angle attributes of the feature.
107 self._CreationMethod.setValue("ByAngles")
108 self._fill_attribute(self._to_angle, to_angle)
109 self._fill_attribute(self._from_angle, from_angle)
112 def setPlanesAndOffsets(self, to_object, to_offset,
113 from_object, from_offset):
114 """Modify planes and offsets attributes of the feature.
119 self._CreationMethod.setValue("ByPlanesAndOffsets")
120 self._fill_attribute(self._to_object, to_object)
121 self._fill_attribute(self._to_offset, to_offset)
122 self._fill_attribute(self._from_object, from_object)
123 self._fill_attribute(self._from_offset, from_offset)