2 Author: Sergey Pokhodenko
3 Copyright (C) 2014-20xx CEA/DEN, EDF R&D
6 from model.roots import Interface
9 def addAxis(part, *args):
10 """Add an Axis feature to the Part and return Axis.
12 Pass all args to Axis __init__ function.
15 feature = part.addFeature("Axis")
16 return Axis(feature, *args)
19 class Axis(Interface):
20 """Interface class for Axis feature.
22 Axis(feature) -> feature interface without initialization
23 Axis(feature, p1, p2) ->
24 feature interface initialized from arguments:
27 Axis(feature, face) ->
28 feature interface initialized from arguments:
29 - face -- CylindricalFace
32 def __init__(self, feature, *args):
33 """x.__init__(...) initializes x; see x.__class__.__doc__ for signature"""
34 Interface.__init__(self, feature)
35 assert(self._feature.getKind() == "Axis")
37 self._CreationMethod = self._feature.data().string("CreationMethod")
38 self._FirstPoint = self._feature.data().selection("FirstPoint")
39 self._SecondPoint = self._feature.data().selection("SecondPoint")
40 self._CylindricalFace = self._feature.data().selection("CylindricalFace")
42 assert(self._CreationMethod)
43 assert(self._FirstPoint)
44 assert(self._SecondPoint)
45 assert(self._CylindricalFace)
50 assert(len(args) in (1, 2))
54 self.setCylindricalFace(*args)
60 self._fillAttribute(self._CreationMethod, "AxisByPointsCase")
61 self._fillAttribute(self._FirstPoint, None)
62 self._fillAttribute(self._SecondPoint, None)
63 self._fillAttribute(self._CylindricalFace, None)
65 def setPoints(self, p1, p2):
66 """Modify points attribute of the feature.
71 self._fillAttribute(self._CreationMethod, "AxisByPointsCase")
72 self._fillAttribute(self._FirstPoint, p1)
73 self._fillAttribute(self._SecondPoint, p2)
76 def setCylindricalFace(self, face):
77 """Modify CylindricalFace attribute of the feature.
82 self._fillAttribute(self._CreationMethod, "AxisByCylindricalFaceCase")
83 self._fillAttribute(self._CylindricalFace, face)