# Build Canonical Recognition
shape_cr = geompy.MakeCanonicalRecognition(shape_igs, True, True, 0.01)
+# Get the number of canonical faces
+init_nb_f = geompy.GetNbCanonicalFaces(shape_igs)
+res_nb_f = geompy.GetNbCanonicalFaces(shape_cr)
+
+print "Number of canonical faces in the initial shape: %s" % init_nb_f
+print "Number of canonical faces in the result shape: %s" % res_nb_f
+
# Publish in the study
geompy.addToStudy( shape_igs, 'Import from IGS' )
geompy.addToStudy( shape_cr, 'Canonical Recognition' )
This Operation constructs a canonical recognition (convert, if possible, a NURBS geometry B-Spline / Bezier curve or surface
to its analytical form) of an \b Object. To constructs the canonical recognition you need to define the shape.
+\n Once you chose an object you can see the number of canonical faces in this object on the label below.
\n <b>Merge Surfaces</b> checkbox allows to merge surfaces in the result shape.
\n <b>Merge Curves</b> checkbox allows to merge curvies in the result shape.
\n The \b Result of the operation will be any \b GEOM_Object.
-\n <b>TUI Command:</b> <em>geompy.MakeCanonicalRecognition(Shape, MergeSurf, MergeCurves),
+\n <b>TUI Commands:</b>
+<UL>
+<LI><em>geompy.MakeCanonicalRecognition(Shape, MergeSurf, MergeCurves, theTolerance=0.01),
</em> where Shape is a shape to be converted into canonical recognition,
-MergeSurf and MergeCurv flags to merge surfaces / curves in the result shape.
-
+MergeSurf and MergeCurv flags to merge surfaces / curves in the result shape,
+theTolerance is the tolerance of the operation. Default value is 0.01.</LI>
+<LI><em>geompy.GetNbCanonicalFaces(Shape),</em> where Shape is a shape to be tested.
+Returns the number of canonical faces in this shape.</LI>
+</UL>
\n <b>Arguments:</b> Name + one object.
\image html canrec_plugin_dlg.png
+Once the user presses the \b Apply or <b>Apply and Close</b> buttons,
+he will be given with the operation statistics information:
+
+\image html canrec_plugin_dlg_stat.png
+
\n \b Example:
Our <b>TUI Script</b> provide you with useful example of the use of \ref canrec_example "Canonical Recognition".
module CANRECPlugin
{
+ typedef sequence<long> ListOfLong;
+
/*!
* \brief Interface to Canonical Recognition modeling functions.
*/
* \param theMergeSurf the flag to switch on/off merging surfaces in the result shape.
* \param theMergeCurves the flag to switch on/off merging curves in the result shape.
* \param theTolerance the tolerance of the canonical recognition operation.
+ * \param theStat the statistics of the operation. Output parameter.
+ * Each integer value in the sequence has its own meaning
+ * depending on its index:
+ * 0 - total number of faces in the initial shape;
+ * 1 - number of canonical faces in the initial shape;
+ * 2 - number of faces converted to the canonical form;
+ * 3 - number of merged surfaces;
+ * 4 - number of merged curves.
+ * Nagative value means that this value is not computed.
*
* \return New GEOM_Object, containing the canonical recognition of the input object.
*/
- GEOM::GEOM_Object MakeCanonicalRecognition ( in GEOM::GEOM_Object theObject,
- in boolean theMergeSurf,
- in boolean theMergeCurves,
- in double theTolerance );
+ GEOM::GEOM_Object MakeCanonicalRecognition
+ (in GEOM::GEOM_Object theObject,
+ in boolean theMergeSurf,
+ in boolean theMergeCurves,
+ in double theTolerance,
+ out ListOfLong theStat);
+
+ /*!
+ * \brief Get the number of canonical faces in the shape.
+ *
+ * \param theObject the input object (solid, compound, compsolid).
+ *
+ * \return the number of canonical faces in the object.
+ */
+ long GetNbCanonicalFaces(in GEOM::GEOM_Object theObject);
};
};
CANRECPluginEngine_IOperations_i::MakeCanonicalRecognition( GEOM::GEOM_Object_ptr theObject,
CORBA::Boolean theMergeSurf,
CORBA::Boolean theMergeCurves,
- CORBA::Double theTolerance )
+ CORBA::Double theTolerance,
+ CANRECPlugin::ListOfLong_out theStat )
{
+ theStat = new CANRECPlugin::ListOfLong();
+
// Set a not done flag
GetOperations()->SetNotDone();
// Get the reference points
Handle(GEOM_Object) anInitObject = GetObjectImpl( theObject );
- if ( anInitObject.IsNull() ) return GEOM::GEOM_Object::_nil();
+ if ( anInitObject.IsNull() ) {
+ return GEOM::GEOM_Object::_nil();
+ }
// Make Canonical Recognition
- Handle(GEOM_Object) anObject = GetOperations()->MakeCanonicalRecognition( anInitObject,
- theMergeSurf,
- theMergeCurves,
- theTolerance );
- if ( !GetOperations()->IsDone() || anObject.IsNull() )
+ Handle(TColStd_HSequenceOfInteger) aStat = new TColStd_HSequenceOfInteger;
+ Handle(GEOM_Object) anObject =
+ GetOperations()->MakeCanonicalRecognition(anInitObject,
+ theMergeSurf,
+ theMergeCurves,
+ theTolerance,
+ aStat);
+
+ if (!GetOperations()->IsDone() || anObject.IsNull()) {
return GEOM::GEOM_Object::_nil();
+ }
+
+ // Copy statistics.
+ int nbInts = aStat->Length();
+ int i;
+
+ theStat->length(nbInts);
+
+ for (i = 0; i < nbInts; i++) {
+ theStat[i] = aStat->Value(i + 1);
+ }
return GetObject( anObject );
}
+//=============================================================================
+/*!
+ * \brief Get the number of canonical faces in the shape.
+ *
+ * \param theObject the input object (solid, compound, compsolid).
+ *
+ * \return the number of canonical faces in the object.
+ */
+//=============================================================================
+CORBA::Long CANRECPluginEngine_IOperations_i::GetNbCanonicalFaces
+ (GEOM::GEOM_Object_ptr theObject)
+{
+ // Set a not done flag
+ GetOperations()->SetNotDone();
+
+ // Get the reference points
+ Handle(GEOM_Object) anInitObject = GetObjectImpl(theObject);
+
+ if (anInitObject.IsNull()) {
+ return -1;
+ }
+
+ // Get the number of canonical faces.
+ CORBA::Long aResult = GetOperations()->GetNbCanonicalFaces(anInitObject);
+
+ if (!GetOperations()->IsDone()) {
+ return -1;
+ }
+
+ return aResult;
+}
+
::CANRECPluginImpl_IOperations* CANRECPluginEngine_IOperations_i::GetOperations()
{
return (::CANRECPluginImpl_IOperations*)GetImpl();
GEOM::GEOM_Object_ptr MakeCanonicalRecognition ( GEOM::GEOM_Object_ptr theObject,
CORBA::Boolean theMergeSurf,
CORBA::Boolean theMergeCurves,
- CORBA::Double theTolerance );
+ CORBA::Double theTolerance,
+ CANRECPlugin::ListOfLong_out theStat );
+
+ CORBA::Long GetNbCanonicalFaces(GEOM::GEOM_Object_ptr theObject);
CANRECPluginImpl_IOperations* GetOperations();
};
#include <GEOM_Function.hxx>
+#include <BRep_Tool.hxx>
#include <BRepOffsetAPI_Sewing.hxx>
+#include <Geom_Plane.hxx>
+#include <Geom_Surface.hxx>
#include <Standard_Version.hxx>
+#include <TopExp.hxx>
+#include <TopExp_Explorer.hxx>
+#include <TopoDS.hxx>
+#include <TopoDS_Face.hxx>
+
#include <TFunction_Logbook.hxx>
#include <ShapeConvert_CanonicAPI.hxx>
+#include <ShapeConvert_Surface.hxx>
#include <ShapeConvert_UnionFaces.hxx>
#include <ShapeConvert_UnionEdges.hxx>
#include <Standard_LicenseError.hxx>
#endif // CANREC_HASLICENSE
+/**
+ * This function returns the number of shapes of a certain type.
+ *
+ * \param theShape the shape.
+ * \param theType the required type.
+ * \return the number of shapes of a certain type.
+ */
+static Standard_Integer GetNbShapes(const TopoDS_Shape &theShape,
+ const TopAbs_ShapeEnum theType)
+{
+ TopTools_IndexedMapOfShape aMapShapes;
+
+ TopExp::MapShapes(theShape, theType, aMapShapes);
+
+ const Standard_Integer aResult = aMapShapes.Extent();
+
+ return aResult;
+}
+
const Standard_GUID& CANRECPluginImpl_Driver::GetID()
{
static Standard_GUID aGUID("7e1492bb-b4cd-4a40-ad8f-102902b0047e");
return aGUID;
}
+Standard_Integer CANRECPluginImpl_Driver::GetNbCanonicalFaces
+ (const TopoDS_Shape &theShape)
+{
+ TopExp_Explorer anExp(theShape, TopAbs_FACE);
+ TopLoc_Location aLoc;
+ Standard_Integer aNbSurf = 0;
+ TopTools_MapOfShape aMapFence;
+
+ for (; anExp.More(); anExp.Next()) {
+ const TopoDS_Shape &aShFace = anExp.Current();
+
+ if (aMapFence.Add(aShFace)) {
+ TopoDS_Face aFace = TopoDS::Face(aShFace);
+ Handle(Geom_Surface) aSurface = BRep_Tool::Surface(aFace, aLoc);
+
+ if(aSurface->IsKind(STANDARD_TYPE(Geom_Plane)) ||
+ ShapeConvert_Surface::IsCanonical(aSurface)) {
+ aNbSurf++;
+ }
+ }
+ }
+
+ return aNbSurf;
+}
+
CANRECPluginImpl_Driver::CANRECPluginImpl_Driver()
{
}
aRecognizer.SurfaceMode() = isNeedMergeSurf;
aRecognizer.CurveMode() = isNeedMergeCurves;
+ const Standard_Integer anInitNbFaces = GetNbShapes(aShape, TopAbs_FACE);
+ const Standard_Integer anInitNbCanonical = GetNbCanonicalFaces(aShape);
+
// 1. Recognizing
aRecognizer.SetShape( aShape );
aRecognizer.UnifyMode() = false;
aSewing.Add( aResultingShape );
aSewing.Perform();
aResultingShape = aSewing.SewedShape();
-
+
+ const Standard_Integer aNbConverted =
+ GetNbCanonicalFaces(aResultingShape) - anInitNbCanonical;
+ Standard_Integer aNbMergedFaces = -1;
+ Standard_Integer aNbMergedEdges = -1;
+
// 3.1. Union Surfaces
if ( isNeedMergeSurf ) {
ShapeConvert_UnionFaces aFaceUnifier;
aFaceUnifier.GetTolerance() = aTolerance;
aResultingShape = aFaceUnifier.Perform( aResultingShape );
+ aNbMergedFaces = anInitNbFaces - GetNbShapes(aResultingShape, TopAbs_FACE);
}
// 3.2. Union Curves
if ( isNeedMergeCurves ) {
ShapeConvert_UnionEdges anEdgeUnifier;
- aResultingShape = anEdgeUnifier.Perform( aResultingShape, aTolerance );
+ aNbMergedEdges = GetNbShapes(aResultingShape, TopAbs_EDGE);
+ aResultingShape = anEdgeUnifier.Perform( aResultingShape, aTolerance );
+ aNbMergedEdges -= GetNbShapes(aResultingShape, TopAbs_EDGE);
}
if ( aResultingShape.IsNull() ) return 0;
+ // Create statistics
+ Handle(TColStd_HArray1OfInteger) aStat = new TColStd_HArray1OfInteger(1, 5);
+
+ aStat->SetValue(1, anInitNbFaces);
+ aStat->SetValue(2, anInitNbCanonical);
+ aStat->SetValue(3, aNbConverted);
+ aStat->SetValue(4, aNbMergedFaces);
+ aStat->SetValue(5, aNbMergedEdges);
+
+ aData.SetStatistics(aStat);
+
aFunction->SetValue( aResultingShape );
log.SetTouched( Label() );
#include <GEOM_BaseDriver.hxx>
+class TopoDS_Shape;
+
DEFINE_STANDARD_HANDLE( CANRECPluginImpl_Driver, GEOM_BaseDriver );
class CANRECPluginImpl_Driver : public GEOM_BaseDriver
~CANRECPluginImpl_Driver();
static const Standard_GUID& GetID();
+ static Standard_Integer GetNbCanonicalFaces(const TopoDS_Shape &theShape);
virtual Standard_Integer Execute( TFunction_Logbook& ) const;
Standard_Boolean MustExecute( const TFunction_Logbook& ) const;
virtual void Validate( TFunction_Logbook& ) const;
#define __CANRECPLUGINIMPL_ICANREC_HXX
#include <GEOM_Function.hxx>
+#include <TColStd_HArray1OfInteger.hxx>
#define CanonicalRecognition_ARG_NeedMergeSurf 1
#define CanonicalRecognition_ARG_NeedMergeCurves 2
#define CanonicalRecognition_ARG_Tolerance 3
#define CanonicalRecognition_ARG_Object 4
+#define CanonicalRecognition_ARG_Stat 5
class CANRECPluginImpl_ICanRec
{
void SetObject(Handle(GEOM_Function) anInitialObject) { _func->SetReference(CanonicalRecognition_ARG_Object, anInitialObject); }
Handle(GEOM_Function) GetObject() { return _func->GetReference(CanonicalRecognition_ARG_Object); }
+ void SetStatistics(const Handle(TColStd_HArray1OfInteger) &theStat) { _func->SetIntegerArray(CanonicalRecognition_ARG_Stat, theStat); }
+ Handle(TColStd_HArray1OfInteger) GetStatistics() { return _func->GetIntegerArray(CanonicalRecognition_ARG_Stat); }
+
private:
Handle(GEOM_Function) _func;
};
* \param theMergeCurves set merging curves
* \param theTolerance set tolerance
* \param theObject is initial object
+ * \param theStat is the statistics. A set of integers. For details please
+ * see CANRECPlugin.idl
* \return New GEOM_Object, containing the created shape.
*/
//=============================================================================
Handle(GEOM_Object)
-CANRECPluginImpl_IOperations::MakeCanonicalRecognition ( Handle(GEOM_Object) theObject,
- bool theMergeSurf,
- bool theMergeCurves,
- double theTolerance )
+CANRECPluginImpl_IOperations::MakeCanonicalRecognition
+ (Handle(GEOM_Object) theObject,
+ bool theMergeSurf,
+ bool theMergeCurves,
+ double theTolerance,
+ Handle_TColStd_HSequenceOfInteger &theStat)
{
SetErrorCode( KO );
+ if (theStat.IsNull()) {
+ theStat = new TColStd_HSequenceOfInteger;
+ } else {
+ theStat->Clear();
+ }
+
if ( theObject.IsNull() ) return NULL;
// Add a new object
SetErrorCode( aFail->GetMessageString() );
return NULL;
}
+
+ Handle(TColStd_HArray1OfInteger) anArray = aData.GetStatistics();
+
+ if (anArray.IsNull() == Standard_False) {
+ Standard_Integer i = anArray->Lower();
+ const Standard_Integer iUp = anArray->Upper();
+
+ for (; i <= iUp; ++i) {
+ theStat->Append(anArray->Value(i));
+ }
+ }
// Make a Python command
GEOM::TPythonDump(aFunction) << aShape << " = " << "geompy.MakeCanonicalRecognition(" <<
return aShape;
}
+
+//=============================================================================
+/*!
+ * \brief Get the number of canonical faces in the shape.
+ *
+ * \param theObject the input object (solid, compound, compsolid).
+ *
+ * \return the number of canonical faces in the object.
+ */
+//=============================================================================
+Standard_Integer CANRECPluginImpl_IOperations::GetNbCanonicalFaces
+ (const Handle(GEOM_Object) &theObject)
+{
+ SetErrorCode(KO);
+
+ TopoDS_Shape aShape = theObject->GetValue();
+
+ if (aShape.IsNull()) {
+ return -1;
+ }
+
+ const Standard_Integer aResult =
+ CANRECPluginImpl_Driver::GetNbCanonicalFaces(aShape);
+
+ if (aResult >= 0) {
+ SetErrorCode(OK);
+
+ return aResult;
+ }
+
+ return -1;
+}
#include <GEOM_IOperations.hxx>
#include <GEOM_Object.hxx>
+#include <TColStd_HSequenceOfInteger.hxx>
+
class GEOM_Engine;
class CANRECPluginImpl_IOperations: public GEOM_IOperations
Standard_EXPORT CANRECPluginImpl_IOperations( GEOM_Engine* theEngine, int theDocID );
Standard_EXPORT ~CANRECPluginImpl_IOperations();
- Standard_EXPORT Handle(GEOM_Object) MakeCanonicalRecognition ( Handle(GEOM_Object) theObject,
- bool theMergeSurf,
- bool theMergeCurves,
- double theTolerance );
+ Standard_EXPORT Handle(GEOM_Object) MakeCanonicalRecognition
+ (Handle(GEOM_Object) theObject,
+ bool theMergeSurf,
+ bool theMergeCurves,
+ double theTolerance,
+ Handle_TColStd_HSequenceOfInteger &theStat);
+
+ Standard_EXPORT Standard_Integer GetNbCanonicalFaces
+ (const Handle(GEOM_Object) &theObject);
};
#endif // __CANRECPLUGINIMPL_IOPERATIONS_HXX
// Constructor
//=================================================================================
CANRECPluginGUI_CanonicalRecognitionDlg::CANRECPluginGUI_CanonicalRecognitionDlg( GeometryGUI* theGeometryGUI, QWidget* parent )
-: GEOMBase_Skeleton(theGeometryGUI, parent, false)
+: GEOMBase_Skeleton(theGeometryGUI, parent, false),
+ myNbFacesLbl(0)
{
QString aPluginName = "CANRECPlugin";
QPixmap imageOp (SUIT_Session::session()->resourceMgr()->loadPixmap( aPluginName, tr( "ICO_CANONICALRECOGNITION" ) ) );
PButton1->setIcon( image1 );
PButton1->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed );
+ // Label with number of faces.
+ myNbFacesLbl = new QLabel(argGroup);
+
// 2. Object
QLabel* textLabel1 = new QLabel( argGroup );
textLabel1->setText( tr( "CANRECPLUGIN_ARG_OBJ" ) );
lay->addWidget( textLabel1, 0, 0 );
lay->addWidget( PButton1, 0, 1 );
lay->addWidget( LineEdit1, 0, 2 );
+ lay->addWidget(myNbFacesLbl, 1, 0, 1, 3);
- lay->addWidget( textLabel2, 1, 0, 1, 2 );
- lay->addWidget( SpinBoxTol, 1, 2 );
+ lay->addWidget( textLabel2, 2, 0, 1, 2 );
+ lay->addWidget( SpinBoxTol, 2, 2 );
- lay->addWidget( CheckButton1, 2, 0, 1, 3 );
- lay->addWidget( CheckButton2, 3, 0, 1, 3 );
+ lay->addWidget( CheckButton1, 3, 0, 1, 3 );
+ lay->addWidget( CheckButton2, 4, 0, 1, 3 );
myHelpFileName = "canrecplugin_usage_page.html";
myHelpContext = aPluginName.toUpper();
CORBA::Double aTolerance = SpinBoxTol->value();
// call engine function
- anObj = anOper->MakeCanonicalRecognition( myObject.get(), aMergeSurf, aMergeCurves, aTolerance );
+ CANRECPlugin::ListOfLong_var aStat;
+
+ anObj = anOper->MakeCanonicalRecognition( myObject.get(), aMergeSurf, aMergeCurves, aTolerance, aStat );
res = !anObj->_is_nil();
if ( res && !IsPreview() )
{
if ( aParameters.count() > 0 )
anObj->SetParameters( aParameters.join(":").toLatin1().constData() );
+
+
+ // Display message box with statistics.
+ // Compose statistics string.
+ QString aStatString = tr("CANRECPLUGIN_INFO_TEXT_CAPTION");
+
+ aStatString += "\n\n\t";
+ aStatString += tr("CANRECPLUGIN_INFO_TEXT_NB_FACES_INIT").arg(aStat[0]);
+ aStatString += "\n\t";
+ aStatString += tr("CANRECPLUGIN_INFO_TEXT_NB_CAN_FACES_INIT").arg(aStat[1]);
+ aStatString += "\n\t";
+ aStatString += tr("CANRECPLUGIN_INFO_TEXT_NB_FACES").arg(aStat[2]);
+
+ if (CheckButton1->isChecked()) {
+ aStatString += "\n\t";
+ aStatString += tr("CANRECPLUGIN_INFO_TEXT_MERGED_SURF").arg(aStat[3]);
+ }
+
+ if (CheckButton2->isChecked()) {
+ aStatString += "\n\t";
+ aStatString += tr("CANRECPLUGIN_INFO_TEXT_MERGED_CURV").arg(aStat[4]);
+ }
+
+ SUIT_MessageBox::information
+ (this, tr("CANRECPLUGIN_INFO_TITLE"), aStatString);
}
if ( res )
{
myObject = selected.first();
LineEdit1->setText( myObject->GetName() );
+
+ // Get statistics of initial shape.
+ CANRECPlugin::ICanRecOperations_var anOper =
+ CANRECPlugin::ICanRecOperations::_narrow( getOperation() );
+ const int aNbCanFaces =
+ anOper->GetNbCanonicalFaces(myObject.get());
+ TopoDS_Shape aShape;
+
+ if (GEOMBase::GetShape(myObject.get(), aShape) && !aShape.IsNull()) {
+ // Get the tolal number of faces.
+ TopTools_IndexedMapOfShape aMapShapes;
+
+ TopExp::MapShapes(aShape, TopAbs_FACE, aMapShapes);
+
+ const Standard_Integer aNbFaces = aMapShapes.Extent();
+
+ myNbFacesLbl->setText(tr("CANRECPLUGIN_ARG_NB_CAN_FACES").
+ arg(aNbCanFaces).arg(aNbFaces));
+ } else {
+ myNbFacesLbl->setText(tr("CANRECPLUGIN_ARG_NB_CAN_FACES_NO_OBJECT"));
+ }
}
- else
+ else {
LineEdit1->setText( "" );
+ myNbFacesLbl->setText(tr("CANRECPLUGIN_ARG_NB_CAN_FACES_NO_OBJECT"));
+ }
}
//=================================================================================
SalomeApp_DoubleSpinBox* SpinBoxTol;
QCheckBox* CheckButton1;
QCheckBox* CheckButton2;
+ QLabel *myNbFacesLbl;
GEOM::GeomObjPtr myObject;
};
<source>CANRECPLUGIN_ARG_TOLERANCE</source>
<translation>Tolerance</translation>
</message>
+ <message>
+ <source>CANRECPLUGIN_ARG_NB_CAN_FACES_NO_OBJECT</source>
+ <translation>Number of canonical faces:</translation>
+ </message>
+ <message>
+ <source>CANRECPLUGIN_ARG_NB_CAN_FACES</source>
+ <translation>Number of canonical faces: %1 of %2</translation>
+ </message>
+ <message>
+ <source>CANRECPLUGIN_INFO_TITLE</source>
+ <translation>Operation Statistics</translation>
+ </message>
+ <message>
+ <source>CANRECPLUGIN_INFO_TEXT_CAPTION</source>
+ <translation>Operation Statistics:</translation>
+ </message>
+ <message>
+ <source>CANRECPLUGIN_INFO_TEXT_NB_FACES_INIT</source>
+ <translation>Total number of faces in the initial shape: %1</translation>
+ </message>
+ <message>
+ <source>CANRECPLUGIN_INFO_TEXT_NB_CAN_FACES_INIT</source>
+ <translation>Number of canonical faces in the initial shape: %1</translation>
+ </message>
+ <message>
+ <source>CANRECPLUGIN_INFO_TEXT_NB_FACES</source>
+ <translation>Number of faces converted to the canonical form: %1</translation>
+ </message>
+ <message>
+ <source>CANRECPLUGIN_INFO_TEXT_MERGED_SURF</source>
+ <translation>Number of merged surfaces: %1</translation>
+ </message>
+ <message>
+ <source>CANRECPLUGIN_INFO_TEXT_MERGED_CURV</source>
+ <translation>Number of merged curves: %1</translation>
+ </message>
</context>
</TS>
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