From: mpv Date: Fri, 11 Nov 2016 15:51:09 +0000 (+0300) Subject: Some obsolete interface python interfaces are removed X-Git-Tag: V_2.6.0~93 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=87142823ddad4e9de5cfa7fd0ffd40f810dfd280;p=modules%2Fshaper.git Some obsolete interface python interfaces are removed --- diff --git a/src/PythonAPI/CMakeLists.txt b/src/PythonAPI/CMakeLists.txt index 4de4d1062..16ce02a1b 100644 --- a/src/PythonAPI/CMakeLists.txt +++ b/src/PythonAPI/CMakeLists.txt @@ -3,7 +3,7 @@ SET(CMAKE_AUTOMOC ON) -INSTALL(DIRECTORY extension geom model examples DESTINATION ${SHAPER_INSTALL_PYTHON_API}) +INSTALL(DIRECTORY geom model examples DESTINATION ${SHAPER_INSTALL_PYTHON_API}) INSTALL(FILES shaper.py DESTINATION ${SHAPER_INSTALL_PYTHON_API}) # --------- Unit tests ----------- diff --git a/src/PythonAPI/Test/TestFeatures.py b/src/PythonAPI/Test/TestFeatures.py index 4a071252f..549d6583b 100644 --- a/src/PythonAPI/Test/TestFeatures.py +++ b/src/PythonAPI/Test/TestFeatures.py @@ -74,7 +74,9 @@ class FeaturesTestCase(FeaturesFixture): FeaturesAPI.FeaturesAPI_Placement(self.part.addFeature("Placement")) FeaturesAPI.FeaturesAPI_Rotation(self.part.addFeature("Rotation")) FeaturesAPI.FeaturesAPI_Translation(self.part.addFeature("Translation")) - FeaturesAPI.FeaturesAPI_Group(self.part.addFeature("Group")) + + import CollectionAPI + CollectionAPI.CollectionAPI_Group(self.part.addFeature("Group")) import PrimitivesAPI PrimitivesAPI.PrimitivesAPI_Box(self.part.addFeature("Box")) diff --git a/src/PythonAPI/extension/__init__.py b/src/PythonAPI/extension/__init__.py deleted file mode 100644 index 1429590dc..000000000 --- a/src/PythonAPI/extension/__init__.py +++ /dev/null @@ -1,4 +0,0 @@ -"""User-defined features. -""" - -from box import addBoxScript \ No newline at end of file diff --git a/src/PythonAPI/extension/box.py b/src/PythonAPI/extension/box.py deleted file mode 100644 index 5897da2c5..000000000 --- a/src/PythonAPI/extension/box.py +++ /dev/null @@ -1,66 +0,0 @@ -"""Box macro-feature Interface -Author: Daniel Brunier-Coulin -Copyright (C) 2014-20xx CEA/DEN, EDF R&D -""" - -from model import Interface -from macros.box.feature import BoxFeature as MY - - -def addBoxScript(part, *args): - """Add Box feature to the part and return Box. - - Pass all args to Box __init__ function. - """ - feature = part.addFeature(MY.ID()) - return Box(feature, *args) - - -class Box(Interface): - """Executes the macro-feature Box. - - Box(feature) -> feature interface without initialization - Extrusion(feature, dx, dy, dz) -> - feature interface initialized from arguments: - - dx, dy, dz -- box dimensions - """ - - def __init__(self, feature, *args): - """x.__init__(...) initializes x; see x.__class__.__doc__ for signature""" - Interface.__init__(self, feature) - assert(self._feature.getKind() == MY.ID()) - - self._width = self._feature.real(MY.WIDTH_ID()) - self._length = self._feature.real(MY.LENGTH_ID()) - self._height = self._feature.real(MY.HEIGHT_ID()) - - assert(self._width) - assert(self._length) - assert(self._height) - - if not args: - return - - assert(len(args) == 3) - dx, dy, dz = args - self.setWidth(dx) - self.setLength(dy) - self.setHeight(dz) - - self.execute() - pass - - def setWidth(self, width): - """B.setWidth(float) -- modify width attribute""" - self._width.setValue(width) - pass - - def setLength(self, length): - """B.setLength(float) -- modify length attribute""" - self._length.setValue(length) - pass - - def setHeight(self, height): - """B.setHeight(float) -- modify height attribute""" - self._height.setValue(height) - pass diff --git a/src/PythonAPI/geom/__init__.py b/src/PythonAPI/geom/__init__.py index c6faa27e3..8718d8cd3 100644 --- a/src/PythonAPI/geom/__init__.py +++ b/src/PythonAPI/geom/__init__.py @@ -20,7 +20,3 @@ from GeomAPI import GeomAPI_Shape as Shape from GeomAlgoAPI import GeomAlgoAPI_Boolean as Boolean - -# Emulation of interfaces not yet swigged - -from missed import * \ No newline at end of file diff --git a/src/PythonAPI/geom/missed.py b/src/PythonAPI/geom/missed.py deleted file mode 100644 index 247cfef3a..000000000 --- a/src/PythonAPI/geom/missed.py +++ /dev/null @@ -1,34 +0,0 @@ -# Direct Geometry API not yet swigged -# Author: Daniel Brunier-Coulin -# ----------------------------- - -#from GeomAPI import * - - -class Ax3: - """A class to represent a Coordinate system object""" - - def __init__(self, origin, normal, dirx): - """Constructor""" - ### Create an origin point - self.o = origin - ### Create a normal vector - self.n = normal - ### Create X axis direction - self.dx = dirx - - def location (self): - """Returns origin point""" - return self.o - - def direction (self): - """Returns normal direction""" - return self.n - - def xDirection (self): - """Returns direction of X axis""" - return self.dx - - def yDirection (self): - """Returns direction of Y axis""" - return self.n.cross(self.dx) diff --git a/src/PythonAPI/model/roots.py b/src/PythonAPI/model/roots.py index 77a2335ce..31316103e 100644 --- a/src/PythonAPI/model/roots.py +++ b/src/PythonAPI/model/roots.py @@ -32,51 +32,3 @@ class Feature(ModelAPI.ModelAPI_Feature): body.store(shape) self.setResult(body) - -class Interface(): - """Base class of high level Python interfaces to features.""" - - def __init__(self, feature): - """x.__init__(...) initializes x; see x.__class__.__doc__ for signature""" - self._feature = feature - - def feature(self): - """Return ModelAPI_Feature.""" - return self._feature - - def getKind(self): - """Return the unique kind of the feature""" - return self._feature.getKind() - - def results(self): - """Return current results of the feature""" - return self._feature.results() - - def firstResult(self): - """Return the first result in the list of results""" - return self._feature.firstResult() - - def lastResult(self): - """Return the last result in the list of results""" - return self._feature.lastResult() - - def setRealInput(self, inputid, value): - """I.setRealInput(str, float) -- set real value to the attribute""" - self._feature.data().real(inputid).setValue(value) - - def areInputValid(self): - """I.areInputValid() -> True or False validation result""" - validators = ModelAPI.ModelAPI_Session.get().validators() - return validators.validate(self._feature) - - def execute(self): - """I.execute() -- validate and execute the feature. - - Raises RuntimeError if validation fails. - """ - if self.areInputValid(): - self._feature.execute() - else: - raise RuntimeError("Can not execute %s: %s" % - (self._feature.getKind(), self._feature.error()) - )