Salome HOME
[PythonAPI] Remove the word shaper from some places in PythonAPI
[modules/shaper.git] / src / PythonAPI / model / parameter / parameter.py
index 7dfe03c446d4b33f4ea94f4a73e4d8a8845e5342..9bc5b5a075ea1175a01e491244238ff3f71e6e6f 100644 (file)
@@ -9,8 +9,19 @@ from model.roots import Interface
 def addParameter(part, *args):
     """Add a Parameter feature to the Part and return Parameter.
 
+    .. function:: addParameter(part, variable, expression)
+
+    Args:
+        part (ModelAPI_Document): part document
+        variable (string): variable name
+        expression (string): Python expression
+
+    Returns:
+        Parameter: parameter object
+
     Pass all args to Parameter __init__ function.
     """
+    assert(args)
     feature = part.addFeature("Parameter")
     return Parameter(feature, *args)
 
@@ -18,11 +29,13 @@ def addParameter(part, *args):
 class Parameter(Interface):
     """Interface class for Parameter feature.
 
-    Parameter(feature) -> feature interface without initialization
-    Parameter(feature, variable, expression) ->
-        feature interface initialized from arguments:
-        - variable -- variable name
-        - expression -- Python expression
+    .. function:: Point(feature)
+
+        Create interface for the feature without initialization.
+
+    .. function:: Point(feature, variable, expression)
+
+        Create interface for the feature and initialize the feature with arguments.
     """
 
     def __init__(self, feature, *args):
@@ -30,8 +43,8 @@ class Parameter(Interface):
         Interface.__init__(self, feature)
         assert(self._feature.getKind() == "Parameter")
 
-        self._variable = self._feature.data().selection("variable")
-        self._expression = self._feature.data().real("expression")
+        self._variable = self._feature.string("variable")
+        self._expression = self._feature.string("expression")
 
         assert(self._variable)
         assert(self._expression)
@@ -43,7 +56,7 @@ class Parameter(Interface):
         self.setName(args[0])
         self.setExpression(args[1])
 
-        self._execute()
+        self.execute()
         pass
 
     def setName(self, name):
@@ -51,7 +64,7 @@ class Parameter(Interface):
 
         See __init__.
         """
-        self._fill_attribute(self._name, name)
+        self._fillAttribute(self._variable, name)
         pass
 
     def setExpression(self, expression):
@@ -59,5 +72,5 @@ class Parameter(Interface):
 
         See __init__.
         """
-        self._fill_attribute(self._expression, expression)
+        self._fillAttribute(self._expression, expression)
         pass