Back to index

salome-geom  6.5.0
Functions
GEOMImpl_IHealingOperations.cxx File Reference
#include <Standard_Version.hxx>
#include <Standard_Stream.hxx>
#include <GEOMImpl_IHealingOperations.hxx>
#include <GEOM_PythonDump.hxx>
#include <GEOMImpl_HealingDriver.hxx>
#include <GEOMImpl_Types.hxx>
#include <GEOMImpl_IHealing.hxx>
#include <GEOMImpl_IVector.hxx>
#include <GEOMImpl_VectorDriver.hxx>
#include <GEOMImpl_CopyDriver.hxx>
#include <Basics_OCCTVersion.hxx>
#include "utilities.h"
#include <OpUtil.hxx>
#include <Utils_ExceptHandlers.hxx>
#include <ShHealOper_ShapeProcess.hxx>
#include <ShapeAnalysis_FreeBounds.hxx>
#include <TopoDS_Compound.hxx>
#include <TopExp_Explorer.hxx>
#include <TColStd_HArray1OfExtendedString.hxx>
#include <TColStd_HSequenceOfTransient.hxx>
#include <TCollection_AsciiString.hxx>
#include <TDF_Tool.hxx>
#include <Standard_Failure.hxx>
#include <Standard_ErrorHandler.hxx>

Go to the source code of this file.

Functions

 Handle (GEOM_Object) GEOMImpl_IHealingOperations
 ShapeProcess.

Function Documentation

ShapeProcess.

GetObject.

LimitTolerance.

ChangeOrientationCopy.

ChangeOrientation.

DivideEdge.

Sew.

FillHoles.

RemoveIntWires.

CloseContour.

SuppressFaces.

Definition at line 90 of file GEOMImpl_IHealingOperations.cxx.

{
  // set error code, check parameters
  SetErrorCode(KO);

  if (theObject.IsNull())
    return NULL;

  if (theOperators.IsNull() || theOperators->Length() <= 0) {
    SetErrorCode("No operators requested");
    return NULL;
  }

  Standard_Integer nbParams = 0, nbValues = 0;
  if (!theParams.IsNull()) {
    nbParams = theParams->Length();
  }
  if (!theValues.IsNull()) {
    nbValues = theValues->Length();
  }

  if (nbParams != nbValues) {
    SetErrorCode("Number of parameter values must be equal to the number of parameters");
    return NULL;
  }

  Handle(GEOM_Function) aFunction, aLastFunction = theObject->GetLastFunction();
  if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be processed

  // Add a new object
  Handle(GEOM_Object) aNewObject = GetEngine()->AddObject( GetDocID(), GEOM_COPY );

  //Add the function
  aFunction = aNewObject->AddFunction(GEOMImpl_HealingDriver::GetID(), SHAPE_PROCESS);

  if (aFunction.IsNull()) return NULL;

  //Check if the function is set correctly
  if (aFunction->GetDriverGUID() != GEOMImpl_HealingDriver::GetID()) return NULL;

  // prepare "data container" class IHealing
  GEOMImpl_IHealing HI(aFunction);
  HI.SetOriginal(aLastFunction);
  HI.SetOperators( theOperators );
  if (nbParams > 0) {
    HI.SetParameters( theParams );
    HI.SetValues( theValues );
  }

  //Compute the translation
  try {
#if OCC_VERSION_LARGE > 0x06010000
    OCC_CATCH_SIGNALS;
#endif
    if (!GetSolver()->ComputeFunction(aFunction))
    {
      SetErrorCode("Shape Healing algorithm failed");
      return NULL;
    }
  }
  catch (Standard_Failure)
  {
    Handle(Standard_Failure) aFail = Standard_Failure::Caught();
    SetErrorCode(aFail->GetMessageString());
    return NULL;
  }

  //Make a Python command
  GEOM::TPythonDump pd (aFunction);
  pd << aNewObject << " = geompy.ProcessShape(" << theObject << ", [";

  // list of operators
  int i = theOperators->Lower(), nb = theOperators->Upper();
  for ( ; i <= nb; i++) {
    pd << "\"" << TCollection_AsciiString(theOperators->Value( i )).ToCString()
      << (( i < nb ) ? "\", " : "\"");
  }
  pd << "], [";
  // list of parameters
  i = theParams->Lower(); nb = theParams->Upper();
  for ( ; i <= nb; i++) {
    pd << "\"" << TCollection_AsciiString(theParams->Value( i )).ToCString()
      << (( i < nb ) ? "\", " : "\"");
  }
  pd << "], [";
  // list of values
  i = theValues->Lower(); nb = theValues->Upper();
  for ( ; i <= nb; i++) {
    pd << "\"" << TCollection_AsciiString(theValues->Value( i )).ToCString()
      << (( i < nb ) ? "\", " : "\"");
  }
  pd << "])";

  SetErrorCode(OK);
  return aNewObject;
}

Here is the call graph for this function: