]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Improve PythonAPI documentstion.
authorspo <sergey.pokhodenko@opencascade.com>
Mon, 2 Nov 2015 14:15:36 +0000 (17:15 +0300)
committerspo <sergey.pokhodenko@opencascade.com>
Mon, 2 Nov 2015 14:15:52 +0000 (17:15 +0300)
26 files changed:
src/PythonAPI/extension/box.py
src/PythonAPI/model/__init__.py
src/PythonAPI/model/construction/axis.py
src/PythonAPI/model/construction/plane.py
src/PythonAPI/model/construction/point.py
src/PythonAPI/model/exchange/exchange.py
src/PythonAPI/model/features/boolean.py
src/PythonAPI/model/features/extrusion.py
src/PythonAPI/model/features/extrusion_boolean.py
src/PythonAPI/model/features/extrusion_sketch.py
src/PythonAPI/model/features/group.py
src/PythonAPI/model/features/partition.py
src/PythonAPI/model/features/placement.py
src/PythonAPI/model/features/revolution.py
src/PythonAPI/model/features/revolution_boolean.py
src/PythonAPI/model/features/revolution_sketch.py
src/PythonAPI/model/features/roots.py
src/PythonAPI/model/features/rotation.py
src/PythonAPI/model/features/translation.py
src/PythonAPI/model/parameter/parameter.py
src/PythonAPI/model/partset/part.py
src/PythonAPI/model/roots.py
src/PythonAPI/model/sketcher/sketch.py
src/PythonAPI/model/tools.py
src/PythonAddons/addons_Features.py
src/PythonAddons/macros/box/feature.py

index 4cdfa75a2c870383449b54a616d130a8e2f1e7fa..6808cd4412632a520c1ecf8ff5b6d7aa79de4f14 100644 (file)
@@ -7,15 +7,26 @@ from model import Interface
 from macros.box.feature import BoxFeature as MY
 
 
-def addBox(container, *args):
-    feature = container.addFeature(MY.ID())
+def addBox(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."""
+    """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())
 
@@ -40,13 +51,16 @@ class Box(Interface):
         pass
 
     def setWidth(self, width):
+        """B.setWidth(float) -- modify width attribute"""
         self._fill_attribute(self._width, width)
         pass
 
     def setLength(self, length):
+        """B.setLength(float) -- modify length attribute"""
         self._fill_attribute(self._length, length)
         pass
 
     def setHeight(self, height):
+        """B.setHeight(float) -- modify height attribute"""
         self._fill_attribute(self._height, height)
         pass
index 26c520ca06da5de20a97529c5e57270b6b74bec3..3a8c553ae55484d033b6f615776865496ef2d784 100644 (file)
@@ -15,6 +15,7 @@ from tools import Selection
 # Built-in features
 
 from sketcher.sketch  import addSketch
+from connection import *
 from construction import *
 from exchange import *
 from features import *
index 9152310b67983954f1d6b9dde91cefb3002c2a14..0afedf9bb10e10c6cd8905679b020981a8843afc 100644 (file)
@@ -16,21 +16,20 @@ def addAxis(part, *args):
 
 
 class Axis(Interface):
-    """Interface on an Axis feature."""
+    """Interface class for Axis feature.
+
+    Axis(feature) -> feature interface without initialization
+    Axis(feature, p1, p2) ->
+        feature interface initialized from arguments:
+        - p1 -- FirstPoint
+        - p2 -- SecondPoint
+    Axis(feature, face) ->
+        feature interface initialized from arguments:
+        - face -- CylindricalFace
+    """
 
     def __init__(self, feature, *args):
-        """Initialize an Axis feature with given parameters.
-
-        Expected arguments for all modes:
-        feature -- a Axis feature
-
-        For AxisByPointsCase mode (expect 2 arguments):
-        p1 -- FirstPoint
-        p2 -- SecondPoint
-
-        For AxisByCylindricalFaceCase mode (expect 1 argument):
-        face -- CylindricalFace
-        """
+        """x.__init__(...) initializes x; see x.__class__.__doc__ for signature"""
         Interface.__init__(self, feature)
         assert(self._feature.getKind() == "Axis")
 
