]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Remove redirection to execute(). Replace it with Interface.execute() with validation.
authorspo <sergey.pokhodenko@opencascade.com>
Tue, 3 Nov 2015 10:33:23 +0000 (13:33 +0300)
committerspo <sergey.pokhodenko@opencascade.com>
Tue, 3 Nov 2015 10:33:23 +0000 (13:33 +0300)
24 files changed:
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/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 c4ef0018a60864601011612b58106201682171cb..c3ef9dcbcbe2c40af7f8dde370f332db0d104108 100644 (file)
@@ -47,7 +47,7 @@ class Box(Interface):
         self.setLength(dy)
         self.setHeight(dz)
 
-        self._execute()
+        self.execute()
         pass
 
     def setWidth(self, width):
index 2ec9ab00fee28c15465adb50d6a472470a04b321..2c510be5a363084b289e0fccd2a36aec55ba0794 100644 (file)
@@ -53,7 +53,7 @@ class Axis(Interface):
         elif len(args) == 1:
             self.setCylindricalFace(*args)
 
-        self._execute()
+        self.execute()
         pass
 
     def __clear(self):
index 6035493e82a609ad96758b9d07c93412042b72ea..e92a1e603a319df052766206faa533736852e11f 100644 (file)
@@ -59,7 +59,7 @@ class Plane(Interface):
         elif len(args) == 4:
             self.setGeneralEquation(*args)
 
-        self._execute()
+        self.execute()
         pass
 
     def __clear(self):
index 3892a1abd5b5c3f86bd2eacadb83ebd468e7df8f..b7ef7d78d408f6467f542da3913cf43c35d3de38 100644 (file)
@@ -44,7 +44,7 @@ class Point(Interface):
         assert(len(args) == 3)
         self.setPoint(*args)
 
-        self._execute()
+        self.execute()
         pass
 
     def setPoint(self, x, y, z):
index 7acbc28ca655163c1f35a7e34a8f1361fa76ff60..67d1de38a86085fc441a7be61f3ff8c82e979404 100644 (file)
@@ -40,7 +40,7 @@ class Import(Interface):
         assert(len(args) == 1)
         self.setFilePath(args[0])
 
-        self._execute()
+        self.execute()
         pass
 
     def setFilePath(self, file_path):
@@ -94,7 +94,7 @@ class Export(Interface):
         self.setFileFormat(args[1])
         self.setObjects(args[2])
 
-        self._execute()
+        self.execute()
         pass
 
     def setFilePath(self, file_path):
index 0beb4674c9ce0722458abae87e9d87f5303fdf7c..89ce1fd6b99f9e1d5c008cb3114c3dddf012fd66 100644 (file)
@@ -71,7 +71,7 @@ class Boolean(Interface):
         self.setToolObjects(tool_objects)
         self.setBoolType(bool_type)
 
-        self._execute()
+        self.execute()
         pass
 
     def setMainObjects(self, main_objects):
index 27c2ec2430246609f1eb747374680dbce3bdeea1..1ecccf9966bf84edc15849db677909a2c32e2c8e 100644 (file)
@@ -78,7 +78,7 @@ class Extrusion(Interface):
         elif len(args) == 1:
             self.setSize(args[0])
 
-        self._execute()
+        self.execute()
         pass
 
     def __clear(self):
index 9399e860a45e32cfdedc16d1270b12a22a2f5031..810a8a7c2e841ca4336eedce57256d990bfc94ec 100644 (file)
@@ -85,7 +85,7 @@ class ExtrusionBoolean(CompositeBoolean):
         elif len(args) == 2:
             self.setSizes(*args)
 
-        self._execute()
+        self.execute()
         pass
 
     def __clear(self):
index 4bdb13ce7037e65b54c7d16f5b7dc2d468c55f31..627a1c5732dafd6405c5a2b06b04db04c9f8618d 100644 (file)
@@ -69,7 +69,7 @@ class ExtrusionSketch(CompositeSketch):
         elif len(args) == 2:
             self.setSizes(*args)
 
-        self._execute()
+        self.execute()
         pass
 
     def __clear(self):
index bfe661307dc1545b6b0da17d3439d3db650ffeb9..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):
index d2242347fa57dce40282337415a0ba8a9ba3939a..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):
index 4153d39e639ee924d162bd3a5b066ddcac9fe4d7..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):
index e816d62047968e30e0198b7de554edc8953a57f9..d5985b3933f280738006b65402babc621b300631 100644 (file)
@@ -78,7 +78,7 @@ class Revolution(Interface):
         elif len(args) == 2:
             self.setAngles(*args)
 
-        self._execute()
+        self.execute()
         pass
 
     def __clear(self):
index 34f3fbc08c12ec592bcd4af28e9b23d43456d38a..61361de65bcf8df439f0eabb3e4ba1a3ffd0473c 100644 (file)
@@ -92,7 +92,7 @@ class RevolutionBoolean(CompositeBoolean):
         elif len(args) == 2:
             self.setAngles(*args)
 
-        self._execute()
+        self.execute()
         pass
 
     def __clear(self):
index feafe5f1ea463f41a2538e684e1735d2a11f7d1e..c75d0c051cddd5c8bfbf63d884ca110ea31eab61 100644 (file)
@@ -77,7 +77,7 @@ class RevolutionSketch(CompositeSketch):
         elif len(args) == 2:
             self.setAngles(*args)
 
-        self._execute()
+        self.execute()
         pass
 
     def __clear(self):
index 9165b89fa20e6b6b7e24123f64d4e2aff16f752c..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):
index 12aa6ab94a0ff33efea614fc267c83c4e4af08c0..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):
index 0dd32f4851d213d2f83983134c8f8867a4150128..a39810c7a6a1aabc92a730592ac80da282d6ac2d 100644 (file)
@@ -44,7 +44,7 @@ class Parameter(Interface):
         self.setName(args[0])
         self.setExpression(args[1])
 
-        self._execute()
+        self.execute()
         pass
 
     def setName(self, name):
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 7f463a95b701bb35efe71e28e4f1fd655e8f634e..29080e218d92f7834a01040ab35dd4c49e62e6c1 100644 (file)
@@ -57,14 +57,14 @@ class Interface():
 
         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 execute(self):
-        """Computes or recomputes the results"""
-        return self._feature.execute()
-
     def getKind(self):
         """Return the unique kind of the feature"""
         return self._feature.getKind()
@@ -81,10 +81,6 @@ class Interface():
         """Return the result in the list of results"""
         return self._feature.lastResult()
 
-    def _fillAttribute(self, attribute, value):
-        """Fill ModelAPI_Attribute* with value."""
-        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)
@@ -94,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 eb8d735e022f00ad7c554f5d49323c966ae23d2c..08f870dbc787e46a79cd3da2b9f974e157f6b3c3 100644 (file)
@@ -33,7 +33,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 254d515ad4be3dd71abb382bc6a1e3a2e1b1fe79..d0dfcf659741138baab8a15362dc8f1b5a061290 100644 (file)
@@ -127,7 +127,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):
@@ -137,7 +137,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):
@@ -147,7 +147,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):
@@ -155,7 +155,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):
@@ -163,7 +163,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):
@@ -179,7 +179,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):
@@ -189,7 +189,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):
@@ -198,7 +198,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):
@@ -208,7 +208,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):
@@ -218,7 +218,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):
@@ -227,7 +227,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):
@@ -237,7 +237,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
 
     #-------------------------------------------------------------