-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2023 CEA, EDF, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
#endif
#include <Standard_Version.hxx>
-#include <Standard_Stream.hxx>
#include <GEOMImpl_IHealingOperations.hxx>
#include <GEOM_PythonDump.hxx>
#include <GEOMImpl_IVector.hxx>
#include <GEOMImpl_VectorDriver.hxx>
#include <GEOMImpl_CopyDriver.hxx>
-
-#include <Basics_OCCTVersion.hxx>
+#include <ShHealOper_ModifStats.hxx>
+#include <ShHealOper_ShapeProcess.hxx>
#include <utilities.h>
-#include <OpUtil.hxx>
#include <Utils_ExceptHandlers.hxx>
#include <BRep_Builder.hxx>
-#include <ShHealOper_ShapeProcess.hxx>
#include <ShapeAnalysis_FreeBounds.hxx>
#include <TColStd_HArray1OfExtendedString.hxx>
#include <TColStd_HSequenceOfTransient.hxx>
#include <TCollection_AsciiString.hxx>
-#include <TDF_Tool.hxx>
#include <TopExp_Explorer.hxx>
#include <TopTools_SequenceOfShape.hxx>
#include <TopoDS_Compound.hxx>
* constructor:
*/
//=============================================================================
-GEOMImpl_IHealingOperations::GEOMImpl_IHealingOperations (GEOM_Engine* theEngine, int theDocID)
-: GEOM_IOperations(theEngine, theDocID)
+GEOMImpl_IHealingOperations::GEOMImpl_IHealingOperations (GEOM_Engine* theEngine)
+: GEOM_IOperations(theEngine)
{
+ myModifStats = new ShHealOper_ModifStats;
MESSAGE("GEOMImpl_IHealingOperations::GEOMImpl_IHealingOperations");
}
//=============================================================================
GEOMImpl_IHealingOperations::~GEOMImpl_IHealingOperations()
{
+ delete myModifStats;
MESSAGE("GEOMImpl_IHealingOperations::~GEOMImpl_IHealingOperations");
}
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 );
+ Handle(GEOM_Object) aNewObject = GetEngine()->AddObject( GEOM_COPY );
//Add the function
aFunction = aNewObject->AddFunction(GEOMImpl_HealingDriver::GetID(), SHAPE_PROCESS);
HI.SetParameters( theParams );
HI.SetValues( theValues );
}
+ HI.SetStatistics( myModifStats );
//Compute the translation
try {
return NULL;
}
}
- catch (Standard_Failure)
+ catch (Standard_Failure& aFail)
{
- Handle(Standard_Failure) aFail = Standard_Failure::Caught();
- SetErrorCode(aFail->GetMessageString());
+ SetErrorCode(aFail.GetMessageString());
return NULL;
}
} else if( theOperation == "DropSmallEdges" ) {
theParams.push_back( "DropSmallEdges.Tolerance3d" );
+ } else if( theOperation == "DropSmallSolids" ) {
+ theParams.push_back( "DropSmallSolids.WidthFactorThreshold" );
+ theParams.push_back( "DropSmallSolids.VolumeThreshold" );
+ theParams.push_back( "DropSmallSolids.MergeSolids" );
+
} else if( theOperation == "BSplineRestriction" ) {
theParams.push_back( "BSplineRestriction.SurfaceMode" );
theParams.push_back( "BSplineRestriction.Curve3dMode" );
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);
+ Handle(GEOM_Object) aNewObject = GetEngine()->AddObject(GEOM_COPY);
//Add the function
aFunction = aNewObject->AddFunction(GEOMImpl_HealingDriver::GetID(), SUPPRESS_FACES);
GEOMImpl_IHealing HI (aFunction);
HI.SetFaces(theFaces);
HI.SetOriginal(aLastFunction);
+ HI.SetStatistics( myModifStats );
//Compute the translation
try {
return NULL;
}
}
- catch (Standard_Failure)
+ catch (Standard_Failure& aFail)
{
- Handle(Standard_Failure) aFail = Standard_Failure::Caught();
- SetErrorCode(aFail->GetMessageString());
+ SetErrorCode(aFail.GetMessageString());
return NULL;
}
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 );
+ Handle(GEOM_Object) aNewObject = GetEngine()->AddObject( GEOM_COPY );
//Add the function
aFunction = aNewObject->AddFunction(GEOMImpl_HealingDriver::GetID(), CLOSE_CONTOUR);
HI.SetWires( theWires );
HI.SetIsCommonVertex( isCommonVertex );
HI.SetOriginal( aLastFunction );
+ HI.SetStatistics( myModifStats );
//Compute the translation
try {
return NULL;
}
}
- catch (Standard_Failure)
+ catch (Standard_Failure& aFail)
{
- Handle(Standard_Failure) aFail = Standard_Failure::Caught();
- SetErrorCode(aFail->GetMessageString());
+ SetErrorCode(aFail.GetMessageString());
return NULL;
}
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 );
+ Handle(GEOM_Object) aNewObject = GetEngine()->AddObject( GEOM_COPY );
//Add the function
aFunction = aNewObject->AddFunction(GEOMImpl_HealingDriver::GetID(), REMOVE_INT_WIRES);
GEOMImpl_IHealing HI(aFunction);
HI.SetWires( theWires );
HI.SetOriginal( aLastFunction );
+ HI.SetStatistics( myModifStats );
//Compute the translation
try {
return NULL;
}
}
- catch (Standard_Failure)
+ catch (Standard_Failure& aFail)
{
- Handle(Standard_Failure) aFail = Standard_Failure::Caught();
- SetErrorCode(aFail->GetMessageString());
+ SetErrorCode(aFail.GetMessageString());
return NULL;
}
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 );
+ Handle(GEOM_Object) aNewObject = GetEngine()->AddObject( GEOM_COPY );
//Add the function
aFunction = aNewObject->AddFunction(GEOMImpl_HealingDriver::GetID(), FILL_HOLES);
GEOMImpl_IHealing HI(aFunction);
HI.SetWires( theWires );
HI.SetOriginal( aLastFunction );
+ HI.SetStatistics( myModifStats );
//Compute the translation
try {
return NULL;
}
}
- catch (Standard_Failure)
+ catch (Standard_Failure& aFail)
{
- Handle(Standard_Failure) aFail = Standard_Failure::Caught();
- SetErrorCode(aFail->GetMessageString());
+ SetErrorCode(aFail.GetMessageString());
return NULL;
}
}
// Add a new object
- Handle(GEOM_Object) aNewObject = GetEngine()->AddObject( GetDocID(), GEOM_COPY );
+ Handle(GEOM_Object) aNewObject = GetEngine()->AddObject( GEOM_COPY );
//Add the function
int aFunctionType = (isAllowNonManifold ? SEWING_NON_MANIFOLD : SEWING);
HI.SetTolerance( theTolerance );
HI.SetOriginal( theObjects.front()->GetLastFunction() ); objects->Remove(1);
HI.SetShapes( objects );
+ HI.SetStatistics( myModifStats );
//Compute the result
try {
return NULL;
}
}
- catch (Standard_Failure) {
- Handle(Standard_Failure) aFail = Standard_Failure::Caught();
- SetErrorCode(aFail->GetMessageString());
+ catch (Standard_Failure& aFail) {
+ SetErrorCode(aFail.GetMessageString());
return NULL;
}
}
// Add a new object
- Handle(GEOM_Object) aNewObject = GetEngine()->AddObject(GetDocID(), GEOM_COPY);
+ Handle(GEOM_Object) aNewObject = GetEngine()->AddObject(GEOM_COPY);
//Add the function
Handle(GEOM_Function)
GEOMImpl_IHealing HI (aFunction);
HI.SetOriginal( theSolids.front()->GetLastFunction() ); objects->Remove(1);
HI.SetShapes( objects );
+ HI.SetStatistics( myModifStats );
//Compute the result
try {
return NULL;
}
}
- catch (Standard_Failure) {
- Handle(Standard_Failure) aFail = Standard_Failure::Caught();
- SetErrorCode(aFail->GetMessageString());
+ catch (Standard_Failure& aFail) {
+ SetErrorCode(aFail.GetMessageString());
return NULL;
}
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 );
+ Handle(GEOM_Object) aNewObject = GetEngine()->AddObject( GEOM_COPY );
//Add the function
aFunction = aNewObject->AddFunction(GEOMImpl_HealingDriver::GetID(), DIVIDE_EDGE);
HI.SetDevideEdgeValue( theValue );
HI.SetIsByParameter( isByParameter );
HI.SetOriginal( aLastFunction );
+ HI.SetStatistics( myModifStats );
//Compute the translation
try {
return NULL;
}
}
- catch (Standard_Failure) {
- Handle(Standard_Failure) aFail = Standard_Failure::Caught();
- SetErrorCode(aFail->GetMessageString());
+ catch (Standard_Failure& aFail) {
+ SetErrorCode(aFail.GetMessageString());
return NULL;
}
*/
//=============================================================================
Handle(GEOM_Object)
-GEOMImpl_IHealingOperations::DivideEdgeByPoint (Handle(GEOM_Object) theObject,
- int theIndex,
- Handle(GEOM_Object) thePoint)
+GEOMImpl_IHealingOperations::DivideEdgeByPoint (Handle(GEOM_Object) theObject,
+ int theIndex,
+ std::list< Handle(GEOM_Object)> & thePoints)
{
// set error code, check parameters
SetErrorCode(KO);
- if (theObject.IsNull() || thePoint.IsNull())
+ if (theObject.IsNull() || thePoints.empty() )
return NULL;
Handle(GEOM_Function) aFunction, aLastFunction = theObject->GetLastFunction();
- Handle(GEOM_Function) aPointFunc = thePoint->GetLastFunction();
- if (aLastFunction.IsNull() || aPointFunc.IsNull())
+ if (aLastFunction.IsNull() )
return NULL; //There is no function which creates an object to be processed
+ Handle(TColStd_HSequenceOfTransient) aPointFunc = GEOM_Object::GetLastFunctions( thePoints );
+ if ( aPointFunc.IsNull() || aPointFunc->IsEmpty() ) {
+ SetErrorCode("NULL argument points");
+ return NULL;
+ }
+
// Add a new object
- Handle(GEOM_Object) aNewObject = GetEngine()->AddObject( GetDocID(), GEOM_COPY );
+ Handle(GEOM_Object) aNewObject = GetEngine()->AddObject( GEOM_COPY );
//Add the function
aFunction = aNewObject->AddFunction(GEOMImpl_HealingDriver::GetID(), DIVIDE_EDGE_BY_POINT);
// prepare "data container" class IHealing
GEOMImpl_IHealing HI(aFunction);
- HI.SetIndex( theIndex );
- HI.SetOriginal( aLastFunction );
+ HI.SetIndex ( theIndex );
+ HI.SetOriginal ( aLastFunction );
+ HI.SetShapes ( aPointFunc );
- Handle(TColStd_HSequenceOfTransient) funSeq = new TColStd_HSequenceOfTransient;
- funSeq->Append( aPointFunc );
- HI.SetShapes( funSeq );
+ HI.SetStatistics( myModifStats );
//Compute the translation
try {
return NULL;
}
}
- catch (Standard_Failure) {
- Handle(Standard_Failure) aFail = Standard_Failure::Caught();
- SetErrorCode(aFail->GetMessageString());
+ catch (Standard_Failure& aFail) {
+ SetErrorCode(aFail.GetMessageString());
return NULL;
}
//Make a Python command
GEOM::TPythonDump(aFunction)
<< aNewObject << " = geompy.DivideEdgeByPoint(" << theObject
- << ", " << theIndex << ", " << thePoint << ")";
+ << ", " << theIndex << ", " << thePoints << ")";
SetErrorCode(OK);
return aNewObject;
if (theWire.IsNull()) return NULL;
// Add a new object
- Handle(GEOM_Object) aRes = GetEngine()->AddObject(GetDocID(), theWire->GetType());
+ Handle(GEOM_Object) aRes = GetEngine()->AddObject(theWire->GetType());
// Add a new function
Handle(GEOM_Function) aFunction;
if (aFunction->GetDriverGUID() != GEOMImpl_HealingDriver::GetID()) return NULL;
GEOMImpl_IHealing aCI (aFunction);
+ aCI.SetStatistics( myModifStats );
Handle(GEOM_Function) aRefShape = theWire->GetLastFunction();
if (aRefShape.IsNull()) return NULL;
return NULL;
}
}
- catch (Standard_Failure) {
- Handle(Standard_Failure) aFail = Standard_Failure::Caught();
- SetErrorCode(aFail->GetMessageString());
+ catch (Standard_Failure& aFail) {
+ SetErrorCode(aFail.GetMessageString());
return NULL;
}
TopExp_Explorer anExp;
for ( anExp.Init( aClosed, TopAbs_WIRE ); anExp.More(); anExp.Next() )
{
- anObj = GetEngine()->AddObject( GetDocID(), GEOM_FREE_BOUNDS );
+ anObj = GetEngine()->AddObject( GEOM_FREE_BOUNDS );
aFunction = anObj->AddFunction( GEOMImpl_CopyDriver::GetID(), COPY_WITHOUT_REF );
TopoDS_Shape aValueShape = anExp.Current();
aFunction->SetValue( aValueShape );
}
for ( anExp.Init( anOpen, TopAbs_WIRE ); anExp.More(); anExp.Next() )
{
- anObj = GetEngine()->AddObject( GetDocID(), GEOM_FREE_BOUNDS );
+ anObj = GetEngine()->AddObject( GEOM_FREE_BOUNDS );
aFunction = anObj->AddFunction( GEOMImpl_CopyDriver::GetID(), COPY_WITHOUT_REF );
TopoDS_Shape aValueShape = anExp.Current();
aFunction->SetValue( aValueShape );
// prepare "data container" class IVector
GEOMImpl_IVector aVI (aFunction);
aVI.SetCurve(aLastFunction);
+
+ myModifStats->Clear();
+ myModifStats->AddModif( "Vector reversed" );
}
else {
//Add the function
// prepare "data container" class IHealing
GEOMImpl_IHealing HI (aFunction);
HI.SetOriginal(aLastFunction);
+ HI.SetStatistics( myModifStats );
}
//Compute the translation
return NULL;
}
}
- catch (Standard_Failure) {
- Handle(Standard_Failure) aFail = Standard_Failure::Caught();
- SetErrorCode(aFail->GetMessageString());
+ catch (Standard_Failure& aFail) {
+ SetErrorCode(aFail.GetMessageString());
return NULL;
}
return NULL; //There is no function which creates an object to be processed
// Add a new object
- Handle(GEOM_Object) aNewObject = GetEngine()->AddObject(GetDocID(), theObject->GetType());
+ Handle(GEOM_Object) aNewObject = GetEngine()->AddObject(GEOM_COPY);
if (theObject->GetType() == GEOM_VECTOR) { // Mantis issue 21066
//Add the function
// prepare "data container" class IVector
GEOMImpl_IVector aVI (aFunction);
aVI.SetCurve(aLastFunction);
+
+ myModifStats->Clear();
+ myModifStats->AddModif( "Vector reversed" );
}
else {
//Add the function
// prepare "data container" class IHealing
GEOMImpl_IHealing aHI (aFunction);
aHI.SetOriginal(aLastFunction);
+ aHI.SetStatistics( myModifStats );
}
// Compute the result
return NULL;
}
}
- catch (Standard_Failure) {
- Handle(Standard_Failure) aFail = Standard_Failure::Caught();
- SetErrorCode(aFail->GetMessageString());
+ catch (Standard_Failure& aFail) {
+ SetErrorCode(aFail.GetMessageString());
return NULL;
}
*/
//=============================================================================
Handle(GEOM_Object) GEOMImpl_IHealingOperations::LimitTolerance (Handle(GEOM_Object) theObject,
- double theTolerance)
+ double theTolerance,
+ TopAbs_ShapeEnum theType)
{
// Set error code, check parameters
SetErrorCode(KO);
return NULL; // There is no function which creates an object to be processed
// Add a new object
- Handle(GEOM_Object) aNewObject = GetEngine()->AddObject(GetDocID(), theObject->GetType());
+ Handle(GEOM_Object) aNewObject = GetEngine()->AddObject(theObject->GetType());
// Add the function
aFunction = aNewObject->AddFunction(GEOMImpl_HealingDriver::GetID(), LIMIT_TOLERANCE);
GEOMImpl_IHealing HI (aFunction);
HI.SetOriginal(aLastFunction);
HI.SetTolerance(theTolerance);
+ HI.SetType(theType);
+ HI.SetStatistics( myModifStats );
// Compute
try {
return NULL;
}
}
- catch (Standard_Failure) {
- Handle(Standard_Failure) aFail = Standard_Failure::Caught();
- SetErrorCode(aFail->GetMessageString());
+ catch (Standard_Failure& aFail) {
+ SetErrorCode(aFail.GetMessageString());
return NULL;
}