From f7fdc57ae808ecd65a1c3e8ad7d3d8bdffdd4c1c Mon Sep 17 00:00:00 2001 From: Renaud NEDELEC Date: Tue, 3 Nov 2015 11:38:09 +0100 Subject: [PATCH] [PythonAPI / sketcher] small updates in sketcher API --- src/PythonAPI/model/sketcher/line.py | 7 +++---- src/PythonAPI/model/sketcher/sketch.py | 19 ++++++++----------- 2 files changed, 11 insertions(+), 15 deletions(-) diff --git a/src/PythonAPI/model/sketcher/line.py b/src/PythonAPI/model/sketcher/line.py index eb8d735e0..5ba8333a6 100644 --- a/src/PythonAPI/model/sketcher/line.py +++ b/src/PythonAPI/model/sketcher/line.py @@ -16,11 +16,10 @@ class Line(Interface): self._feature.data().attribute("EndPoint") ) - # Check that input arguments are not None + # If no arguments are given the attributes of the feature + # are'nt initialized if args is None: - raise WrongNumberOfArguments( - "No argument given, at least one argument needed" - ) + return # Set attribute values and execute if len(args) == 4: diff --git a/src/PythonAPI/model/sketcher/sketch.py b/src/PythonAPI/model/sketcher/sketch.py index 254d515ad..9920cfd11 100644 --- a/src/PythonAPI/model/sketcher/sketch.py +++ b/src/PythonAPI/model/sketcher/sketch.py @@ -55,17 +55,14 @@ class Sketch(Interface): assert(self._norm) assert(self._external) - if not args: - return - - plane = args[0] - - # self.resultype ="Face" # Type of Sketch result - if isinstance(plane, str): - self.__sketchOnFace(plane) - else: - self.__sketchOnPlane(plane) - pass + # If no arguments are given the attributes of the feature + # are not Initialized + if args is not None: + plane = args[0] + if isinstance(plane, str): + self.__sketchOnFace(plane) + else: + self.__sketchOnPlane(plane) def __sketchOnPlane(self, plane): """Create the sketch on a plane.""" -- 2.39.2