From: Sergey POKHODENKO Date: Sat, 5 Dec 2015 21:48:17 +0000 (+0300) Subject: Improve PythonAPI documentation X-Git-Tag: V_2.1.0~206^2 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=a976799ce75768f092d446cc70237f2e5575ba7c;p=modules%2Fshaper.git Improve PythonAPI documentation --- diff --git a/src/PythonAPI/model/connection/connection.py b/src/PythonAPI/model/connection/connection.py index 65e625234..da54458bc 100644 --- a/src/PythonAPI/model/connection/connection.py +++ b/src/PythonAPI/model/connection/connection.py @@ -7,6 +7,10 @@ from model.roots import Interface def exportToGEOM(part): - """Export the Part to GEOM module.""" + """Export the Part to GEOM module. + + Args: + part (ModelAPI_Document): part document + """ feature = part.addFeature("ExportToGEOM") - feature.execute() \ No newline at end of file + feature.execute() diff --git a/src/PythonAPI/model/construction/axis.py b/src/PythonAPI/model/construction/axis.py index 2c510be5a..ee92f4a37 100644 --- a/src/PythonAPI/model/construction/axis.py +++ b/src/PythonAPI/model/construction/axis.py @@ -7,9 +7,23 @@ from model.roots import Interface def addAxis(part, *args): - """Add an Axis feature to the Part and return Axis. + """Add an Axis feature to the Part. - Pass all args to Axis __init__ function. + .. function:: addAxis(part, p1, p2) + + Args: + part (ModelAPI_Document): part document + p1 (Selection): first point + p2 (Selection): second point + + .. function:: addAxis(part, face) + + Args: + part (ModelAPI_Document): part document + face (Selection): cylindrical face + + Returns: + Axis: axis object """ assert(args) feature = part.addFeature("Axis") @@ -19,14 +33,17 @@ def addAxis(part, *args): class Axis(Interface): """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 + .. function:: Axis(feature) + + Create interface for the feature without initialization. + + .. function:: Axis(feature, p1, p2) + + Create interface for the feature and initialize the feature with arguments. + + .. function:: Axis(feature, face) + + Create interface for the feature and initialize the feature with arguments. """ def __init__(self, feature, *args): diff --git a/src/PythonAPI/model/construction/plane.py b/src/PythonAPI/model/construction/plane.py index e92a1e603..c51e53032 100644 --- a/src/PythonAPI/model/construction/plane.py +++ b/src/PythonAPI/model/construction/plane.py @@ -9,7 +9,24 @@ from model.roots import Interface def addPlane(part, *args): """Add a Plane feature to the Part and return Plane. - Pass all args to Plane __init__ function. + .. function:: addPartition(part, face, distance) + + Args: + part (ModelAPI_Document): part document + face (Selection): plane face + distance (double): distance + + .. function:: addPartition(part, a, b, c, d) + + Args: + part (ModelAPI_Document): part document + a (double): general equation parameter + b (double): general equation parameter + c (double): general equation parameter + d (double): general equation parameter + + Returns: + Plane: plane object """ assert(args) feature = part.addFeature("Plane") @@ -19,14 +36,17 @@ def addPlane(part, *args): class Plane(Interface): """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 + .. function:: Plane(feature) + + Create interface for the feature without initialization. + + .. function:: Plane(feature, face, distance) + + Create interface for the feature and initialize the feature with arguments. + + .. function:: Plane(feature, a, b, c, d) + + Create interface for the feature and initialize the feature with arguments. """ def __init__(self, feature, *args): diff --git a/src/PythonAPI/model/construction/point.py b/src/PythonAPI/model/construction/point.py index b7ef7d78d..db3405fb4 100644 --- a/src/PythonAPI/model/construction/point.py +++ b/src/PythonAPI/model/construction/point.py @@ -9,7 +9,16 @@ from model.roots import Interface def addPoint(part, *args): """Add an Point feature to the Part and return Point. - Pass all args to Point __init__ function. + .. function:: addPoint(part, x, y, z) + + Args: + part (ModelAPI_Document): part document + x (double): X coordinate for the point + y (double): Y coordinate for the point + z (double): Z coordinate for the point + + Returns: + Point: point object """ assert(args) feature = part.addFeature("Point") @@ -19,10 +28,13 @@ def addPoint(part, *args): class Point(Interface): """Interface class for 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 + .. function:: Point(feature) + + Create interface for the feature without initialization. + + .. function:: Point(feature, x, y, z) + + Create interface for the feature and initialize the feature with arguments. """ def __init__(self, feature, *args): diff --git a/src/PythonAPI/model/exchange/exchange.py b/src/PythonAPI/model/exchange/exchange.py index 67d1de38a..c884451af 100644 --- a/src/PythonAPI/model/exchange/exchange.py +++ b/src/PythonAPI/model/exchange/exchange.py @@ -7,9 +7,16 @@ from model.roots import Interface def addImport(part, *args): - """Add an Import feature to the Part and return Import. + """Add an Import feature to the Part. - Pass all args to Import __init__ function. + .. function:: addImport(part, file_path) + + Args: + part (ModelAPI_Document): part document + file_path (string): path to the imported file + + Returns: + Import: import object """ assert(args) feature = part.addFeature("Import") @@ -19,10 +26,13 @@ def addImport(part, *args): class Import(Interface): """Interface class for Import feature. - Import(feature) -> feature interface without initialization - Import(feature, file_path) -> - feature interface initialized from arguments: - - file_path -- path to the imported file + .. function:: Import(feature) + + Create interface for the feature without initialization. + + .. function:: Import(feature, file_path) + + Create interface for the feature and initialize the feature with arguments. """ def __init__(self, feature, *args): @@ -53,9 +63,18 @@ class Import(Interface): def exportToFile(part, *args): - """Add an Export feature to the Part and return Export. + """Perform export from the Part to file. - Pass all args to Export __init__ function. + .. function:: exportToFile(part, file_path, file_format, selection_list) + + Args: + part (ModelAPI_Document): part document + file_path (string): path to the exported file + file_format (string): format of to the exported file + selection_list (list of Selection): objects to export + + Returns: + Export: export object """ assert(args) feature = part.addFeature("Export") @@ -65,12 +84,13 @@ def exportToFile(part, *args): class Export(Interface): """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 + .. function:: Export(feature) + + Create interface for the feature without initialization. + + .. function:: Export(feature, file_path, file_format, selection_list) + + Create interface for the feature and initialize the feature with arguments. """ def __init__(self, feature, *args): diff --git a/src/PythonAPI/model/features/boolean.py b/src/PythonAPI/model/features/boolean.py index ef294346e..489c4282d 100644 --- a/src/PythonAPI/model/features/boolean.py +++ b/src/PythonAPI/model/features/boolean.py @@ -1,46 +1,89 @@ """Boolean operations Interface -Author: Daniel Brunier-Coulin +Author: Daniel Brunier-Coulin with contribution by Sergey Pokhodenko Copyright (C) 2014-20xx CEA/DEN, EDF R&D """ +from GeomAlgoAPI import GeomAlgoAPI_Boolean + from model.roots import Interface + def addAddition(part, *args): - """Inserts an addition to the given Part and executes the operation. - This operation adds tool to the given object. + """Perform addition in the Part. + + .. function:: addAddition(part, main_objects, tool_objects) + + This operation adds tools to the given objects. + + Args: + part (ModelAPI_Document): part document + main_objects (list of :class:`model.Selection`): main objects + tool_objects (list of :class:`model.Selection`): tool_objects objects + + Returns: + Boolean: boolean object """ assert(args) - object, tool = args + main_objects, tool_objects = args feature = part.addFeature("Boolean") - return Boolean(feature, object, tool, GeomAlgoAPI_Boolean.BOOL_FUSE) + return Boolean( + feature, main_objects, tool_objects, GeomAlgoAPI_Boolean.BOOL_FUSE) def addSubtraction(part, *args): - """Inserts a subtraction to the given Part and executes the operation. - This operation subtracts tool to the given object. + """Perform subtraction in the Part. + + .. function:: addSubtraction(part, main_objects, tool_objects) + + This operation subtracts tools from the given objects. + + Args: + part (ModelAPI_Document): part document + main_objects (list of :class:`model.Selection`): main objects + tool_objects (list of :class:`model.Selection`): tool_objects objects + + Returns: + Boolean: boolean object """ assert(args) - object, tool = args + main_objects, tool_objects = args feature = part.addFeature("Boolean") - return Boolean(feature, object, tool, GeomAlgoAPI_Boolean.BOOL_CUT) + return Boolean( + feature, main_objects, tool_objects, GeomAlgoAPI_Boolean.BOOL_CUT) def addIntersection(part, *args): - """Inserts an intersection to the given Part and executes the operation. - This operation intersects tool to the given object. + """Perform intersection in the Part. + + .. function:: addIntersection(part, main_objects, tool_objects) + + This operation intersects tools with the given objects. + + Args: + part (ModelAPI_Document): part document + main_objects (list of :class:`model.Selection`): main objects + tool_objects (list of :class:`model.Selection`): tool_objects objects + + Returns: + Boolean: boolean object """ assert(args) - object, tool = args + main_objects, tool_objects = args feature = part.addFeature("Boolean") - return Boolean(feature, object, tool, GeomAlgoAPI_Boolean.BOOL_COMMON) + return Boolean( + feature, main_objects, tool_objects, GeomAlgoAPI_Boolean.BOOL_COMMON) class Boolean(Interface): """Interface class for Boolean features. - Boolean(feature) -> feature interface without initialization - Boolean(feature, main_objects, tool_objects, bool_type) -> - feature interface initialized from arguments + .. function:: Boolean(feature) + + Create interface for the feature without initialization. + + .. function:: Boolean(feature, main_objects, tool_objects, bool_type) + + Create interface for the feature and initialize the feature with arguments. """ def __init__(self, feature, *args): @@ -70,22 +113,34 @@ class Boolean(Interface): pass def setMainObjects(self, main_objects): - """F.setMainObjects(iterable) -- modify main_objects attribute""" + """Modify main_objects attribute of the feature. + + Args: + main_objects (list of :class:`model.Selection`): main objects + """ self._fillAttribute(self._main_objects, main_objects) pass def setToolObjects(self, tool_objects): - """F.setToolObjects(iterable) -- modify tool_objects attribute""" + """Modify tool_objects attribute of the feature. + + Args: + tool_objects (list of :class:`model.Selection`): tool objects + """ self._fillAttribute(self._tool_objects, tool_objects) pass def setBoolType(self, bool_type): - """F.setBoolType(integer) -- modify bool_type attribute. + """Modify bool_type attribute of the feature. + + Args: + bool_type (integer): type of operation Available types: - - GeomAlgoAPI_Boolean.BOOL_FUSE - - GeomAlgoAPI_Boolean.BOOL_CUT - - GeomAlgoAPI_Boolean.BOOL_COMMON + + * GeomAlgoAPI_Boolean.BOOL_FUSE + * GeomAlgoAPI_Boolean.BOOL_CUT + * GeomAlgoAPI_Boolean.BOOL_COMMON """ self._fillAttribute(self._bool_type, bool_type) pass diff --git a/src/PythonAPI/model/features/extrusion.py b/src/PythonAPI/model/features/extrusion.py index a93cf4942..a63b09369 100644 --- a/src/PythonAPI/model/features/extrusion.py +++ b/src/PythonAPI/model/features/extrusion.py @@ -9,33 +9,33 @@ from model import Selection def addExtrusion(part, *args): """Add an Extrusion feature to the Part and return Extrusion. - + This function has *3 signatures*: - + .. function:: addExtrusion(base, size) - + Arguments: base(str, Sketch or list): base object(s) size(double): size of the extrusion, the side is decided by the sign - + .. function:: addExtrusion(base, to_size, from_size) - + Arguments: base(str, Sketch or list): base object(s) to_size(double): upper size of the extrusion from_size(double): lower size of the extrusion - + .. function:: addExtrusion(base, to_object, to_offset, from_object, from_offset) - + Arguments: base(str, Sketch or list): base object(s) - to_object(plane): upper object + to_object(plane): upper plane to_offset(double): offset from upper object from_object(plane): lower plane from_offset(double): offset from lower plane - + In all three cases the function returns an extrusion object - + Returns: Extrusion: extrusion object """ diff --git a/src/PythonAPI/model/features/extrusion_boolean.py b/src/PythonAPI/model/features/extrusion_boolean.py index 810a8a7c2..199d1e1d9 100644 --- a/src/PythonAPI/model/features/extrusion_boolean.py +++ b/src/PythonAPI/model/features/extrusion_boolean.py @@ -7,9 +7,32 @@ from .roots import CompositeBoolean def addExtrusionCut(part, *args): - """Add an ExtrusionCut feature to the Part and return ExtrusionBoolean. - - Pass all args to Extrusion __init__ function. + """Add an ExtrusionCut feature to the Part. + + .. function:: addExtrusionCut(part, sketch, sketch_selection, boolean_objects, to_size, from_size) + + Args: + part (ModelAPI_Document): part document + sketch (ModelAPI_Object): sketch feature + sketch_selection (Selection): sketch objects + boolean_objects (list of Selection): boolean objects + to_size (double): upper size of the extrusion + from_size (double): lower size of the extrusion + + .. function:: addExtrusionCut(part, sketch, sketch_selection, boolean_objects, to_object, to_offset, from_object, from_offset) + + Args: + part (ModelAPI_Document): part document + sketch (ModelAPI_Object): sketch feature + sketch_selection (Selection): sketch objects + boolean_objects (list of Selection): boolean objects + to_object (Selection): upper plane + to_offset (double): offset from upper plane + from_object (Selection): lower plane + from_offset (double): offset from lower plane + + Returns: + ExtrusionBoolean: extrusion boolean object """ assert(args) feature = part.addFeature("ExtrusionCut") @@ -18,7 +41,30 @@ def addExtrusionCut(part, *args): def addExtrusionFuse(part, *args): """Add an ExtrusionFuse feature to the Part and return ExtrusionBoolean. - Pass all args to Extrusion __init__ function. + .. function:: addExtrusionFuse(part, sketch, sketch_selection, boolean_objects, to_size, from_size) + + Args: + part (ModelAPI_Document): part document + sketch (ModelAPI_Object): sketch feature + sketch_selection (Selection): sketch objects + boolean_objects (list of Selection): boolean objects + to_size (double): upper size of the extrusion + from_size (double): lower size of the extrusion + + .. function:: addExtrusionFuse(part, sketch, sketch_selection, boolean_objects, to_object, to_offset, from_object, from_offset) + + Args: + part (ModelAPI_Document): part document + sketch (ModelAPI_Object): sketch feature + sketch_selection (Selection): sketch objects + boolean_objects (list of Selection): boolean objects + to_object (Selection): upper plane + to_offset (double): offset from upper plane + from_object (Selection): lower plane + from_offset (double): offset from lower plane + + Returns: + ExtrusionBoolean: extrusion boolean object """ assert(args) feature = part.addFeature("ExtrusionFuse") @@ -29,30 +75,21 @@ 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 + + * ExtrusionCut + * ExtrusionFuse + + .. function:: ExtrusionBoolean(feature) + + Create interface for the feature without initialization. + + .. function:: ExtrusionBoolean(feature, sketch, sketch_selection, boolean_objects, to_size, from_size) + + Create interface for the feature and initialize the feature with arguments. + + .. function:: ExtrusionBoolean(feature, sketch, sketch_selection, boolean_objects, to_object, to_offset, from_object, from_offset) + + Create interface for the feature and initialize the feature with arguments. """ def __init__(self, feature, *args): diff --git a/src/PythonAPI/model/features/extrusion_sketch.py b/src/PythonAPI/model/features/extrusion_sketch.py index 627a1c573..0838948ee 100644 --- a/src/PythonAPI/model/features/extrusion_sketch.py +++ b/src/PythonAPI/model/features/extrusion_sketch.py @@ -7,9 +7,30 @@ from .roots import CompositeSketch def addExtrusionSketch(part, *args): - """Add an ExtrusionSketch feature to the Part and return ExtrusionSketch. - - Pass all args to ExtrusionSketch __init__ function. + """Add an ExtrusionSketch feature to the Part. + + .. function:: addExtrusionSketch(part, sketch, sketch_selection, to_size, from_size) + + Args: + part (ModelAPI_Document): part document + sketch (ModelAPI_Object): sketch feature + sketch_selection (Selection): sketch objects + to_size (double): upper size of the extrusion + from_size (double): lower size of the extrusion + + .. function:: addExtrusionSketch(part, sketch, sketch_selection, to_object, to_offset, from_object, from_offset) + + Args: + part (ModelAPI_Document): part document + sketch (ModelAPI_Object): sketch feature + sketch_selection (Selection): sketch objects + to_object (Selection): upper plane + to_offset (double): offset from upper plane + from_object (Selection): lower plane + from_offset (double): offset from lower plane + + Returns: + ExtrusionSketch: extrusion sketch object """ assert(args) feature = part.addFeature("ExtrusionSketch") @@ -19,25 +40,17 @@ 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 + .. function:: ExtrusionSketch(feature) + + Create interface for the feature without initialization. + + .. function:: ExtrusionSketch(feature, sketch, sketch_selection, to_size, from_size) + + Create interface for the feature and initialize the feature with arguments. + + .. function:: ExtrusionSketch(feature, sketch, sketch_selection, to_object, to_offset, from_object, from_offset) + + Create interface for the feature and initialize the feature with arguments. """ def __init__(self, feature, *args): """x.__init__(...) initializes x; see x.__class__.__doc__ for signature""" diff --git a/src/PythonAPI/model/features/group.py b/src/PythonAPI/model/features/group.py index 7e098d5d0..68567bd2b 100644 --- a/src/PythonAPI/model/features/group.py +++ b/src/PythonAPI/model/features/group.py @@ -7,9 +7,16 @@ from model.roots import Interface def addGroup(part, *args): - """Add an Group feature to the Part and return Group. + """Add a Group feature to the Part. - Pass all args to Group __init__ function. + .. function:: addGroup(part, group_list) + + Args: + part (ModelAPI_Document): part document + group_list (list of Selection): list of objects + + Returns: + Group: group object """ assert(args) feature = part.addFeature("Group") @@ -19,10 +26,13 @@ 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 + .. function:: Group(feature) + + Create interface for the feature without initialization. + + .. function:: Group(feature, group_list) + + Create interface for the feature and initialize the feature with arguments. """ def __init__(self, feature, *args): diff --git a/src/PythonAPI/model/features/partition.py b/src/PythonAPI/model/features/partition.py index e6e695122..26173e0d6 100644 --- a/src/PythonAPI/model/features/partition.py +++ b/src/PythonAPI/model/features/partition.py @@ -7,9 +7,19 @@ from model.roots import Interface def addPartition(part, *args): - """Add a Partition feature to the Part and return Partition. + """Add a Partition feature to the Part. - Pass all args to Partition __init__ function. + .. function:: addPartition(part, main_objects, tool_objects, partition_combine) + + Args: + part (ModelAPI_Document): part document + main_objects (list of Selection): main objects + tool_objects (list of Selection): tool objects + partition_combine (boolean): + If True combines all results to one. If False builds separate result for each object. + + Returns: + Partition: partition object """ assert(len(args) > 0 and args[0] is not None) feature = part.addFeature("Partition") @@ -19,12 +29,13 @@ def addPartition(part, *args): class Partition(Interface): """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 + .. function:: Partition(feature) + + Create interface for the feature without initialization. + + .. function:: Partition(feature, main_objects, tool_objects, partition_combine) + + Create interface for the feature and initialize the feature with arguments. """ def __init__(self, feature, *args): diff --git a/src/PythonAPI/model/features/placement.py b/src/PythonAPI/model/features/placement.py index cd9e05874..4da0998e5 100644 --- a/src/PythonAPI/model/features/placement.py +++ b/src/PythonAPI/model/features/placement.py @@ -7,9 +7,20 @@ from model.roots import Interface def addPlacement(part, *args): - """Add an Placement feature to the Part and return Placement. + """Add a Placement feature to the Part. - Pass all args to Placement __init__ function. + .. function:: addPlacement(part, objects_list, start_shape, end_shape, reverse_direction, centering) + + Args: + part (ModelAPI_Document): part document + objects_list (list of Selection): solid objects + start_shape (Selection): start face, edge or vertex + end_shape (Selection): end face, edge or vertex + reverse_direction (boolean): reverse placement direction + centering (boolean): center faces under placement + + Returns: + Placement: placement object """ assert(args) feature = part.addFeature("Placement") @@ -19,15 +30,13 @@ 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 + .. function:: Placement(feature) + + Create interface for the feature without initialization. + + .. function:: Placement(feature, objects_list, start_shape, end_shape, reverse_direction, centering) + + Create interface for the feature and initialize the feature with arguments. """ def __init__(self, feature, *args): diff --git a/src/PythonAPI/model/features/revolution.py b/src/PythonAPI/model/features/revolution.py index d5985b393..3ab420144 100644 --- a/src/PythonAPI/model/features/revolution.py +++ b/src/PythonAPI/model/features/revolution.py @@ -7,9 +7,30 @@ from model.roots import Interface def addRevolution(part, *args): - """Add an Revolution feature to the Part and return Revolution. - - Pass all args to Revolution __init__ function. + """Add a Revolution feature to the Part. + + .. function:: addRevolution(part, base, axis_object, to_angle, from_angle) + + Args: + part (ModelAPI_Document): part document + base (list of Selection): base objects + axis_object (Selection): axis object + to_angle (double): to angle + from_angle (double): from angle + + .. function:: addRevolution(feature, base, axis_object, to_object, to_offset, from_object, from_offset) + + Args: + part (ModelAPI_Document): part document + base (list of Selection): base objects + axis_object (Selection): axis object + to_object (plane): upper plane + to_offset (double): offset from upper object + from_object (plane): lower plane + from_offset (double): offset from lower plane + + Returns: + Revolution: revolution object """ assert(len(args) > 0 and args[0] is not None) feature = part.addFeature("Revolution") @@ -19,22 +40,17 @@ def addRevolution(part, *args): class Revolution(Interface): """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 + .. function:: Revolution(feature) + + Create interface for the feature without initialization. + + .. function:: Revolution(feature, base, axis_object, to_angle, from_angle) + + Create interface for the feature and initialize the feature with arguments. + + .. function:: Revolution(feature, base, axis_object, to_object, to_offset, from_object, from_offset) + + Create interface for the feature and initialize the feature with arguments. """ def __init__(self, feature, *args): diff --git a/src/PythonAPI/model/features/revolution_boolean.py b/src/PythonAPI/model/features/revolution_boolean.py index 61361de65..d83642d0c 100644 --- a/src/PythonAPI/model/features/revolution_boolean.py +++ b/src/PythonAPI/model/features/revolution_boolean.py @@ -7,18 +7,71 @@ from .roots import CompositeBoolean def addRevolutionCut(part, *args): - """Add an RevolutionCut feature to the Part and return RevolutionBoolean. - - Pass all args to RevolutionCut __init__ function. + """Add a RevolutionCut feature to the Part. + + .. function:: addRevolutionCut(part, sketch, sketch_selection, boolean_objects, axis_object, to_angle, from_angle) + + Args: + part (ModelAPI_Document): part document + sketch (ModelAPI_Object): sketch feature + sketch_selection (Selection): sketch objects + boolean_objects (list of Selection): boolean objects + axis_object (Selection): axis object + to_size (double): upper size of the extrusion + from_size (double): lower size of the extrusion + + .. function:: addRevolutionCut(part, sketch, sketch_selection, boolean_objects, axis_object, to_object, to_offset, from_object, from_offset) + + Args: + part (ModelAPI_Document): part document + sketch (ModelAPI_Object): sketch feature + sketch_selection (Selection): sketch objects + boolean_objects (list of Selection): boolean objects + axis_object (Selection): axis object + to_object (Selection): upper plane + to_offset (double): offset from upper plane + from_object (Selection): lower plane + from_offset (double): offset from lower plane + + Returns: + RevolutionBoolean: revolution boolean object """ assert(args) feature = part.addFeature("RevolutionCut") return RevolutionBoolean(feature, *args) def addRevolutionFuse(part, *args): - """Add an RevolutionFuse feature to the Part and return RevolutionBoolean. + """Add a RevolutionFuse feature to the Part. + + .. function:: addRevolutionFuse(part, sketch, sketch_selection, boolean_objects, axis_object, to_angle, from_angle) + + Args: + part (ModelAPI_Document): part document + sketch (ModelAPI_Object): sketch feature + sketch_selection (Selection): sketch objects + boolean_objects (list of Selection): boolean objects + axis_object (Selection): axis object + to_size (double): upper size of the extrusion + from_size (double): lower size of the extrusion + + .. function:: addRevolutionFuse(part, sketch, sketch_selection, boolean_objects, axis_object, to_object, to_offset, from_object, from_offset) + + Args: + part (ModelAPI_Document): part document + sketch (ModelAPI_Object): sketch feature + sketch_selection (Selection): sketch objects + boolean_objects (list of Selection): boolean objects + axis_object (Selection): axis object + to_object (Selection): upper plane + to_offset (double): offset from upper plane + from_object (Selection): lower plane + from_offset (double): offset from lower plane + Pass all args to RevolutionFuse __init__ function. + + Returns: + RevolutionBoolean: revolution boolean object """ assert(args) feature = part.addFeature("RevolutionFuse") @@ -29,30 +82,21 @@ 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 + + * RevolutionCut + * RevolutionFuse + + .. function:: RevolutionBoolean(feature) + + Create interface for the feature without initialization. + + .. function:: RevolutionBoolean(feature, sketch, sketch_selection, boolean_objects, axis_object, to_angle, from_angle) + + Create interface for the feature and initialize the feature with arguments. + + .. function:: RevolutionBoolean(feature, sketch, sketch_selection, boolean_objects, axis_object, to_object, to_offset, from_object, from_offset) + + Create interface for the feature and initialize the feature with arguments. """ def __init__(self, feature, *args): diff --git a/src/PythonAPI/model/features/revolution_sketch.py b/src/PythonAPI/model/features/revolution_sketch.py index c75d0c051..1e0c9a6f6 100644 --- a/src/PythonAPI/model/features/revolution_sketch.py +++ b/src/PythonAPI/model/features/revolution_sketch.py @@ -7,9 +7,32 @@ from .roots import CompositeSketch def addRevolutionSketch(part, *args): - """Add an RevolutionSketch feature to the Part and return RevolutionSketch. - - Pass all args to RevolutionSketch __init__ function. + """Add a RevolutionSketch feature to the Part. + + .. function:: addRevolutionSketch(part, sketch, sketch_selection, axis_object, to_angle, from_angle) + + Args: + part (ModelAPI_Document): part document + sketch (ModelAPI_Object): sketch feature + sketch_selection (Selection): sketch objects + axis_object (Selection): axis object + to_size (double): upper size of the extrusion + from_size (double): lower size of the extrusion + + .. function:: addRevolutionSketch(part, sketch, sketch_selection, axis_object, to_object, to_offset, from_object, from_offset) + + Args: + part (ModelAPI_Document): part document + sketch (ModelAPI_Object): sketch feature + sketch_selection (Selection): sketch objects + axis_object (Selection): axis object + to_object (Selection): upper plane + to_offset (double): offset from upper plane + from_object (Selection): lower plane + from_offset (double): offset from lower plane + + Returns: + RevolutionSketch: revolution sketch object """ assert(args) feature = part.addFeature("RevolutionSketch") @@ -19,25 +42,17 @@ 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 + .. function:: RevolutionSketch(feature) + + Create interface for the feature without initialization. + + .. function:: RevolutionSketch(feature, sketch, sketch_selection, to_size, from_size) + + Create interface for the feature and initialize the feature with arguments. + + .. function:: RevolutionSketch(feature, sketch, sketch_selection, to_object, to_offset, from_object, from_offset) + + Create interface for the feature and initialize the feature with arguments. """ def __init__(self, feature, *args): diff --git a/src/PythonAPI/model/features/rotation.py b/src/PythonAPI/model/features/rotation.py index 0a1cf9a2c..4ec174535 100644 --- a/src/PythonAPI/model/features/rotation.py +++ b/src/PythonAPI/model/features/rotation.py @@ -7,9 +7,18 @@ from model.roots import Interface def addRotation(part, *args): - """Add an Rotation feature to the Part and return Rotation. + """Add a Rotation feature to the Part. - Pass all args to Rotation __init__ function. + .. function:: addRotation(part, main_objects, axis_object, angle) + + Args: + part (ModelAPI_Document): part document + main_objects (list of Selection): main objects + axis_object (list of Selection): axis object + angle (double): angle + + Returns: + Rotation: rotation object """ assert(args) feature = part.addFeature("Rotation") @@ -19,12 +28,13 @@ 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 + .. function:: Rotation(feature) + + Create interface for the feature without initialization. + + .. function:: Rotation(feature, main_objects, axis_object, angle) + + Create interface for the feature and initialize the feature with arguments. """ def __init__(self, feature, *args): diff --git a/src/PythonAPI/model/features/translation.py b/src/PythonAPI/model/features/translation.py index 1a386892b..171c988d4 100644 --- a/src/PythonAPI/model/features/translation.py +++ b/src/PythonAPI/model/features/translation.py @@ -7,9 +7,18 @@ from model.roots import Interface def addTranslation(part, *args): - """Add an Translation feature to the Part and return Translation. + """Add a Translation feature to the Part. - Pass all args to Translation __init__ function. + .. function:: addTranslation(part, main_objects, axis_object, distance) + + Args: + part (ModelAPI_Document): part document + main_objects (list of Selection): main objects + axis_object (Selection): axis objects + distance (double): distance + + Returns: + Translation: translation object """ assert(args) feature = part.addFeature("Translation") @@ -19,12 +28,13 @@ 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 + .. function:: Translation(feature) + + Create interface for the feature without initialization. + + .. function:: Translation(feature, main_objects, axis_object, distance) + + Create interface for the feature and initialize the feature with arguments. """ def __init__(self, feature, *args): diff --git a/src/PythonAPI/model/parameter/parameter.py b/src/PythonAPI/model/parameter/parameter.py index a39810c7a..d29719ce4 100644 --- a/src/PythonAPI/model/parameter/parameter.py +++ b/src/PythonAPI/model/parameter/parameter.py @@ -9,6 +9,16 @@ 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) @@ -19,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): diff --git a/src/PythonAPI/model/partset/part.py b/src/PythonAPI/model/partset/part.py index de956eaba..79548308d 100644 --- a/src/PythonAPI/model/partset/part.py +++ b/src/PythonAPI/model/partset/part.py @@ -11,19 +11,34 @@ from model.roots import Interface def addPart(partset): """Add a Part feature to the Part and return Part. - Pass all args to Part __init__ function. + Args: + partset (ModelAPI_Document): partset document + + Returns: + Part: part object """ feature = partset.addFeature("Part") return Part(feature) def duplicatePart(part): - """Create a copy of the Part.""" + """Create a copy of the Part. + + Args: + part (ModelAPI_Document): part document + + Returns: + Part: part object + """ feature = part.addFeature("Duplicate") feature.execute() return Part(feature) def removePart(part): - """Remove the Part.""" + """Remove the Part. + + Args: + part (ModelAPI_Document): part document + """ feature = part.addFeature("Remove") feature.execute() @@ -31,7 +46,9 @@ def removePart(part): class Part(Interface): """Interface class for Part feature. - Part(feature) -> feature interface without initialization + .. function:: Part(feature) + + Create interface for the feature without initialization. """ def __init__(self, feature):