index 0da5060062117d000ded87528d8096a2ff2097e9..b2144d9ecaa0350a11796fd2bb975b77f7438f8f 100644 (file)
@@ -16,21 +16,20 @@ def addPlane(part, *args):
 
 
 class Plane(Interface):
-    """Interface on a Plane feature."""
+    """Interface class for Plane feature.
+
+    Plane(feature) -> feature interface without initialization
+    Plane(feature, face, distance) ->
+        feature interface initialized from arguments:
+        - face -- planeFace
+        - distance -- distance
+    Plane(feature, a, b, c, d) ->
+        feature interface initialized from arguments:
+        - A, B, C, D -- GeneralEquation parameters
+    """
 
     def __init__(self, feature, *args):
-        """Initialize a Plane feature with given parameters.
-
-        Expected arguments for all modes:
-        feature -- a Plane feature
-
-        For PlaneByFaceAndDistance mode (expect 2 arguments):
-        face -- planeFace
-        distance -- distance
-
-        For PlaneByGeneralEquation mode (expect 4 arguments):
-        A, B, C, D -- GeneralEquation parameters
-        """
+        """x.__init__(...) initializes x; see x.__class__.__doc__ for signature"""
         Interface.__init__(self, feature)
         assert(self._feature.getKind() == "Plane")
 
index fa81fcf1f3042200462d4d43859b3e95d606a1c8..d2448bc67610f3da9989f45e976a6cf036c192c0 100644 (file)
@@ -16,17 +16,16 @@ def addPoint(part, *args):
 
 
 class Point(Interface):
-    """Interface on an Point feature."""
+    """Interface class for Point feature.
 
-    def __init__(self, feature, *args):
-        """Initialize an Point feature with given parameters.
-
-        Expected arguments for all modes:
-        feature -- a Point feature
+    Point(feature) -> feature interface without initialization
+    Point(feature, x, y, z) ->
+        feature interface initialized from arguments:
+        - x, y, z -- coordinates for the point
+    """
 
-        Expected arguments for initializing the feature:
-        x, y, z -- x, y, z coordinates for the point.
-        """
+    def __init__(self, feature, *args):
+        """x.__init__(...) initializes x; see x.__class__.__doc__ for signature"""
         Interface.__init__(self, feature)
         assert(self._feature.getKind() == "Point")
 
index 375c6fd01a212b3ab81c271f9bd7eb3184ebd0fd..a7b7daa0ec311d3507010144c7dcb46cdb95771c 100644 (file)
@@ -16,17 +16,16 @@ def addImport(part, *args):
 
 
 class Import(Interface):
-    """Interface on an Import feature."""
+    """Interface class for Import feature.
 
-    def __init__(self, feature, *args):
-        """Initialize an Import feature with given parameters.
-
-        Expected arguments for all modes:
-        feature -- an Import feature
+    Import(feature) -> feature interface without initialization
+    Import(feature, file_path) ->
+        feature interface initialized from arguments:
+        - file_path -- path to the imported file
+    """
 
-        For initialization (expect 1 argument):
-        file_path -- path to the imported file
-        """
+    def __init__(self, feature, *args):
+        """x.__init__(...) initializes x; see x.__class__.__doc__ for signature"""
         Interface.__init__(self, feature)
         assert(self._feature.getKind() == "Import")
 
@@ -62,19 +61,18 @@ def exportToFile(part, *args):
 
 
 class Export(Interface):
-    """Interface on an Export feature."""
+    """Interface class for Export feature.
+
+    Export(feature) -> feature interface without initialization
+    Export(feature, file_path, file_format, selection_list) ->
+        feature interface initialized from arguments:
+        - file_path -- path to the exported file
+        - file_format -- format of to the exported file
+        - selection_list -- objects to export
+    """
 
     def __init__(self, feature, *args):
-        """Initialize an Export feature with given parameters.
-
-        Expected arguments for all modes:
-        feature -- an Export feature
-
-        For initialization (expect 3 argument):
-        file_path -- path to the exported file
-        file_format -- format of to the exported file
-        objects -- objects to export
-        """
+        """x.__init__(...) initializes x; see x.__class__.__doc__ for signature"""
         Interface.__init__(self, feature)
         assert(self._feature.getKind() == "Export")
 
