"""Sketch point feature interface."""
from GeomDataAPI import geomDataAPI_Point2D
+from model.roots import Interface
+from model.errors import FeatureInputInvalid
-class Point():
+class Point(Interface):
"""Interface on point feature for data manipulation."""
- def __init__(self, point_feature, x, y):
- self._point_feature = point_feature
+ def __init__(self, feature, x, y):
+ Interface.__init__(self, feature)
+ assert(self._feature.getKind() == "SketchPoint")
+
+ # Initialize attributes of the feature
self._point_data = geomDataAPI_Point2D(
- self._point_feature.data().attribute("PointCoordinates")
+ self._feature.data().attribute("PointCoordinates")
)
+ self.setValue(x, y)
+ self.execute()
+
+ def setValue(self, x, y):
+ """Set point coordinates."""
self._point_data.setValue(x, y)
- self._point_feature.execute()
def pointData (self):
"""Return the point data."""