def setWidth(self, width):
"""B.setWidth(float) -- modify width attribute"""
- self._fillAttribute(self._width, width)
+ self._width.setValue(width)
pass
def setLength(self, length):
"""B.setLength(float) -- modify length attribute"""
- self._fillAttribute(self._length, length)
+ self._length.setValue(length)
pass
def setHeight(self, height):
"""B.setHeight(float) -- modify height attribute"""
- self._fillAttribute(self._height, height)
+ self._height.setValue(height)
pass
import ModelAPI
-from model import tools
-
-
class Feature(ModelAPI.ModelAPI_Feature):
"""Base class of user-defined Python features."""
"""x.__init__(...) initializes x; see x.__class__.__doc__ for signature"""
self._feature = feature
- def __getattr__(self, name):
- """Process missing attributes.
-
- Add get*() methods for access feature attributes.
- """
- if name.startswith("get"):
- possible_names = [
- "_" + name[3:],
- "_" + tools.convert_to_underscore(name[3:]),
- ]
- for possible_name in possible_names:
- if hasattr(self, possible_name):
- def getter():
- return getattr(self, possible_name)
- return getter
-
- raise AttributeError()
-
- def _fillAttribute(self, attribute, value):
- """Fill ModelAPI_Attribute* with value."""
- tools.fill_attribute(attribute, value)
-
def feature(self):
"""Return ModelAPI_Feature."""
return self._feature