index 78cfbefb81fdb9afed0b0045e47d0f1ba93c1617..d746ffefdcaa84b2829f7e2e84ce93bb49e23fa0 100644 (file)
@@ -35,8 +35,15 @@ def addIntersection(part, object, tool):
 
 
 class Boolean(Interface):
-    """Abstract root class of Boolean Features."""
+    """Interface class for Boolean features.
+
+    Boolean(feature) -> feature interface without initialization
+    Boolean(feature, main_objects, tool_objects, bool_type) ->
+        feature interface initialized from arguments
+    """
+
     def __init__(self, feature, *args):
+        """x.__init__(...) initializes x; see x.__class__.__doc__ for signature"""
         Interface.__init__(self, feature)
         assert(self._feature.getKind() == "Boolean")
 
@@ -62,13 +69,22 @@ class Boolean(Interface):
         pass
 
     def setMainObjects(self, main_objects):
+        """F.setMainObjects(iterable) -- modify main_objects attribute"""
         self._fill_attribute(self._main_objects, main_objects)
         pass
 
     def setToolObjects(self, tool_objects):
+        """F.setToolObjects(iterable) -- modify tool_objects attribute"""
         self._fill_attribute(self._tool_objects, tool_objects)
         pass
 
     def setBoolType(self, bool_type):
+        """F.setBoolType(integer) -- modify bool_type attribute.
+
+        Available types:
+        - GeomAlgoAPI_Boolean.BOOL_FUSE
+        - GeomAlgoAPI_Boolean.BOOL_CUT
+        - GeomAlgoAPI_Boolean.BOOL_COMMON
+        """
         self._fill_attribute(self._bool_type, bool_type)
         pass
index 0f1cbea8341df448cd2e503c94598d843d66e81e..a6a18ee024ea4810cc68ef6a01a0617799f1062c 100644 (file)
@@ -18,28 +18,29 @@ def addExtrusion(part, *args):
 
 
 class Extrusion(Interface):
-    """Interface on an Extrusion feature."""
+    """Interface class for Extrusion feature.
+
+    Extrusion(feature) -> feature interface without initialization
+    Extrusion(feature, base, size) ->
+        feature interface initialized from arguments:
+        - base -- name, sketch or list of names and sketches
+        - size -- if positive -> to_size, if negative -> from_size
+    Extrusion(feature, base, to_size, from_size) ->
+        feature interface initialized from arguments:
+        - base -- name, sketch or list of names and sketches
+        - to_size -- upper size
+        - from_size -- lower size
+    Extrusion(feature, base, to_object, to_offset, from_object, from_offset) ->
+        feature interface initialized from arguments:
+        - base -- name, sketch or list of names and sketches
+        - to_object -- upper object (plane)
+        - to_offset -- offset from upper object
+        - from_object -- lower object (plane)
+        - from_offset -- offset from lower object
+    """
 
     def __init__(self, feature, *args):
-        """Initialize an Extrusion feature with given parameters.
-
-        Expected arguments for all modes:
-        feature -- an Extrusion feature
-
-        Expected arguments for initializing the feature:
-        base -- name, sketch or list of names and sketches.
-        If base is None then don't change the feature.
-
-        For BySize mode (expect 2 arguments):
-        to_size -- upper size
-        from_size -- lower size
-
-        For ByPlanesAndOffsets mode (expect 4 arguments):
-        to_object -- upper object (plane)
-        to_offset -- offset from upper object
-        from_object -- lower object (plane)
-        from_offset -- offset from lower object
-        """
+        """x.__init__(...) initializes x; see x.__class__.__doc__ for signature"""
         Interface.__init__(self, feature)
         assert(self._feature.getKind() == "Extrusion")
 
