DiscussionsIssue archiveModeling Data and Algorithms

Archived discussion

Merge body with Fuse function

Modeling Data and AlgorithmsWed, 01/19/2022 - 19:288 replies

Browse this forum
QuestionAuthor

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,

Author

Discussion

8 archived replies

Posts are displayed in their archived order.

01Commenter-1

Use the method SimplifyResult of the parent class BRepAlgoAPI_BuilderAlgo.

02Author

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,

Author

03Author

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.

04Commenter-1

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.

05Author

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();

06Author

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 ?

07Commenter-1

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.

08Author

ok, thank you for the explanation