Salome HOME
Merge branch 'python_parametric_api' of https://git.salome-platform.org/git/modules...
authorRenaud NEDELEC <renaud.nedelec@opencascade.com>
Tue, 3 Nov 2015 10:38:13 +0000 (11:38 +0100)
committerRenaud NEDELEC <renaud.nedelec@opencascade.com>
Tue, 3 Nov 2015 10:38:13 +0000 (11:38 +0100)
26 files changed:
src/PythonAPI/CMakeLists.txt
src/PythonAPI/extension/box.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/arc.py
src/PythonAPI/model/sketcher/line.py
src/PythonAPI/model/sketcher/point.py
src/PythonAPI/model/sketcher/sketch.py

index f2e24fad69291a596e82902b12918ad6bc099c03..dc1ee767a70e7e727714abc7dfa0801ae003a1fe 100644 (file)
@@ -28,6 +28,7 @@ ADD_UNIT_TESTS(
   TestSketcherSetEqual.py
   TestSketcherSetFillet.py
 
+  TestFeatures.py
   TestFeaturesExtrusion.py
   TestFeaturesRevolution.py
 
index 6808cd4412632a520c1ecf8ff5b6d7aa79de4f14..c3ef9dcbcbe2c40af7f8dde370f332db0d104108 100644 (file)
@@ -47,20 +47,20 @@ class Box(Interface):
         self.setLength(dy)
         self.setHeight(dz)
 
-        self._execute()
+        self.execute()
         pass
 
     def setWidth(self, width):
         """B.setWidth(float) -- modify width attribute"""
-        self._fill_attribute(self._width, width)
+        self._fillAttribute(self._width, width)
         pass
 
     def setLength(self, length):
         """B.setLength(float) -- modify length attribute"""
-        self._fill_attribute(self._length, length)
+        self._fillAttribute(self._length, length)
         pass
 
     def setHeight(self, height):
         """B.setHeight(float) -- modify height attribute"""
-        self._fill_attribute(self._height, height)
+        self._fillAttribute(self._height, height)
         pass
index 0afedf9bb10e10c6cd8905679b020981a8843afc..2c510be5a363084b289e0fccd2a36aec55ba0794 100644 (file)
@@ -11,6 +11,7 @@ def addAxis(part, *args):
 
     Pass all args to Axis __init__ function.
     """
+    assert(args)
     feature = part.addFeature("Axis")
     return Axis(feature, *args)
 
@@ -52,14 +53,14 @@ class Axis(Interface):
         elif len(args) == 1:
             self.setCylindricalFace(*args)
 
-        self._execute()
+        self.execute()
         pass
 
     def __clear(self):
-        self._fill_attribute(self._CreationMethod, "AxisByPointsCase")
-        self._fill_attribute(self._FirstPoint, None)
-        self._fill_attribute(self._SecondPoint, None)
-        self._fill_attribute(self._CylindricalFace, None)
+        self._fillAttribute(self._CreationMethod, "AxisByPointsCase")
+        self._fillAttribute(self._FirstPoint, None)
+        self._fillAttribute(self._SecondPoint, None)
+        self._fillAttribute(self._CylindricalFace, None)
 
     def setPoints(self, p1, p2):
         """Modify points attribute of the feature.
@@ -67,9 +68,9 @@ class Axis(Interface):
         See __init__.
         """
         self.__clear()
-        self._fill_attribute(self._CreationMethod, "AxisByPointsCase")
-        self._fill_attribute(self._FirstPoint, p1)
-        self._fill_attribute(self._SecondPoint, p2)
+        self._fillAttribute(self._CreationMethod, "AxisByPointsCase")
+        self._fillAttribute(self._FirstPoint, p1)
+        self._fillAttribute(self._SecondPoint, p2)
         pass
 
     def setCylindricalFace(self, face):
@@ -78,6 +79,6 @@ class Axis(Interface):
         See __init__.
         """
         self.__clear()
-        self._fill_attribute(self._CreationMethod, "AxisByCylindricalFaceCase")
-        self._fill_attribute(self._CylindricalFace, face)
+        self._fillAttribute(self._CreationMethod, "AxisByCylindricalFaceCase")
+        self._fillAttribute(self._CylindricalFace, face)
         pass
index b2144d9ecaa0350a11796fd2bb975b77f7438f8f..e92a1e603a319df052766206faa533736852e11f 100644 (file)
@@ -11,6 +11,7 @@ def addPlane(part, *args):
 
     Pass all args to Plane __init__ function.
     """
+    assert(args)
     feature = part.addFeature("Plane")
     return Plane(feature, *args)
 
@@ -58,17 +59,17 @@ class Plane(Interface):
         elif len(args) == 4:
             self.setGeneralEquation(*args)
 
-        self._execute()
+        self.execute()
         pass
 
     def __clear(self):
-        self._fill_attribute(self._CreationMethod, "PlaneByFaceAndDistance")
-        self._fill_attribute(self._plane_face, None)
-        self._fill_attribute(self._distance, 0)
-        self._fill_attribute(self._a, 0)
-        self._fill_attribute(self._b, 0)
-        self._fill_attribute(self._c, 0)
-        self._fill_attribute(self._d, 0)
+        self._fillAttribute(self._CreationMethod, "PlaneByFaceAndDistance")
+        self._fillAttribute(self._plane_face, None)
+        self._fillAttribute(self._distance, 0)
+        self._fillAttribute(self._a, 0)
+        self._fillAttribute(self._b, 0)
+        self._fillAttribute(self._c, 0)
+        self._fillAttribute(self._d, 0)
 
     def setFaceAndDistance(self, face, distance):
         """Modify face and distance attribute of the feature.
@@ -76,9 +77,9 @@ class Plane(Interface):
         See __init__.
         """
         self.__clear()
-        self._fill_attribute(self._CreationMethod, "PlaneByFaceAndDistance")
-        self._fill_attribute(self._plane_face, face)
-        self._fill_attribute(self._distance, distance)
+        self._fillAttribute(self._CreationMethod, "PlaneByFaceAndDistance")
+        self._fillAttribute(self._plane_face, face)
+        self._fillAttribute(self._distance, distance)
         pass
 
     def setGeneralEquation(self, a, b, c, d):
@@ -87,9 +88,9 @@ class Plane(Interface):
         See __init__.
         """
         self.__clear()
-        self._fill_attribute(self._CreationMethod, "PlaneByGeneralEquation")
-        self._fill_attribute(self._a, a)
-        self._fill_attribute(self._b, b)
-        self._fill_attribute(self._c, c)
-        self._fill_attribute(self._d, d)
+        self._fillAttribute(self._CreationMethod, "PlaneByGeneralEquation")
+        self._fillAttribute(self._a, a)
+        self._fillAttribute(self._b, b)
+        self._fillAttribute(self._c, c)
+        self._fillAttribute(self._d, d)
         pass
index d2448bc67610f3da9989f45e976a6cf036c192c0..b7ef7d78d408f6467f542da3913cf43c35d3de38 100644 (file)
@@ -11,6 +11,7 @@ def addPoint(part, *args):
 
     Pass all args to Point __init__ function.
     """
+    assert(args)
     feature = part.addFeature("Point")
     return Point(feature, *args)
 
@@ -43,7 +44,7 @@ class Point(Interface):
         assert(len(args) == 3)
         self.setPoint(*args)
 
-        self._execute()
+        self.execute()
         pass
 
     def setPoint(self, x, y, z):
@@ -51,7 +52,7 @@ class Point(Interface):
 
         See __init__.
         """
-        self._fill_attribute(self._x, x)
-        self._fill_attribute(self._y, y)
-        self._fill_attribute(self._z, z)
+        self._fillAttribute(self._x, x)
+        self._fillAttribute(self._y, y)
+        self._fillAttribute(self._z, z)
         pass
index a7b7daa0ec311d3507010144c7dcb46cdb95771c..67d1de38a86085fc441a7be61f3ff8c82e979404 100644 (file)
@@ -11,6 +11,7 @@ def addImport(part, *args):
 
     Pass all args to Import __init__ function.
     """
+    assert(args)
     feature = part.addFeature("Import")
     return Import(feature, *args)
 
@@ -39,7 +40,7 @@ class Import(Interface):
         assert(len(args) == 1)
         self.setFilePath(args[0])
 
-        self._execute()
+        self.execute()
         pass
 
     def setFilePath(self, file_path):
@@ -47,7 +48,7 @@ class Import(Interface):
 
         See __init__.
         """
-        self._fill_attribute(self._file_path, file_path)
+        self._fillAttribute(self._file_path, file_path)
         pass
 
 
@@ -56,6 +57,7 @@ def exportToFile(part, *args):
 
     Pass all args to Export __init__ function.
     """
+    assert(args)
     feature = part.addFeature("Export")
     return Export(feature, *args)
 
@@ -92,7 +94,7 @@ class Export(Interface):
         self.setFileFormat(args[1])
         self.setObjects(args[2])
 
-        self._execute()
+        self.execute()
         pass
 
     def setFilePath(self, file_path):
@@ -100,7 +102,7 @@ class Export(Interface):
 
         See __init__.
         """
-        self._fill_attribute(self._file_path, file_path)
+        self._fillAttribute(self._file_path, file_path)
         pass
 
     def setFileFormat(self, file_format):
@@ -108,7 +110,7 @@ class Export(Interface):
 
         See __init__.
         """
-        self._fill_attribute(self._file_format, file_format)
+        self._fillAttribute(self._file_format, file_format)
         pass
 
     def setObjects(self, objects):
@@ -116,5 +118,5 @@ class Export(Interface):
 
         See __init__.
         """
-        self._fill_attribute(self._objects, object)
+        self._fillAttribute(self._objects, object)
         pass
index d746ffefdcaa84b2829f7e2e84ce93bb49e23fa0..89ce1fd6b99f9e1d5c008cb3114c3dddf012fd66 100644 (file)
@@ -10,26 +10,32 @@ from GeomAlgoAPI import *
 from model.roots import Interface
 
 
-def addAddition(part, object, tool):
+def addAddition(part, *args):
     """Inserts an addition to the given Part and executes the operation.
     This operation adds tool to the given object.
     """
+    assert(args)
+    object, tool = args
     feature = part.addFeature("Boolean")
     return Boolean(feature, object, tool, GeomAlgoAPI_Boolean.BOOL_FUSE)
 
 
-def addSubtraction(part, object, tool):
+def addSubtraction(part, *args):
     """Inserts a subtraction to the given Part and executes the operation.
     This operation subtracts tool to the given object.
     """
+    assert(args)
+    object, tool = args
     feature = part.addFeature("Boolean")
     return Boolean(feature, object, tool, GeomAlgoAPI_Boolean.BOOL_CUT)
 
 
-def addIntersection(part, object, tool):
+def addIntersection(part, *args):
     """Inserts an intersection to the given Part and executes the operation.
     This operation intersects tool to the given object.
     """
+    assert(args)
+    object, tool = args
     feature = part.addFeature("Boolean")
     return Boolean(feature, object, tool, GeomAlgoAPI_Boolean.BOOL_COMMON)
 
@@ -65,17 +71,17 @@ class Boolean(Interface):
         self.setToolObjects(tool_objects)
         self.setBoolType(bool_type)
 
-        self._execute()
+        self.execute()
         pass
 
     def setMainObjects(self, main_objects):
         """F.setMainObjects(iterable) -- modify main_objects attribute"""
-        self._fill_attribute(self._main_objects, main_objects)
+        self._fillAttribute(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)
+        self._fillAttribute(self._tool_objects, tool_objects)
         pass
 
     def setBoolType(self, bool_type):
@@ -86,5 +92,5 @@ class Boolean(Interface):
         - GeomAlgoAPI_Boolean.BOOL_CUT
         - GeomAlgoAPI_Boolean.BOOL_COMMON
         """
-        self._fill_attribute(self._bool_type, bool_type)
+        self._fillAttribute(self._bool_type, bool_type)
         pass
index a6a18ee024ea4810cc68ef6a01a0617799f1062c..1ecccf9966bf84edc15849db677909a2c32e2c8e 100644 (file)
@@ -78,17 +78,17 @@ class Extrusion(Interface):
         elif len(args) == 1:
             self.setSize(args[0])
 
-        self._execute()
+        self.execute()
         pass
 
     def __clear(self):
         self._CreationMethod.setValue("BySizes")
-        self._fill_attribute(self._to_size, 0)
-        self._fill_attribute(self._from_size, 0)
-        self._fill_attribute(self._to_object, None)
-        self._fill_attribute(self._to_offset, 0)
-        self._fill_attribute(self._from_object, None)
-        self._fill_attribute(self._from_offset, 0)
+        self._fillAttribute(self._to_size, 0)
+        self._fillAttribute(self._from_size, 0)
+        self._fillAttribute(self._to_object, None)
+        self._fillAttribute(self._to_offset, 0)
+        self._fillAttribute(self._from_object, None)
+        self._fillAttribute(self._from_offset, 0)
         pass
 
     def setBase(self, base):
@@ -96,7 +96,7 @@ class Extrusion(Interface):
 
         See __init__.
         """
-        self._fill_attribute(self._base, base)
+        self._fillAttribute(self._base, base)
         pass
 
     def setSizes(self, to_size, from_size):
@@ -105,9 +105,9 @@ class Extrusion(Interface):
         See __init__.
         """
         self.__clear()
-        self._fill_attribute(self._CreationMethod, "BySizes")
-        self._fill_attribute(self._to_size, to_size)
-        self._fill_attribute(self._from_size, from_size)
+        self._fillAttribute(self._CreationMethod, "BySizes")
+        self._fillAttribute(self._to_size, to_size)
+        self._fillAttribute(self._from_size, from_size)
         pass
 
     def setSize(self, size):
@@ -133,10 +133,10 @@ class Extrusion(Interface):
         """
         self.__clear()
         self._CreationMethod.setValue("ByPlanesAndOffsets")
-        self._fill_attribute(self._to_object, to_object)
-        self._fill_attribute(self._to_offset, to_offset)
-        self._fill_attribute(self._from_object, from_object)
-        self._fill_attribute(self._from_offset, from_offset)
+        self._fillAttribute(self._to_object, to_object)
+        self._fillAttribute(self._to_offset, to_offset)
+        self._fillAttribute(self._from_object, from_object)
+        self._fillAttribute(self._from_offset, from_offset)
         pass
 
     def result(self):
index a5b4d1e0937af2995b1760e09e7764f706d8ed4e..810a8a7c2e841ca4336eedce57256d990bfc94ec 100644 (file)
@@ -85,17 +85,17 @@ class ExtrusionBoolean(CompositeBoolean):
         elif len(args) == 2:
             self.setSizes(*args)
 
-        self._execute()
+        self.execute()
         pass
 
     def __clear(self):
         self._CreationMethod.setValue("BySizes")
-        self._fill_attribute(self._to_size, 0)
-        self._fill_attribute(self._from_size, 0)
-        self._fill_attribute(self._to_object, None)
-        self._fill_attribute(self._to_offset, 0)
-        self._fill_attribute(self._from_object, None)
-        self._fill_attribute(self._from_offset, 0)
+        self._fillAttribute(self._to_size, 0)
+        self._fillAttribute(self._from_size, 0)
+        self._fillAttribute(self._to_object, None)
+        self._fillAttribute(self._to_offset, 0)
+        self._fillAttribute(self._from_object, None)
+        self._fillAttribute(self._from_offset, 0)
         pass
 
     def setSizes(self, to_size, from_size):
@@ -105,8 +105,8 @@ class ExtrusionBoolean(CompositeBoolean):
         """
         self.__clear()
         self._CreationMethod.setValue("BySizes")
-        self._fill_attribute(self._to_size, to_size)
-        self._fill_attribute(self._from_size, from_size)
+        self._fillAttribute(self._to_size, to_size)
+        self._fillAttribute(self._from_size, from_size)
         pass
 
     def setPlanesAndOffsets(self, to_object, to_offset,
@@ -117,9 +117,9 @@ class ExtrusionBoolean(CompositeBoolean):
         """
         self.__clear()
         self._CreationMethod.setValue("ByPlanesAndOffsets")
-        self._fill_attribute(self._to_object, to_object)
-        self._fill_attribute(self._to_offset, to_offset)
-        self._fill_attribute(self._from_object, from_object)
-        self._fill_attribute(self._from_offset, from_offset)
+        self._fillAttribute(self._to_object, to_object)
+        self._fillAttribute(self._to_offset, to_offset)
+        self._fillAttribute(self._from_object, from_object)
+        self._fillAttribute(self._from_offset, from_offset)
         pass
 
index fdd436874bcbaecdbe105193155a12e072b039b9..627a1c5732dafd6405c5a2b06b04db04c9f8618d 100644 (file)
@@ -69,17 +69,17 @@ class ExtrusionSketch(CompositeSketch):
         elif len(args) == 2:
             self.setSizes(*args)
 
-        self._execute()
+        self.execute()
         pass
 
     def __clear(self):
         self._CreationMethod.setValue("BySizes")
-        self._fill_attribute(self._to_size, 0)
-        self._fill_attribute(self._from_size, 0)
-        self._fill_attribute(self._to_object, None)
-        self._fill_attribute(self._to_offset, 0)
-        self._fill_attribute(self._from_object, None)
-        self._fill_attribute(self._from_offset, 0)
+        self._fillAttribute(self._to_size, 0)
+        self._fillAttribute(self._from_size, 0)
+        self._fillAttribute(self._to_object, None)
+        self._fillAttribute(self._to_offset, 0)
+        self._fillAttribute(self._from_object, None)
+        self._fillAttribute(self._from_offset, 0)
         pass
 
     def setSizes(self, to_size, from_size):
@@ -89,8 +89,8 @@ class ExtrusionSketch(CompositeSketch):
         """
         self.__clear()
         self._CreationMethod.setValue("BySizes")
-        self._fill_attribute(self._to_size, to_size)
-        self._fill_attribute(self._from_size, from_size)
+        self._fillAttribute(self._to_size, to_size)
+        self._fillAttribute(self._from_size, from_size)
         pass
 
     def setPlanesAndOffsets(self, to_object, to_offset,
@@ -101,9 +101,9 @@ class ExtrusionSketch(CompositeSketch):
         """
         self.__clear()
         self._CreationMethod.setValue("ByPlanesAndOffsets")
-        self._fill_attribute(self._to_object, to_object)
-        self._fill_attribute(self._to_offset, to_offset)
-        self._fill_attribute(self._from_object, from_object)
-        self._fill_attribute(self._from_offset, from_offset)
+        self._fillAttribute(self._to_object, to_object)
+        self._fillAttribute(self._to_offset, to_offset)
+        self._fillAttribute(self._from_object, from_object)
+        self._fillAttribute(self._from_offset, from_offset)
         pass
 
index d0c4207e6983dd47767f89db42d8229937e8fb0b..7e098d5d047a03151c0e3f6b65a78a0291b6afc0 100644 (file)
@@ -40,7 +40,7 @@ class Group(Interface):
         assert(len(args) == 1)
         self.setGroupList(args[0])
 
-        self._execute()
+        self.execute()
         pass
 
     def setGroupList(self, main_objects):
@@ -48,5 +48,5 @@ class Group(Interface):
 
         See __init__.
         """
-        self._fill_attribute(self._group_list, group_list)
+        self._fillAttribute(self._group_list, group_list)
         pass
index 04876d232e2a486e280253da25806fd9e397a6ab..fb9056e7c2228f90dd11d8e44ac122c30654075a 100644 (file)
@@ -50,7 +50,7 @@ class Partition(Interface):
         self.setToolObjects(tool_objects)
         self.setPartitionCombine(partition_combine)
 
-        self._execute()
+        self.execute()
         pass
 
     def setMainObjects(self, main_objects):
@@ -58,7 +58,7 @@ class Partition(Interface):
 
         See __init__.
         """
-        self._fill_attribute(self._main_objects, main_objects)
+        self._fillAttribute(self._main_objects, main_objects)
         pass
 
     def setToolObjects(self, tool_objects):
@@ -66,7 +66,7 @@ class Partition(Interface):
 
         See __init__.
         """
-        self._fill_attribute(self._tool_objects, tool_objects)
+        self._fillAttribute(self._tool_objects, tool_objects)
         pass
 
     def setPartitionCombine(self, partition_combine):
@@ -74,5 +74,5 @@ class Partition(Interface):
 
         See __init__.
         """
-        self._fill_attribute(self._partition_combine, partition_combine)
+        self._fillAttribute(self._partition_combine, partition_combine)
         pass
index 258389e970e197462598db6a8f9b3ec0f54980bc..cd9e0587493c9529616299b3f4472079fd8a99d2 100644 (file)
@@ -57,7 +57,7 @@ class Placement(Interface):
         self.setReverseDirection(args[3])
         self.setCentering(args[4])
 
-        self._execute()
+        self.execute()
         pass
 
     def setObjectList(self, objects_list):
@@ -65,7 +65,7 @@ class Placement(Interface):
 
         See __init__.
         """
-        self._fill_attribute(self._objects_list, objects_list)
+        self._fillAttribute(self._objects_list, objects_list)
         pass
 
     def setStartShape(self, start_shape):
@@ -73,7 +73,7 @@ class Placement(Interface):
 
         See __init__.
         """
-        self._fill_attribute(self._start_shape, start_shape)
+        self._fillAttribute(self._start_shape, start_shape)
         pass
 
     def setEndShape(self, end_shape):
@@ -81,7 +81,7 @@ class Placement(Interface):
 
         See __init__.
         """
-        self._fill_attribute(self._end_shape, end_shape)
+        self._fillAttribute(self._end_shape, end_shape)
         pass
 
     def setReverseDirection(self, reverse_direction):
@@ -89,7 +89,7 @@ class Placement(Interface):
 
         See __init__.
         """
-        self._fill_attribute(self._reverse_direction, reverse_direction)
+        self._fillAttribute(self._reverse_direction, reverse_direction)
         pass
 
     def setCentering(self, centering):
@@ -97,5 +97,5 @@ class Placement(Interface):
 
         See __init__.
         """
-        self._fill_attribute(self._centering, centering)
+        self._fillAttribute(self._centering, centering)
         pass
index 662190a1b6a69d6290c04f9dc4da4af7e9304f6d..d5985b3933f280738006b65402babc621b300631 100644 (file)
@@ -78,17 +78,17 @@ class Revolution(Interface):
         elif len(args) == 2:
             self.setAngles(*args)
 
-        self._execute()
+        self.execute()
         pass
 
     def __clear(self):
         self._CreationMethod.setValue("ByAngles")
-        self._fill_attribute(self._to_angle, 0)
-        self._fill_attribute(self._from_angle, 0)
-        self._fill_attribute(self._to_object, None)
-        self._fill_attribute(self._to_offset, 0)
-        self._fill_attribute(self._from_object, None)
-        self._fill_attribute(self._from_offset, 0)
+        self._fillAttribute(self._to_angle, 0)
+        self._fillAttribute(self._from_angle, 0)
+        self._fillAttribute(self._to_object, None)
+        self._fillAttribute(self._to_offset, 0)
+        self._fillAttribute(self._from_object, None)
+        self._fillAttribute(self._from_offset, 0)
         pass
 
     def setBase(self, base):
@@ -96,7 +96,7 @@ class Revolution(Interface):
 
         See __init__.
         """
-        self._fill_attribute(self._base, base)
+        self._fillAttribute(self._base, base)
         pass
 
     def setAxisObject(self, axis_object):
@@ -104,7 +104,7 @@ class Revolution(Interface):
 
         See __init__.
         """
-        self._fill_attribute(self._axis_object, axis_object)
+        self._fillAttribute(self._axis_object, axis_object)
         pass
 
     def setAngles(self, to_angle, from_angle):
@@ -114,8 +114,8 @@ class Revolution(Interface):
         """
         self.__clear()
         self._CreationMethod.setValue("ByAngles")
-        self._fill_attribute(self._to_angle, to_angle)
-        self._fill_attribute(self._from_angle, from_angle)
+        self._fillAttribute(self._to_angle, to_angle)
+        self._fillAttribute(self._from_angle, from_angle)
         pass
 
     def setPlanesAndOffsets(self, to_object, to_offset,
@@ -126,8 +126,8 @@ class Revolution(Interface):
         """
         self.__clear()
         self._CreationMethod.setValue("ByPlanesAndOffsets")
-        self._fill_attribute(self._to_object, to_object)
-        self._fill_attribute(self._to_offset, to_offset)
-        self._fill_attribute(self._from_object, from_object)
-        self._fill_attribute(self._from_offset, from_offset)
+        self._fillAttribute(self._to_object, to_object)
+        self._fillAttribute(self._to_offset, to_offset)
+        self._fillAttribute(self._from_object, from_object)
+        self._fillAttribute(self._from_offset, from_offset)
         pass
index 2b80d0c88a50849e4071027631feffbde17831f9..61361de65bcf8df439f0eabb3e4ba1a3ffd0473c 100644 (file)
@@ -92,17 +92,17 @@ class RevolutionBoolean(CompositeBoolean):
         elif len(args) == 2:
             self.setAngles(*args)
 
-        self._execute()
+        self.execute()
         pass
 
     def __clear(self):
         self._CreationMethod.setValue("ByAngles")
-        self._fill_attribute(self._to_angle, 0)
-        self._fill_attribute(self._from_angle, 0)
-        self._fill_attribute(self._to_object, None)
-        self._fill_attribute(self._to_offset, 0)
-        self._fill_attribute(self._from_object, None)
-        self._fill_attribute(self._from_offset, 0)
+        self._fillAttribute(self._to_angle, 0)
+        self._fillAttribute(self._from_angle, 0)
+        self._fillAttribute(self._to_object, None)
+        self._fillAttribute(self._to_offset, 0)
+        self._fillAttribute(self._from_object, None)
+        self._fillAttribute(self._from_offset, 0)
         pass
 
     def setAxisObject(self, axis_object):
@@ -110,7 +110,7 @@ class RevolutionBoolean(CompositeBoolean):
 
         See __init__.
         """
-        self._fill_attribute(self._axis_object, axis_object)
+        self._fillAttribute(self._axis_object, axis_object)
         pass
 
     def setAngles(self, to_angle, from_angle):
@@ -120,8 +120,8 @@ class RevolutionBoolean(CompositeBoolean):
         """
         self.__clear()
         self._CreationMethod.setValue("ByAngles")
-        self._fill_attribute(self._to_angle, to_angle)
-        self._fill_attribute(self._from_angle, from_angle)
+        self._fillAttribute(self._to_angle, to_angle)
+        self._fillAttribute(self._from_angle, from_angle)
         pass
 
     def setPlanesAndOffsets(self, to_object, to_offset,
@@ -132,9 +132,9 @@ class RevolutionBoolean(CompositeBoolean):
         """
         self.__clear()
         self._CreationMethod.setValue("ByPlanesAndOffsets")
-        self._fill_attribute(self._to_object, to_object)
-        self._fill_attribute(self._to_offset, to_offset)
-        self._fill_attribute(self._from_object, from_object)
-        self._fill_attribute(self._from_offset, from_offset)
+        self._fillAttribute(self._to_object, to_object)
+        self._fillAttribute(self._to_offset, to_offset)
+        self._fillAttribute(self._from_object, from_object)
+        self._fillAttribute(self._from_offset, from_offset)
         pass
 
index 55e751cc43927057888f21a662937e3b1b657fbb..c75d0c051cddd5c8bfbf63d884ca110ea31eab61 100644 (file)
@@ -77,17 +77,17 @@ class RevolutionSketch(CompositeSketch):
         elif len(args) == 2:
             self.setAngles(*args)
 
-        self._execute()
+        self.execute()
         pass
 
     def __clear(self):
         self._CreationMethod.setValue("ByAngles")
-        self._fill_attribute(self._to_angle, 0)
-        self._fill_attribute(self._from_angle, 0)
-        self._fill_attribute(self._to_object, None)
-        self._fill_attribute(self._to_offset, 0)
-        self._fill_attribute(self._from_object, None)
-        self._fill_attribute(self._from_offset, 0)
+        self._fillAttribute(self._to_angle, 0)
+        self._fillAttribute(self._from_angle, 0)
+        self._fillAttribute(self._to_object, None)
+        self._fillAttribute(self._to_offset, 0)
+        self._fillAttribute(self._from_object, None)
+        self._fillAttribute(self._from_offset, 0)
         pass
 
     def setAxisObject(self, axis_object):
@@ -95,7 +95,7 @@ class RevolutionSketch(CompositeSketch):
 
         See __init__.
         """
-        self._fill_attribute(self._axis_object, axis_object)
+        self._fillAttribute(self._axis_object, axis_object)
         pass
 
     def setAngles(self, to_angle, from_angle):
@@ -105,8 +105,8 @@ class RevolutionSketch(CompositeSketch):
         """
         self.__clear()
         self._CreationMethod.setValue("ByAngles")
-        self._fill_attribute(self._to_angle, to_angle)
-        self._fill_attribute(self._from_angle, from_angle)
+        self._fillAttribute(self._to_angle, to_angle)
+        self._fillAttribute(self._from_angle, from_angle)
         pass
 
     def setPlanesAndOffsets(self, to_object, to_offset,
@@ -117,9 +117,9 @@ class RevolutionSketch(CompositeSketch):
         """
         self.__clear()
         self._CreationMethod.setValue("ByPlanesAndOffsets")
-        self._fill_attribute(self._to_object, to_object)
-        self._fill_attribute(self._to_offset, to_offset)
-        self._fill_attribute(self._from_object, from_object)
-        self._fill_attribute(self._from_offset, from_offset)
+        self._fillAttribute(self._to_object, to_object)
+        self._fillAttribute(self._to_offset, to_offset)
+        self._fillAttribute(self._from_object, from_object)
+        self._fillAttribute(self._from_offset, from_offset)
         pass
 
index 3aa27d42cc532e95aea65b014327d97f77457e2c..2aeacfe171a5e6037a7e0d11f44ba556cd46ec60 100644 (file)
@@ -38,17 +38,17 @@ class CompositeBoolean(Interface):
 
     def setSketch(self, sketch):
         """Modify sketch attribute"""
-        self._fill_attribute(self._sketch, sketch)
+        self._fillAttribute(self._sketch, sketch)
         pass
 
     def setSketchSelection(self, sketch_selection):
         """Modify sketch_selection attribute"""
-        self._fill_attribute(self._sketch_selection, sketch_selection)
+        self._fillAttribute(self._sketch_selection, sketch_selection)
         pass
 
     def setBooleanObjects(self, boolean_objects):
         """Modify boolean_objects attribute"""
-        self._fill_attribute(self._boolean_objects, boolean_objects)
+        self._fillAttribute(self._boolean_objects, boolean_objects)
         pass
 
 
@@ -85,10 +85,10 @@ class CompositeSketch(Interface):
 
     def setSketch(self, sketch):
         """Modify sketch attribute"""
-        self._fill_attribute(self._sketch, sketch)
+        self._fillAttribute(self._sketch, sketch)
         pass
 
     def setSketchSelection(self, sketch_selection):
         """Modify sketch_selection attribute"""
-        self._fill_attribute(self._sketch_selection, sketch_selection)
+        self._fillAttribute(self._sketch_selection, sketch_selection)
         pass
index 2c8b044a03c44e554cb68be72d92372c63ef926f..0a1cf9a2cf9e62da145db2146ff32b4a0e05b5c8 100644 (file)
@@ -48,7 +48,7 @@ class Rotation(Interface):
         self.setAxisObject(args[1])
         self.setAngle(args[2])
 
-        self._execute()
+        self.execute()
         pass
 
     def setMainObjects(self, main_objects):
@@ -56,7 +56,7 @@ class Rotation(Interface):
 
         See __init__.
         """
-        self._fill_attribute(self._main_objects, main_objects)
+        self._fillAttribute(self._main_objects, main_objects)
         pass
 
     def setAxisObject(self, axis_object):
@@ -64,7 +64,7 @@ class Rotation(Interface):
 
         See __init__.
         """
-        self._fill_attribute(self._axis_object, axis_object)
+        self._fillAttribute(self._axis_object, axis_object)
         pass
 
     def setAngle(self, angle):
@@ -72,5 +72,5 @@ class Rotation(Interface):
 
         See __init__.
         """
-        self._fill_attribute(self._angle, angle)
+        self._fillAttribute(self._angle, angle)
         pass
index 802b4d8e81f3b5a933eed327d2dcd9929f6f4d6d..1a386892bad043b963e2dd15374757f9579a56a3 100644 (file)
@@ -48,7 +48,7 @@ class Translation(Interface):
         self.setAxisObject(args[1])
         self.setDistance(args[2])
 
-        self._execute()
+        self.execute()
         pass
 
     def setMainObjects(self, main_objects):
@@ -56,7 +56,7 @@ class Translation(Interface):
 
         See __init__.
         """
-        self._fill_attribute(self._main_objects, main_objects)
+        self._fillAttribute(self._main_objects, main_objects)
         pass
 
     def setAxisObject(self, axis_object):
@@ -64,7 +64,7 @@ class Translation(Interface):
 
         See __init__.
         """
-        self._fill_attribute(self._axis_object, axis_object)
+        self._fillAttribute(self._axis_object, axis_object)
         pass
 
     def setDistance(self, distance):
@@ -72,5 +72,5 @@ class Translation(Interface):
 
         See __init__.
         """
-        self._fill_attribute(self._distance, distance)
+        self._fillAttribute(self._distance, distance)
         pass
index 7dfe03c446d4b33f4ea94f4a73e4d8a8845e5342..a39810c7a6a1aabc92a730592ac80da282d6ac2d 100644 (file)
@@ -11,6 +11,7 @@ def addParameter(part, *args):
 
     Pass all args to Parameter __init__ function.
     """
+    assert(args)
     feature = part.addFeature("Parameter")
     return Parameter(feature, *args)
 
@@ -30,8 +31,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.data().string("variable")
+        self._expression = self._feature.data().string("expression")
 
         assert(self._variable)
         assert(self._expression)
@@ -43,7 +44,7 @@ class Parameter(Interface):
         self.setName(args[0])
         self.setExpression(args[1])
 
-        self._execute()
+        self.execute()
         pass
 
     def setName(self, name):
@@ -51,7 +52,7 @@ class Parameter(Interface):
 
         See __init__.
         """
-        self._fill_attribute(self._name, name)
+        self._fillAttribute(self._name, name)
         pass
 
     def setExpression(self, expression):
@@ -59,5 +60,5 @@ class Parameter(Interface):
 
         See __init__.
         """
-        self._fill_attribute(self._expression, expression)
+        self._fillAttribute(self._expression, expression)
         pass
index a9bce9b3bafe9fe7e188c03639805623e5022a6c..de956eaba323c0d70059c0fe5a54481ce7c8b9bd 100644 (file)
@@ -39,7 +39,7 @@ class Part(Interface):
         Interface.__init__(self, feature)
         assert(self._feature.getKind() == "Part")
 
-        self._execute()
+        self.execute()
         pass
 
     def document(self):
index 1fa83ee5715acdf3678cfd57e83543b126fb08e3..29080e218d92f7834a01040ab35dd4c49e62e6c1 100644 (file)
@@ -38,16 +38,11 @@ class Interface():
     def __init__(self, feature):
         """x.__init__(...) initializes x; see x.__class__.__doc__ for signature"""
         self._feature = feature
-        self._attribute_white_list = [
-            "execute",
-            "getKind", "results", "firstResult", "lastResult",
-            ]
 
     def __getattr__(self, name):
         """Process missing attributes.
 
         Add get*() methods for access feature attributes.
-        Redirect some missing attributes to the feature.
         """
         if name.startswith("get"):
             possible_names = [
@@ -60,18 +55,31 @@ class Interface():
                         return getattr(self, possible_name)
                     return getter
 
-        if name in self._attribute_white_list:
-            return getattr(self._feature, name)
-
         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
 
-    def _fill_attribute(self, attribute, value):
-        """Fill ModelAPI_Attribute* with value."""
-        tools.fill_attribute(attribute, value)
+    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 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"""
@@ -82,8 +90,8 @@ class Interface():
         validators = ModelAPI.ModelAPI_Session.get().validators()
         return validators.validate(self._feature)
 
-    def _execute(self):
-        """I._execute() -- validate and execute the feature.
+    def execute(self):
+        """I.execute() -- validate and execute the feature.
 
         Raises RuntimeError if validation fails.
         """
index 9bac67762b25707ea82b72eb94fae69dc6128727..0a7ae432dc7be7bb0484d68f10aa37590bf6eb39 100644 (file)
@@ -27,7 +27,7 @@ class Arc(Interface):
             raise WrongNumberOfArguments(
                 "Arc takes 3 or 6 arguments (%s given)" % len(args)
                 )
-        self._execute()
+        self.execute()
         
     ########
     #
index 5ba8333a6873ebd4f692da2507f53626d4f758f6..fe1e4fdf1051639cdbdfac47cf38e8221bac014c 100644 (file)
@@ -32,7 +32,7 @@ class Line(Interface):
             raise WrongNumberOfArguments(
                 "Arc takes 1, 2 or 4 arguments (%s given)" % len(args)
                 )
-        self._execute()
+        self.execute()
 
     def __createByCoordinates(self, x1, y1, x2, y2):
         self.setStartPoint(x1, y1)
index 3a65acea54df7db4f367652ae2bade242e00c359..603a6234adde92835d6f24bd6d5e0a827f3878ef 100644 (file)
@@ -15,7 +15,7 @@ class Point(Interface):
             self._feature.data().attribute("PointCoordinates")
             )
         self.setValue(x, y)
-        self._execute()
+        self.execute()
 
     def setValue(self, x, y):
         """Set point coordinates."""
index 9920cfd1111d15df0743bd16a03739cf75ae67af..0090b269caa4e6edb045c2332ca66ff06041b777 100644 (file)
@@ -124,7 +124,7 @@ class Sketch(Interface):
         constraint = self._feature.addFeature("SketchConstraintCoincidence")
         constraint.data().refattr("ConstraintEntityA").setAttr(p1)
         constraint.data().refattr("ConstraintEntityB").setAttr(p2)
-        self._execute()
+        self.execute()
         return constraint
 
     def setParallel(self, l1, l2):
@@ -134,7 +134,7 @@ class Sketch(Interface):
         constraint = self._feature.addFeature("SketchConstraintParallel")
         constraint.data().refattr("ConstraintEntityA").setObject(l1)
         constraint.data().refattr("ConstraintEntityB").setObject(l2)
-        self._execute()
+        self.execute()
         return constraint
 
     def setPerpendicular(self, l1, l2):
@@ -144,7 +144,7 @@ class Sketch(Interface):
         constraint = self._feature.addFeature("SketchConstraintPerpendicular")
         constraint.data().refattr("ConstraintEntityA").setObject(l1)
         constraint.data().refattr("ConstraintEntityB").setObject(l2)
-        self._execute()
+        self.execute()
         return constraint
 
     def setHorizontal(self, line):
@@ -152,7 +152,7 @@ class Sketch(Interface):
         constraint to this Sketch."""
         constraint = self._feature.addFeature("SketchConstraintHorizontal")
         constraint.data().refattr("ConstraintEntityA").setObject(line)
-        self._execute()
+        self.execute()
         return constraint
 
     def setVertical(self, line):
@@ -160,7 +160,7 @@ class Sketch(Interface):
         constraint to this Sketch."""
         constraint = self._feature.addFeature("SketchConstraintVertical")
         constraint.data().refattr("ConstraintEntityA").setObject(line)
-        self._execute()
+        self.execute()
         return constraint
 
     def setDistance(self, point, line, length):
@@ -176,7 +176,7 @@ class Sketch(Interface):
         constraint.data().refattr("ConstraintEntityA").setAttr(point)
         constraint.data().refattr("ConstraintEntityB").setObject(line)
         constraint.data().real("ConstraintValue").setValue(length)
-        self._execute()
+        self.execute()
         return constraint
 
     def setLength(self, line, length):
@@ -186,7 +186,7 @@ class Sketch(Interface):
         constraint = self._feature.addFeature("SketchConstraintLength")
         constraint.data().refattr("ConstraintEntityA").setObject(line)
         constraint.data().real("ConstraintValue").setValue(length)
-        self._execute()
+        self.execute()
         return constraint
 
     def setRadius(self, circle, radius):
@@ -195,7 +195,7 @@ class Sketch(Interface):
         constraint = self._feature.addFeature("SketchConstraintRadius")
         constraint.data().refattr("ConstraintEntityA").setObject(circle)
         constraint.data().real("ConstraintValue").setValue(radius)
-        self._execute()
+        self.execute()
         return constraint
 
     def setEqual(self, object_1, object_2):
@@ -205,7 +205,7 @@ class Sketch(Interface):
         constraint = self._feature.addFeature("SketchConstraintEqual")
         constraint.data().refattr("ConstraintEntityA").setObject(object_1)
         constraint.data().refattr("ConstraintEntityB").setObject(object_2)
-        self._execute()
+        self.execute()
         return constraint
 
     def setAngle(self, line_1, line_2, angle):
@@ -215,7 +215,7 @@ class Sketch(Interface):
         constraint.data().refattr("ConstraintEntityA").setObject(line_1)
         constraint.data().refattr("ConstraintEntityB").setObject(line_2)
         constraint.data().real("ConstraintValue").setValue(angle)
-        self._execute()
+        self.execute()
         return constraint
 
     def setTangent(self, object_1, object_2):
@@ -224,7 +224,7 @@ class Sketch(Interface):
         constraint = self._feature.addFeature("SketchConstraintTangent")
         constraint.data().refattr("ConstraintEntityA").setObject(object_1)
         constraint.data().refattr("ConstraintEntityB").setObject(object_2)
-        self._execute()
+        self.execute()
         return constraint
 
     def setFillet(self, line_1, line_2, radius):
@@ -234,7 +234,7 @@ class Sketch(Interface):
         constraint.data().refattr("ConstraintEntityA").setObject(line_1)
         constraint.data().refattr("ConstraintEntityB").setObject(line_2)
         constraint.data().real("ConstraintValue").setValue(radius)
-        self._execute()
+        self.execute()
         return constraint
 
     #-------------------------------------------------------------