@@ -104,7 +105,7 @@ class Extrusion(Interface):
         See __init__.
         """
         self.__clear()
-        self._CreationMethod.setValue("BySizes")
+        self._fill_attribute(self._CreationMethod, "BySizes")
         self._fill_attribute(self._to_size, to_size)
         self._fill_attribute(self._from_size, from_size)
         pass
@@ -139,4 +140,5 @@ class Extrusion(Interface):
         pass
 
     def result(self):
+        """F.result() -> list of Selection objects"""
         return [Selection(result, result.shape()) for result in (self.firstResult(),)]
index f7e168fdef15b5fc716fd55a79d1b7377bed0a57..a5b4d1e0937af2995b1760e09e7764f706d8ed4e 100644 (file)
@@ -26,8 +26,37 @@ def addExtrusionFuse(part, *args):
 
 
 class ExtrusionBoolean(CompositeBoolean):
+    """Interface class for ExtrusionBoolean features.
+
+    Supported features:
+    - ExtrusionCut
+    - ExtrusionFuse
+
+    ExtrusionBoolean(feature) -> feature interface without initialization
+    ExtrusionBoolean(feature,
+                     sketch, sketch_selection, boolean_objects,
+                     to_size, from_size) ->
+        feature interface initialized from arguments:
+        - sketch
+        - sketch_selection
+        - boolean_objects
+        - to_size
+        - from_size
+    ExtrusionBoolean(feature,
+                     sketch, sketch_selection, boolean_objects,
+                     to_object, to_offset, from_object, from_offset) ->
+        feature interface initialized from arguments:
+        - sketch
+        - sketch_selection
+        - boolean_objects
+        - to_object
+        - to_offset
+        - from_object
+        - from_offset
+    """
 
     def __init__(self, feature, *args):
+        """x.__init__(...) initializes x; see x.__class__.__doc__ for signature"""
         CompositeBoolean.__init__(self, feature, *args[:3])
         args = args[3:]
 
index bf8ae8fe1fbd6451a2ce6b46443e4a4738ce6de2..fdd436874bcbaecdbe105193155a12e072b039b9 100644 (file)
@@ -17,8 +17,30 @@ def addExtrusionSketch(part, *args):
 
 
 class ExtrusionSketch(CompositeSketch):
-
+    """Interface class for ExtrusionSketch feature.
+
+    ExtrusionSketch(feature) -> feature interface without initialization
+    ExtrusionSketch(feature,
+                    sketch, sketch_selection,
+                    to_size, from_size) ->
+        feature interface initialized from arguments:
+        - sketch
+        - sketch_selection
+        - to_size
+        - from_size
+    ExtrusionSketch(feature,
+                    sketch, sketch_selection,
+                    to_object, to_offset, from_object, from_offset) ->
+        feature interface initialized from arguments:
+        - sketch
+        - sketch_selection
+        - to_object
+        - to_offset
+        - from_object
+        - from_offset
+    """
     def __init__(self, feature, *args):
+        """x.__init__(...) initializes x; see x.__class__.__doc__ for signature"""
         CompositeSketch.__init__(self, feature, *args[:2])
         args = args[2:]
 
index e6a7602ac8f639c839598cd30732617fb8894f97..d0c4207e6983dd47767f89db42d8229937e8fb0b 100644 (file)
@@ -17,8 +17,16 @@ def addGroup(part, *args):
 
 
 class Group(Interface):
+    """Interface class for Group feature.
+
+    Group(feature) -> feature interface without initialization
+    Group(feature, group_list) ->
+        feature interface initialized from arguments:
+        - group_list
+    """
 
     def __init__(self, feature, *args):
+        """x.__init__(...) initializes x; see x.__class__.__doc__ for signature"""
         Interface.__init__(self, feature)
         assert(self._feature.getKind() == "Group")
 
index f1064152cd2fbc85a37d2a97cdcb7c6656e4876a..04876d232e2a486e280253da25806fd9e397a6ab 100644 (file)
@@ -17,19 +17,18 @@ def addPartition(part, *args):
 
 
 class Partition(Interface):
-    """Interface on an Partition feature."""
+    """Interface class for Partition feature.
+
+    Partition(feature) -> feature interface without initialization
+    Partition(feature, main_objects, tool_objects, partition_combine) ->
+        feature interface initialized from arguments:
+        - main_objects -- list of solids
+        - tool_objects -- list of solids
+        - partition_combine -- boolean value
+    """
 
     def __init__(self, feature, *args):
-        """Initialize an Partition feature with given parameters.
-
-        Expected arguments:
-        feature -- an Partition feature
-
-        Expected arguments for initializing the feature:
-        main_objects -- list of solids.
-        tool_objects -- list of solids.
-        partition_combine -- boolean value.
-        """
+        """x.__init__(...) initializes x; see x.__class__.__doc__ for signature"""
         Interface.__init__(self, feature)
         assert(self._feature.getKind() == "Partition")
 
index ab8ac046fa93553cae5a64867e27c10b62a4f662..258389e970e197462598db6a8f9b3ec0f54980bc 100644 (file)
@@ -17,8 +17,21 @@ def addPlacement(part, *args):
 
 
 class Placement(Interface):
+    """Interface class for Placement feature.
+
+    Placement(feature) -> feature interface without initialization
+    Placement(feature, objects_list, start_shape, end_shape,
+              reverse_direction, centering) ->
+        feature interface initialized from arguments:
+        - objects_list
+        - start_shape
+        - end_shape
+        - reverse_direction
+        - centering
+    """
 
     def __init__(self, feature, *args):
+        """x.__init__(...) initializes x; see x.__class__.__doc__ for signature"""
         Interface.__init__(self, feature)
         assert(self._feature.getKind() == "Placement")
 
index 6b0fdd21a0474bc6e27414587c0200b35f0e46b7..662190a1b6a69d6290c04f9dc4da4af7e9304f6d 100644 (file)
@@ -17,29 +17,28 @@ def addRevolution(part, *args):
 
 
 class Revolution(Interface):
-    """Interface on an Revolution feature."""
+    """Interface class for Revolution features.
+
+    Revolution(feature) -> feature interface without initialization
+    Revolution(feature, base, axis_object, to_angle, from_angle) ->
+        feature interface initialized from arguments:
+        - base -- name, sketch or list of names and sketches
+        - axis_object -- name, edge for axis
+        - to_angle -- upper angle
+        - from_angle -- lower angle
+    Revolution(feature, base, axis_object,
+               to_object, to_offset, from_object, from_offset) ->
+        feature interface initialized from arguments:
+        - base -- name, sketch or list of names and sketches
+        - axis_object -- name, edge for axis
+        - to_object -- upper object (plane)
+        - to_offset -- offset from upper object
+        - from_object -- lower object (plane)
+        - from_offset -- offset from lower object
+    """
 
     def __init__(self, feature, *args):
-        """Initialize an Revolution feature with given parameters.
-
-        Expected arguments for all modes:
-        feature -- an Revolution feature
-
-        Expected arguments for initializing the feature:
-        base -- name, sketch or list of names and sketches.
-        If base is None then don't change the feature.
-        axis_object -- name, edge for axis
-
-        For ByAngles mode (expect 2 arguments):
-        to_angle -- upper angle
-        from_angle -- lower angle
-
-        For ByPlanesAndOffsets mode (expect 4 arguments):
-        to_object -- upper object (plane)
-        to_offset -- offset from upper object
-        from_object -- lower object (plane)
-        from_offset -- offset from lower object
-        """
+        """x.__init__(...) initializes x; see x.__class__.__doc__ for signature"""
         Interface.__init__(self, feature)
         assert(self._feature.getKind() == "Revolution")
 
index d93b9f034f66c05b5fe3240eaa99b711b310186f..2b80d0c88a50849e4071027631feffbde17831f9 100644 (file)
@@ -26,8 +26,37 @@ def addRevolutionFuse(part, *args):
 
 
 class RevolutionBoolean(CompositeBoolean):
+    """Interface class for RevolutionBoolean features.
+
+    Supported features:
+    - RevolutionCut
+    - RevolutionFuse
+
+    RevolutionBoolean(feature) -> feature interface without initialization
+    RevolutionBoolean(feature,
+                      sketch, sketch_selection, boolean_objects,
+                      to_angle, from_angle) ->
+        feature interface initialized from arguments:
+        - sketch
+        - sketch_selection
+        - boolean_objects
+        - to_angle
+        - from_angle
+    RevolutionBoolean(feature,
+                      sketch, sketch_selection, boolean_objects,
+                      to_object, to_offset, from_object, from_offset) ->
+        feature interface initialized from arguments:
+        - sketch
+        - sketch_selection
+        - boolean_objects
+        - to_object
+        - to_offset
+        - from_object
+        - from_offset
+    """
 
     def __init__(self, feature, *args):
+        """x.__init__(...) initializes x; see x.__class__.__doc__ for signature"""
         CompositeBoolean.__init__(self, feature, *args[:3])
         args = args[3:]
 
index 20d896e74a4c394e87faceb4463f0deac5b18979..55e751cc43927057888f21a662937e3b1b657fbb 100644 (file)
@@ -17,8 +17,31 @@ def addRevolutionSketch(part, *args):
 
 
 class RevolutionSketch(CompositeSketch):
+    """Interface class for RevolutionSketch features.
+
+    RevolutionSketch(feature) -> feature interface without initialization
+    RevolutionSketch(feature,
+                     sketch, sketch_selection,
+                     to_angle, from_angle) ->
+        feature interface initialized from arguments:
+        - sketch
+        - sketch_selection
+        - to_angle
+        - from_angle
+    RevolutionSketch(feature,
+                     sketch, sketch_selection,
+                     to_object, to_offset, from_object, from_offset) ->
+        feature interface initialized from arguments:
+        - sketch
+        - sketch_selection
+        - to_object
+        - to_offset
+        - from_object
+        - from_offset
+    """
 
     def __init__(self, feature, *args):
+        """x.__init__(...) initializes x; see x.__class__.__doc__ for signature"""
         CompositeSketch.__init__(self, feature, *args[:2])
         args = args[2:]
 
index a69cdd7349f65f49b8ebc9be76b59c9d71bc5058..3aa27d42cc532e95aea65b014327d97f77457e2c 100644 (file)
@@ -3,8 +3,18 @@ from model.roots import Interface
 
 
 class CompositeBoolean(Interface):
+    """Interface class for CompositeBoolean features.
+
+    CompositeBoolean(feature) -> feature interface without initialization
+    CompositeBoolean(feature, sketch, sketch_selection, boolean_objects) ->
+        feature interface initialized from arguments:
+        - sketch
+        - sketch_selection
+        - boolean_objects
+    """
 
     def __init__(self, feature, *args):
+        """x.__init__(...) initializes x; see x.__class__.__doc__ for signature"""
         Interface.__init__(self, feature)
 
         self._sketch = self._feature.reference("sketch")
@@ -27,21 +37,34 @@ class CompositeBoolean(Interface):
         pass
 
     def setSketch(self, sketch):
+        """Modify sketch attribute"""
         self._fill_attribute(self._sketch, sketch)
         pass
 
     def setSketchSelection(self, sketch_selection):
+        """Modify sketch_selection attribute"""
         self._fill_attribute(self._sketch_selection, sketch_selection)
         pass
 
     def setBooleanObjects(self, boolean_objects):
+        """Modify boolean_objects attribute"""
         self._fill_attribute(self._boolean_objects, boolean_objects)
         pass
 
 
 class CompositeSketch(Interface):
+    """Interface class for CompositeSketch features.
+
+    CompositeSketch(feature) -> feature interface without initialization
+    CompositeSketch(feature, sketch, sketch_selection) ->
+        feature interface initialized from arguments:
+        - sketch
+        - sketch_selection
+    """
+
 
     def __init__(self, feature, *args):
+        """x.__init__(...) initializes x; see x.__class__.__doc__ for signature"""
         Interface.__init__(self, feature)
 
         self._sketch = self._feature.reference("sketch")
@@ -61,9 +84,11 @@ class CompositeSketch(Interface):
         pass
 
     def setSketch(self, sketch):
+        """Modify sketch attribute"""
         self._fill_attribute(self._sketch, sketch)
         pass
 
     def setSketchSelection(self, sketch_selection):
+        """Modify sketch_selection attribute"""
         self._fill_attribute(self._sketch_selection, sketch_selection)
         pass
index 3318cd16bdb1b16520243d64dcaf3af55526d36b..2c8b044a03c44e554cb68be72d92372c63ef926f 100644 (file)
@@ -17,8 +17,18 @@ def addRotation(part, *args):
 
 
 class Rotation(Interface):
+    """Interface class for Rotation features.
+
+    Rotation(feature) -> feature interface without initialization
+    Rotation(feature, main_objects, axis_object, angle) ->
+        feature interface initialized from arguments:
+        - main_objects
+        - axis_object
+        - angle
+    """
 
     def __init__(self, feature, *args):
+        """x.__init__(...) initializes x; see x.__class__.__doc__ for signature"""
         Interface.__init__(self, feature)
         assert(self._feature.getKind() == "Rotation")
 
index 1004b8ea61b1892fa184d26d7cf0cb814a46695a..802b4d8e81f3b5a933eed327d2dcd9929f6f4d6d 100644 (file)
@@ -17,8 +17,18 @@ def addTranslation(part, *args):
 
 
 class Translation(Interface):
+    """Interface class for Translation features.
+
+    Translation(feature) -> feature interface without initialization
+    Translation(feature, main_objects, axis_object, distance) ->
+        feature interface initialized from arguments:
+        - main_objects
+        - axis_object
+        - distance
+    """
 
     def __init__(self, feature, *args):
+        """x.__init__(...) initializes x; see x.__class__.__doc__ for signature"""
         Interface.__init__(self, feature)
         assert(self._feature.getKind() == "Translation")
 
index 51c9024fd3707415119c035cdc0350cb6f786710..7dfe03c446d4b33f4ea94f4a73e4d8a8845e5342 100644 (file)
@@ -16,18 +16,17 @@ def addParameter(part, *args):
 
 
 class Parameter(Interface):
-    """Interface on a Parameter feature."""
+    """Interface class for Parameter feature.
 
