Salome HOME
Statistics of the operation
[plugins/canrecplugin.git] / src / CANRECPLUGIN_PY / CANRECPluginBuilder.py
index e4c9c01f4367b578257ad2aca3d523083a8b97ac..8dfda9a17c449e11c8bbfbf55f4a3814994863ad 100644 (file)
@@ -69,8 +69,37 @@ def MakeCanonicalRecognition(self, theObj, theMergeSurf, theMergeCurves,
     from salome.geom.geomBuilder import ParseParameters, RaiseIfFailed
     anOp = GetCANRECOperations(self)
     theMergeSurf, theMergeCurves, theTolerance, Parameters = ParseParameters(theMergeSurf, theMergeCurves, theTolerance)
-    anObj = anOp.MakeCanonicalRecognition(theObj, theMergeSurf, theMergeCurves, theTolerance)
+    (anObj, aStat) = anOp.MakeCanonicalRecognition(theObj, theMergeSurf, theMergeCurves, theTolerance)
     RaiseIfFailed("MakeCanonicalRecognition", anOp)
     self._autoPublish(anObj, theName, "canonical")
     anOp.UnRegister()
+    print "Total number of faces in the initial shape: %s" % aStat[0]
+    print "Number of canonical faces in the initial shape: %s" % aStat[1]
+    print "Number of faces converted to the canonical form: %s" % aStat[2]
+    if aStat[3] >= 0:
+      print "Number of merged surfaces: %s" % aStat[3]
+    if aStat[4] >= 0:
+      print "Number of merged curves: %s" % aStat[4]
+
     return anObj
+
+## Get the number of canonical faces in the shape.
+#  @param theObj the input object (solid, compound, compsolid).
+#
+#  @return the number of canonical faces in the object.
+def GetNbCanonicalFaces(self, theObj):
+    """
+    Get the number of canonical faces in the shape.
+
+    Parameters:
+        theObj the input object (solid, compound, compsolid).
+
+        Returns:
+            the number of canonical faces in the object.
+    """
+    from salome.geom.geomBuilder import RaiseIfFailed
+    anOp = GetCANRECOperations(self)
+    aNbCanFaces = anOp.GetNbCanonicalFaces(theObj)
+    RaiseIfFailed("GetNbCanonicalFaces", anOp)
+    anOp.UnRegister()
+    return aNbCanFaces