From 045c5dbfda26ceff6a3abcf4de45944e00906494 Mon Sep 17 00:00:00 2001 From: spo Date: Thu, 17 Dec 2015 14:03:33 +0300 Subject: [PATCH] [PythonAPI] Add to arc support of inversion. --- src/PythonAPI/model/sketcher/arc.py | 21 +++++++++++++-------- src/PythonAPI/model/sketcher/sketch.py | 4 ++-- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/src/PythonAPI/model/sketcher/arc.py b/src/PythonAPI/model/sketcher/arc.py index 212666af8..7502a6b56 100644 --- a/src/PythonAPI/model/sketcher/arc.py +++ b/src/PythonAPI/model/sketcher/arc.py @@ -6,7 +6,7 @@ from model.roots import Interface class Arc(Interface): """Interface to a sketch arc feature.""" - def __init__(self, feature, *args): + def __init__(self, feature, *args, **kwargs): Interface.__init__(self, feature) assert(self._feature.getKind() == "SketchArc") @@ -19,6 +19,7 @@ class Arc(Interface): self._end_point = geomDataAPI_Point2D( self._feature.data().attribute("ArcEndPoint") ) + self._inversed = self._feature.boolean("InversedArc") if len(args) == 6: self.__createByCoordinates(*args) elif len(args) == 3: @@ -27,9 +28,11 @@ class Arc(Interface): raise WrongNumberOfArguments( "Arc takes 3 or 6 arguments (%s given)" % len(args) ) + if "inversed" in kwargs: + self.setInversed(kwargs["inversed"]) self.execute() - - + + ######## # # Getters @@ -52,26 +55,28 @@ class Arc(Interface): def result(self): """Return the arc circular line attribute.""" return self._feature.lastResult() - - + + ######## # # Set methods # ######## - + def setCenter(self, x, y): """Set arc center.""" self._center.setValue(x, y) - + def setStartPoint(self, x, y): """Set start point.""" self._start_point.setValue(x, y) - + def setEndPoint(self, x, y): """Set end point value.""" self._end_point.setValue(x, y) + def setInversed(self, inversed): + self._fillAttribute(self._inversed, inversed) ######## # diff --git a/src/PythonAPI/model/sketcher/sketch.py b/src/PythonAPI/model/sketcher/sketch.py index 9a5c3c784..ed0b1398a 100644 --- a/src/PythonAPI/model/sketcher/sketch.py +++ b/src/PythonAPI/model/sketcher/sketch.py @@ -152,7 +152,7 @@ class Sketch(Interface): circle_feature = self._feature.addFeature("SketchCircle") return Circle(circle_feature, *args) - def addArc(self, *args): + def addArc(self, *args, **kwargs): """Add an arc of circle to the sketch and return an arc object. Two different syntaxes are allowed: @@ -176,7 +176,7 @@ class Sketch(Interface): if not args: raise TypeError("No arguments given") arc_feature = self._feature.addFeature("SketchArc") - return Arc(arc_feature, *args) + return Arc(arc_feature, *args, **kwargs) #------------------------------------------------------------- # -- 2.39.2