def addAxis(part, *args):
- """Add an Axis feature to the Part and return Axis.
+ """Add an Axis feature to the Part.
- Pass all args to Axis __init__ function.
+ .. function:: addAxis(part, p1, p2)
+
+ Args:
+ part (ModelAPI_Document): part document
+ p1 (Selection): first point
+ p2 (Selection): second point
+
+ .. function:: addAxis(part, face)
+
+ Args:
+ part (ModelAPI_Document): part document
+ face (Selection): cylindrical face
+
+ Returns:
+ Axis: axis object
"""
+ assert(args)
feature = part.addFeature("Axis")
return Axis(feature, *args)
class Axis(Interface):
- """Interface on an Axis feature."""
+ """Interface class for Axis feature.
- def __init__(self, feature, *args):
- """Initialize an Axis feature with given parameters.
+ .. function:: Axis(feature)
- Expected arguments for all modes:
- feature -- a Axis feature
+ Create interface for the feature without initialization.
- For AxisByPointsCase mode (expect 2 arguments):
- p1 -- FirstPoint
- p2 -- SecondPoint
+ .. function:: Axis(feature, p1, p2)
- For AxisByCylindricalFaceCase mode (expect 1 argument):
- face -- CylindricalFace
- """
+ Create interface for the feature and initialize the feature with arguments.
+
+ .. function:: Axis(feature, face)
+
+ Create interface for the feature and initialize the feature with arguments.
+ """
+
+ def __init__(self, feature, *args):
+ """x.__init__(...) initializes x; see x.__class__.__doc__ for signature"""
Interface.__init__(self, feature)
assert(self._feature.getKind() == "Axis")
if not args:
return
- assert(len(args) == 2 or len(args) == 1)
+ assert(len(args) in (1, 2))
if len(args) == 2:
self.setPoints(*args)
elif len(args) == 1:
self.setCylindricalFace(*args)
+
+ self.execute()
pass
def __clear(self):
- self._fill_attribute(self._CreationMethod, "AxisByPointsCase")
- self._fill_attribute(self._FirstPoint, None)
- self._fill_attribute(self._SecondPoint, None)
- self._fill_attribute(self._CylindricalFace, None)
+ self._fillAttribute(self._CreationMethod, "AxisByPointsCase")
+ self._fillAttribute(self._FirstPoint, None)
+ self._fillAttribute(self._SecondPoint, None)
+ self._fillAttribute(self._CylindricalFace, None)
def setPoints(self, p1, p2):
"""Modify points attribute of the feature.
See __init__.
"""
self.__clear()
- self._fill_attribute(self._CreationMethod, "AxisByPointsCase")
- self._fill_attribute(self._FirstPoint, p1)
- self._fill_attribute(self._SecondPoint, p2)
+ self._fillAttribute(self._CreationMethod, "AxisByPointsCase")
+ self._fillAttribute(self._FirstPoint, p1)
+ self._fillAttribute(self._SecondPoint, p2)
pass
def setCylindricalFace(self, face):
See __init__.
"""
self.__clear()
- self._fill_attribute(self._CreationMethod, "AxisByCylindricalFaceCase")
- self._fill_attribute(self._CylindricalFace, face)
+ self._fillAttribute(self._CreationMethod, "AxisByCylindricalFaceCase")
+ self._fillAttribute(self._CylindricalFace, face)
pass