Minimizing BRep shapes after boolean operations...

Is there a way to get a more efficient BRep shape after doing boolean operations? Example: Build a BRep Sphere. Punch a hole in it with a small BRep box. Save this new shape. Translate the box a small increment and re-punch another hole in the resultant shape. Resave the shape. (We're using BRepAlgoAPI_Cut).

Do this about 100 times and each time it takes progressively longer to punch the hole. I guess what I'd like to know is if there's a way to make the resulting shape more compact? Maybe rebuild it somehow?

And of course I know this isn't the most efficient way to make the hole, I'm just using this as an example.

Thanks,
Fred

Bearloga's picture

As I know OCCT does not contain ready to use tools to simplify the shape. However, please, look at the sample "Shape Simplification", it shows the way how OCCT can be used to merge several faces into one bspline face. The idea is to get triangulation nodes and to pass them to the GeomPlate algorithm to make a new surface. Then the free boundaries of the set of faces are projected to the new surface and a new face is constructed.
The main problem in your case will be detecting sets of faces that can be safely merged.

Patrik Mueller's picture

Hi,

perhaps ShapeFix_Shape could help you...

Greets,

Patrik

Mark Lichfield's picture

Fred contact me please..

Davide Canalia's picture

Hi,
I have the same problem... Have you find any solution?

Christophe Abel's picture

Hello,

i don't know if it would be efficient for you, but i developp this function and it help me with my complex Boolean operation:

void Model_Model::FixShape(Handle_AIS_Shape aAIS_Shape,const Standard_Real aSolidTol)
{
TopoDS_Shape Sauvgarde= aAIS_Shape->Shape();
try
{
Handle(ShapeFix_Shape) sfs = new ShapeFix_Shape;
sfs->Init ( aAIS_Shape->Shape() );

sfs->SetPrecision (Precision::Confusion());
sfs->SetMaxTolerance ( aSolidTol );
sfs->Perform();
aAIS_Shape->Set(sfs->Shape());
Sauvgarde= aAIS_Shape->Shape();

Handle(ShapeFix_Wireframe) SFWF = new ShapeFix_Wireframe;
SFWF->Load(aAIS_Shape->Shape());
SFWF->SetPrecision (Precision::Confusion());
SFWF->SetMaxTolerance ( aSolidTol );

SFWF->ModeDropSmallEdges() = Standard_True;
SFWF->FixSmallEdges();
SFWF->FixWireGaps();
aAIS_Shape->Set(SFWF->Shape());
}
catch(...)
{
aAIS_Shape->Set(Sauvgarde);
}
}

Christophe

Christophe Abel's picture

Hello,

i don't know if it would be efficient for you, but i developp this function and it help me with my complex Boolean operation:

void Model_Model::FixShape(Handle_AIS_Shape aAIS_Shape,const Standard_Real aSolidTol)
{
TopoDS_Shape Sauvgarde= aAIS_Shape->Shape();
try
{
Handle(ShapeFix_Shape) sfs = new ShapeFix_Shape;
sfs->Init ( aAIS_Shape->Shape() );

sfs->SetPrecision (Precision::Confusion());
sfs->SetMaxTolerance ( aSolidTol );
sfs->Perform();
aAIS_Shape->Set(sfs->Shape());
Sauvgarde= aAIS_Shape->Shape();

Handle(ShapeFix_Wireframe) SFWF = new ShapeFix_Wireframe;
SFWF->Load(aAIS_Shape->Shape());
SFWF->SetPrecision (Precision::Confusion());
SFWF->SetMaxTolerance ( aSolidTol );

SFWF->ModeDropSmallEdges() = Standard_True;
SFWF->FixSmallEdges();
SFWF->FixWireGaps();
aAIS_Shape->Set(SFWF->Shape());
}
catch(...)
{
aAIS_Shape->Set(Sauvgarde);
}
}

Christophe