Brep SetTolerances() Method

Hello,

while creating a Brep by code, I am getting an invalid Brep because the start and end of a loop do not match, although I have tried to set a lower tolerance and it doesn’t seem to take that into account.

Here is the message I am getting :

"brep.m_L[0] loop is not valid.\n
end of brep.m_T[loop.m_ti[2]=2]=(0.00592947,0.993256) and start \n
of brep.m_T[loop.m_ti[3]=3]=(0.00592885,0.99326) do not match.\n
brep.m_F[0] face is not valid.\n
brep.m_L[face.m_li[0]=0] is not valid.\n
ON_Brep.m_F[0] is invalid.\n"

I tried using the BrepTrim.SetTolerances() method on all trims and Brep.Repair() using a tolerance of 0.001 and still doesn’t seem to do it.

Any idea where is the tolerance to modify in order for my topology to be valid ?

Hi @ahmedwael.si,

Your error is not due to a tolerance issue - the ends of Brep trims need to match exactly.

ON_Brep::MatchTrimEnds() can help do this.

– Dale

Hi @Dale,

Thanks a lot for your response.

Is there is a way to access the ON_Brep::MatchTrimEnds() method or equivalent from RhinoCommon using C#?

https://developer.rhino3d.com/api/RhinoCommon/html/Overload_Rhino_Geometry_Collections_BrepTrimList_MatchEnds.htm

Thanks a lot @dale, that solved it