-    def __init__(self, feature, *args):
-        """Initialize a Parameter feature with given parameters.
-
-        Expected arguments for all modes:
-        feature -- a Parameter feature
+    Parameter(feature) -> feature interface without initialization
+    Parameter(feature, variable, expression) ->
+        feature interface initialized from arguments:
+        - variable -- variable name
+        - expression -- Python expression
+    """
 
-        For initialization (expect 2 arguments):
-        name -- variable name
-        expression -- Python expression
-        """
+    def __init__(self, feature, *args):
+        """x.__init__(...) initializes x; see x.__class__.__doc__ for signature"""
         Interface.__init__(self, feature)
         assert(self._feature.getKind() == "Parameter")
 
index e916975ff765f0dd73608ffd9ae836a594736fe5..a9bce9b3bafe9fe7e188c03639805623e5022a6c 100644 (file)
@@ -29,9 +29,13 @@ def removePart(part):
 
 
 class Part(Interface):
+    """Interface class for Part feature.
+
+    Part(feature) -> feature interface without initialization
+    """
 
     def __init__(self, feature):
-        """Adds a new Part to the given Partset and activates the Part."""
+        """x.__init__(...) initializes x; see x.__class__.__doc__ for signature"""
         Interface.__init__(self, feature)
         assert(self._feature.getKind() == "Part")
 
index e3d794efab6ac512bf0d247555127684bfc29430..1fa83ee5715acdf3678cfd57e83543b126fb08e3 100644 (file)
@@ -12,16 +12,20 @@ class Feature(ModelAPI.ModelAPI_Feature):
     """Base class of user-defined Python features."""
 
     def __init__(self):
+        """x.__init__(...) initializes x; see x.__class__.__doc__ for signature"""
         ModelAPI.ModelAPI_Feature.__init__(self)
 
-    def addRealInput (self, inputid):
+    def addRealInput(self, inputid):
+        """F.addRealInput(str) -- add real attribute"""
         self.data().addAttribute(inputid,
                                  ModelAPI.ModelAPI_AttributeDouble_typeId())
 
-    def getRealInput (self, inputid):
+    def getRealInput(self, inputid):
+        """F.getRealInput(str) -- get real value of the attribute"""
         return self.data().real(inputid).value()
 
-    def addResult (self, result):
+    def addResult(self, result):
+        """F.addResult(ModelAPI_Result) -- add ModelAPI_Result shape as a result"""
         shape = result.shape()
         body = self.document().createBody(self.data())
         body.store(shape)
@@ -32,6 +36,7 @@ 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
         self._attribute_white_list = [
             "execute",
@@ -69,13 +74,19 @@ class Interface():
         tools.fill_attribute(attribute, value)
 
     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:
index a47759071958424249545130b616a119e324fbe4..636ccd5dbb2ad0aadefea098e294fa7be89bcb2b 100644 (file)
@@ -27,7 +27,7 @@ def addSketch(doc, plane):
     return Sketch(feature, plane)
 
 class Sketch(Interface):
-    """Interface on a Sketch feature."""
+    """Interface class for Sketch feature."""
     def __init__(self, feature, *args):
         """Initialize a 2D Sketch on the given plane.
 
