]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Improve sketcher.line feature.
authorspo <sergey.pokhodenko@opencascade.com>
Fri, 30 Oct 2015 12:28:44 +0000 (15:28 +0300)
committerspo <sergey.pokhodenko@opencascade.com>
Fri, 30 Oct 2015 13:42:53 +0000 (16:42 +0300)
src/PythonAPI/model/sketcher/line.py

index 6d53e0b9f788c5589a6b62094c131f73c00ccdca..2c2113244292c2bb57447c53664e88f5bb14bda3 100644 (file)
@@ -15,6 +15,15 @@ class Line(Interface):
         self._end_point = geomDataAPI_Point2D(
             self._feature.data().attribute("EndPoint")
             )
+
+        assert(self._start_point)
+        assert(self._end_point)
+
+        if not args:
+            return
+
+        assert(len(args) in (1, 2, 4))
+
         # Set attribute values and execute
         if len(args) == 4:
             self.__createByCoordinates(*args)
@@ -22,24 +31,23 @@ class Line(Interface):
             self.__createByPoints(*args)
         elif len(args) == 1:
             self.__createByName(*args)
-        else:
-            raise WrongNumberOfArguments(
-                "Arc takes 1, 2 or 4 arguments (%s given)" % len(args)
-                )
+
+        self._execute()
+        pass
 
     def __createByCoordinates(self, x1, y1, x2, y2):
         self._start_point.setValue(x1, y1)
         self._end_point.setValue(x2, y2)
-        self._feature.execute()
+        pass
 
     def __createByPoints(self, p1, p2):
         self._start_point.setValue(p1.x(), p1.y())
         self._end_point.setValue(p2.x(), p2.y())
-        self._feature.execute()
+        pass
 
     def __createByName(self, name):
         self._feature.data().selection("External").selectSubShape("EDGE", name)
-        self._feature.execute()
+        pass
 
     def startPointData(self):
         return self._start_point
@@ -48,4 +56,4 @@ class Line(Interface):
         return self._end_point
 
     def result(self):
-        return self._feature.firstResult()
\ No newline at end of file
+        return self._feature.firstResult()