Merge body with Fuse function

Hi,

I would like to merge two shape with BRepAlgoAPI_Fuse. The merge seems to work but useless edge remain.
I tried to remove this useless edge with ShapeFix_Shape but nothing happend. I join a picture at my message to illustrate my problem.
Is there any solution to this problem ?
Thanks for you response.

Regards,

Manon

Attachments: 
Mikhail Sazonov's picture

Use the method SimplifyResult of the parent class BRepAlgoAPI_BuilderAlgo.

Manon Jubert's picture

Mikhail,
Thank you for you're answer. I try o use this function but the result shape is empty.
My code is :
BRepAlgoAPI_BuilderAlgo algo;
TopTools_ListOfShape aLS;
aLS.Append(m_Body);
algo.SetArguments(aLS);
algo.SimplifyResult();
m_Body = algo.Shape();

Maybe i did something wrong ?

Regards,

Manon

Manon Jubert's picture

I also try this :
BRepAlgoAPI_BuilderAlgo algo;
//BOPAlgo_Builder algo;
TopTools_ListOfShape aLS;
aLS.Append(m_bodies[0]);
aLS.Append(m_bodies[1]);

if (m_bodies.size() > 2)
{
for (int i = 2; i < m_bodies.size(); i++)
{
aLS.Append(m_bodies[i]);
}
}

algo.SetArguments(aLS);
algo.SetRunParallel(Standard_True);
algo.SetFuzzyValue(1.e-5);
algo.SetNonDestructive(Standard_True);
algo.SetGlue(BOPAlgo_GlueShift);
algo.SetCheckInverted(Standard_False);
algo.SetUseOBB(Standard_True);

algo.Build();
algo.SimplifyResult();
m_Body = algo.Shape();

ShapeUpgrade_UnifySameDomain unify;
unify.Initialize(m_Body);
unify.Build();
m_Body = unify.Shape();

My shape remain the same as the begining.

Mikhail Sazonov's picture

I meant that you just call SimplifyResult after Build.

Alternatively, you can perform the algorithm ShapeUpgrade_UnifySameDomain on the result of fuse. You can play with various values of linear and angular tolerances.

Manon Jubert's picture

Yes it's what I did, but nothing happend. I attach to this message the different result after my test.
I try without simplify, simplify after build, use ShapeUpgrade_UnifySameDomain on the body result and ShapeUpgrade_UnifySameDomain with different angular and linear tolance (0.1) but the result is always the same.
There is my code :
algo.Build();
algo.SimplifyResult();
m_Body = algo.Shape();

ShapeUpgrade_UnifySameDomain unify;
unify.Initialize(m_Body);
unify.SetLinearTolerance(Precision::Confusion()); // or 0.1
unify.SetAngularTolerance(Precision::Angular()); // or 0.1
unify.Build();
m_Body = unify.Shape();

Attachments: 
Manon Jubert's picture

It finaly works with :
m_Body = BRepAlgoAPI_Fuse(m_bodies[0], m_bodies[1]);

ShapeUpgrade_UnifySameDomain unify;
unify.Initialize(m_Body);
unify.Build();
m_Body = unify.Shape();

But I dont understand why it's not working with the general fuse algorithm BRepAlgoAPI_BuilderAlgo like in the documentation. There is any reason for that ?

Mikhail Sazonov's picture

General fuse algorithm just splits the shells of the arguments at intersections and gathers all in one compound, which is not a manifold solid. Simple fuse produces one solid object, in its shell these edges are actually extra and unify same domain removes them.

Manon Jubert's picture

ok, thank you for the explanation