index fe300d990b670624bb0f96875af5a2afca6c03c3..9971e4b697ea45763a32adf3e6a74ca58be0fc3c 100644 (file)
@@ -20,10 +20,20 @@ def convert_to_underscore(name):
 
 
 class Selection:
-    """Class for storing selection."""
+    """Class for selection.
+
+    Selection() -> empty selection
+    Selection(name, type) -> selection initialized with arguments:
+        - name -- topological name
+        - type -- type of the object
+    Selection(context, shape) -> selection initialized with arguments:
+        - context -- ModelAPI_Result object
+        - shape -- GeomAPI_Shape shape
+    """
 
     def __init__(self, *args):
-        """Initialize selection."""
+        """x.__init__(...) initializes x; see x.__class__.__doc__ for signature"""
+
         if not args:
             self.args = (None, None)
             return
index 90b23b9a9b171ded79eef7fc49ac7c3b3a5b7cdc..3ff9f26ddfa2648a0c765a5bf2c051759d88b5d4 100644 (file)
@@ -6,14 +6,20 @@ from macros.box.feature      import BoxFeature
 
 
 class PythonFeaturesPlugin(ModelAPI.ModelAPI_Plugin):
+    """Class for Python features plugin.
+
+    PythonFeaturesPlugin() -> plugin object
+    """
 
     def __init__(self):
