1 """ExtrusionSketch Interfaces
2 Author: Sergey Pokhodenko
3 Copyright (C) 2014-20xx CEA/DEN, EDF R&D
6 from .roots import CompositeSketch
9 def addExtrusionSketch(part, *args):
10 """Add an ExtrusionSketch feature to the Part and return ExtrusionSketch.
12 Pass all args to ExtrusionSketch __init__ function.
15 feature = part.addFeature("ExtrusionSketch")
16 return ExtrusionSketch(feature, *args)
19 class ExtrusionSketch(CompositeSketch):
21 def __init__(self, feature, *args):
22 CompositeSketch.__init__(self, feature, *args[:2])
25 self._CreationMethod = self._feature.string("CreationMethod")
26 self._to_size = self._feature.data().real("to_size")
27 self._from_size = self._feature.data().real("from_size")
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")
33 assert(self._CreationMethod)
35 assert(self._from_size)
36 assert(self._to_object)
37 assert(self._to_offset)
38 assert(self._from_object)
39 assert(self._from_offset)
44 assert(len(args) in (2, 4))
46 self.setPlanesAndOffsets(*args)
54 self._CreationMethod.setValue("BySizes")
55 self._fill_attribute(self._to_size, 0)
56 self._fill_attribute(self._from_size, 0)
57 self._fill_attribute(self._to_object, None)
58 self._fill_attribute(self._to_offset, 0)
59 self._fill_attribute(self._from_object, None)
60 self._fill_attribute(self._from_offset, 0)
63 def setSizes(self, to_size, from_size):
64 """Modify the to_size, from_size attributes of the feature.
69 self._CreationMethod.setValue("BySizes")
70 self._fill_attribute(self._to_size, to_size)
71 self._fill_attribute(self._from_size, from_size)
74 def setPlanesAndOffsets(self, to_object, to_offset,
75 from_object, from_offset):
76 """Modify planes and offsets attributes of the feature.
81 self._CreationMethod.setValue("ByPlanesAndOffsets")
82 self._fill_attribute(self._to_object, to_object)
83 self._fill_attribute(self._to_offset, to_offset)
84 self._fill_attribute(self._from_object, from_object)
85 self._fill_attribute(self._from_offset, from_offset)