1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-04 13:13:25 +03:00

0025529: ShapeProcessAPI: introduce DropSmallSolids operator

Implemented DropSmallSolids operator

Source code corrected and optimized; tests added

tests improved
This commit is contained in:
myn
2014-12-11 17:31:28 +03:00
committed by bugmaster
parent f05f2e3430
commit 8422b578d7
17 changed files with 670 additions and 0 deletions

View File

@@ -52,6 +52,7 @@
#include <ShapeFix_Face.hxx>
#include <ShapeFix_Wire.hxx>
#include <ShapeFix_FixSmallFace.hxx>
#include <ShapeFix_FixSmallSolid.hxx>
#include <ShapeFix_Wireframe.hxx>
#include <ShapeFix.hxx>
#include <ShapeFix_SplitCommonVertex.hxx>
@@ -512,6 +513,45 @@ static Standard_Boolean fixwgaps (const Handle(ShapeProcess_Context)& context)
return Standard_True;
}
//=======================================================================
//function : dropsmallsolids
//purpose :
//=======================================================================
static Standard_Boolean dropsmallsolids (const Handle(ShapeProcess_Context)& context)
{
Handle(ShapeProcess_ShapeContext) ctx =
Handle(ShapeProcess_ShapeContext)::DownCast (context);
if (ctx.IsNull()) return Standard_False;
ShapeFix_FixSmallSolid FSS;
Standard_Real aThreshold;
if (ctx->GetReal ("VolumeThreshold", aThreshold))
FSS.SetVolumeThreshold (aThreshold);
if (ctx->GetReal ("WidthFactorThreshold", aThreshold))
FSS.SetWidthFactorThreshold (aThreshold);
Standard_Boolean aMerge = Standard_False;
ctx->GetBoolean ("MergeSolids", aMerge);
Handle(ShapeBuild_ReShape) aReShape = new ShapeBuild_ReShape;
TopoDS_Shape aResult;
if (aMerge)
aResult = FSS.Merge (ctx->Result(), aReShape);
else
aResult = FSS.Remove (ctx->Result(), aReShape);
if (aResult != ctx->Result())
{
ctx->RecordModification (aReShape);
ctx->SetResult (aResult);
}
return Standard_True;
}
/*
//=======================================================================
//function :
@@ -735,6 +775,7 @@ void ShapeProcess_OperLibrary::Init ()
ShapeProcess::RegisterOperator ( "SplitClosedFaces", new ShapeProcess_UOperator ( splitclosedfaces ) );
ShapeProcess::RegisterOperator ( "FixWireGaps", new ShapeProcess_UOperator ( fixwgaps ) );
ShapeProcess::RegisterOperator ( "FixFaceSize", new ShapeProcess_UOperator ( fixfacesize ) );
ShapeProcess::RegisterOperator ( "DropSmallSolids", new ShapeProcess_UOperator ( dropsmallsolids ) );
ShapeProcess::RegisterOperator ( "DropSmallEdges", new ShapeProcess_UOperator ( mergesmalledges ) );
ShapeProcess::RegisterOperator ( "FixShape", new ShapeProcess_UOperator ( fixshape ) );
ShapeProcess::RegisterOperator ( "SplitClosedEdges", new ShapeProcess_UOperator ( spltclosededges ) );