+        """x.__init__(...) initializes x; see x.__class__.__doc__ for signature"""
         ModelAPI.ModelAPI_Plugin.__init__(self)
         aSession = ModelAPI.ModelAPI_Session.get()
         aSession.registerPlugin(self)
         pass
 
     def createFeature(self, theFeatureID):
+        """Override ModelAPI_Plugin.createFeature()"""
         aFeature = None
 
         if theFeatureID == BoxFeature.ID():
index f160a396e52a233f49c8d353dd136203b4525e54..8c6687c77701b6efb0e2027bb41395cc4965b915 100644 (file)
@@ -8,37 +8,46 @@ import geom
 
 
 class BoxFeature(model.Feature):
+    """Box feature.
 
+    BoxFeature() -> Box
+    """
 
 # Initializations
 
     def __init__(self):
+        """x.__init__(...) initializes x; see x.__class__.__doc__ for signature"""
         model.Feature.__init__(self)
 
     @staticmethod
     def ID():
+        """String constant."""
         return "Box"
 
     @staticmethod
     def WIDTH_ID():
+        """String constant."""
         return "width"
 
     @staticmethod
     def LENGTH_ID():
+        """String constant."""
         return "length"
 
     @staticmethod
     def HEIGHT_ID():
+        """String constant."""
         return "height"
 
     def getKind(self):
+        """Override Feature.getKind()"""
         return BoxFeature.ID()
 
 
 # Creation of the box at default size
 
     def initAttributes(self):
-
+        """Override Feature.initAttributes()"""
         # Creating the input arguments of the feature
         self.addRealInput(self.WIDTH_ID())
         self.addRealInput(self.LENGTH_ID())
@@ -72,9 +81,11 @@ class BoxFeature(model.Feature):
 # Edition of the box at user size
 
     def execute(self):
+        """F.execute() -- execute the feature"""
         # Retrieving the user inputs
         width = self.getRealInput(self.WIDTH_ID())
-        length = self.getRealInput(self.LENGTH_ID())
+        length = self.getRealInpuut(self.WIDTH_ID())
+        length = self.getRealInt(self.LENGTH_ID())
         height = self.getRealInput(self.HEIGHT_ID())
 
         # Editing the box
@@ -86,5 +97,10 @@ class BoxFeature(model.Feature):
         # self.addResult( self.box.result() )
 
     def isMacro(self):
-        # Box feature is macro: removes itself on the creation transaction finish
+        """Override Feature.initAttributes().
+        F.isMacro() -> True
+
+        Box feature is macro: removes itself on the creation transaction
+        finish.
+        """
         return True