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)
24 self._CreationMethod = self._feature.string("CreationMethod")
25 self._to_size = self._feature.data().real("to_size")
26 self._from_size = self._feature.data().real("from_size")
27 self._to_object = self._feature.data().selection("to_object")
28 self._to_offset = self._feature.data().real("to_offset")
29 self._from_object = self._feature.data().selection("from_object")
30 self._from_offset = self._feature.data().real("from_offset")
32 assert(self._CreationMethod)
34 assert(self._from_size)
35 assert(self._to_object)
36 assert(self._to_offset)
37 assert(self._from_object)
38 assert(self._from_offset)
43 assert(len(args) == 4 or len(args) == 2)
45 self.setPlanesAndOffsets(*args)
51 self._CreationMethod.setValue("BySizes")
52 self._fill_attribute(self._to_size, 0)
53 self._fill_attribute(self._from_size, 0)
54 self._fill_attribute(self._to_object, None)
55 self._fill_attribute(self._to_offset, 0)
56 self._fill_attribute(self._from_object, None)
57 self._fill_attribute(self._from_offset, 0)
60 def setSizes(self, to_size, from_size):
61 """Modify the to_size, from_size attributes of the feature.
66 self._CreationMethod.setValue("BySizes")
67 self._fill_attribute(self._to_size, to_size)
68 self._fill_attribute(self._from_size, from_size)
71 def setPlanesAndOffsets(self, to_object, to_offset,
72 from_object, from_offset):
73 """Modify planes and offsets attributes of the feature.
78 self._CreationMethod.setValue("ByPlanesAndOffsets")
79 self._fill_attribute(self._to_object, to_object)
80 self._fill_attribute(self._to_offset, to_offset)
81 self._fill_attribute(self._from_object, from_object)
82 self._fill_attribute(self._from_offset, from_offset)