Salome HOME
Merge branch 'python_parametric_api' of https://git.salome-platform.org/git/modules...
[modules/shaper.git] / src / PythonAPI / model / sketcher / point.py
1 """Sketch point feature interface."""
2
3 from GeomDataAPI import geomDataAPI_Point2D
4 from model.roots import Interface
5 from model.errors import FeatureInputInvalid
6
7 class Point(Interface):
8     """Interface on point feature for data manipulation."""
9     def __init__(self, feature, x, y):
10         Interface.__init__(self, feature)
11         assert(self._feature.getKind() == "SketchPoint")
12         
13         # Initialize attributes of the feature
14         self._point_data = geomDataAPI_Point2D(
15             self._feature.data().attribute("PointCoordinates")
16             )
17         self.setValue(x, y)
18         self.execute()
19
20     def setValue(self, x, y):
21         """Set point coordinates."""
22         self._point_data.setValue(x, y)
23
24     def pointData (self):
25         """Return the point data."""
26         return self._point_data
27
28     def result (self):
29         """Return the feature result."""
30         return self._point_feature.firstResult()