Problems filleting a closed Brep

Hello there,
I am trying to automatically fillet edges of a closed Brep with rhinoinside python. I have a method for selecting edges that should be filetted and my Brep is both closed and topologically valid. Yet I can’t find the proper parameters so that the Brep.CreateFilletEdges succeeds.
I am using BlendType.Fillet and RailType.RollingBall as options. I tried many values for the radii and for the tolerance (which seem to be the 2 main parameters I can play with to impact the outcome).
I have successfully used the same algorithm on other models but the values for the radii can be really different.

CreateFilletEdges results over a closed Brep with a valid edge selection are separate in 4 categories :

  1. no output at all (empty array) and no reason for it …
  2. one output but the Brep is not topologically valid (and no reason for it)
  3. one output but the Brep is not closed anymore (some holes appeared during the process) and no reason for it
  4. one valid, closed Brep is returned (yeay)

So my questions are :

  1. Is there any place where I can find documentation on how the edge filleting works, what are its limitations, etc …
  2. Is there a way to preprocess my Brep so that I can guarantee to have a valid output (4) ? I already tried to MergeCoplanarFaces and SplitKinkyFaces
  3. Is there a way to have an error report from the function as I can have when I call IsValidTopology ?
  4. Is there a way to predict if a Brep can be filleted at all ? with given parameters ? This would be great to avoid waiting for CreateFilletEdges to fail … and believe me it takes time to compute when it fails
  5. How come this function is able to give me a correct result with fillets of 0.5mm radius, and 0.7 mm but returns an invalid topology for 0.6 mm ? Values are not specific obviously but this behviour doesn’t allow me to have a good “try and error” approach.
  6. In case of a topologically correct but not closed Brep (3), Is there an easy way to automatically close the Brep ?

I can post a bit of code if you think it is relevant even if I only use the CreateFilletEdges with model specific values. I also upload a 3dm of the failing closed Brep and the highlighted selected edges
Fillet_Debug.3dm (193.4 KB)

Thanks for your answers

That is pretty easy to answer. The FilletEdge function attempts to make one fillet for every edge selected.

It does this based on the flawed assumption that this algorthm will work. If you happen to be lucky enough to have a BREP that does have a one-to-one correspondence between edges and fillets (like a box) then the algorthm may work. But most arbitrary BREPs do not - so you can expect this algorthm to mostly fail.

Most likely because .5mm and .7mm produce one fillet per edge in a configuration that can be trimmed and joined to the main body, while .6mm does not. Its a crap shoot.

I took a look at your file. The main problem is your technique for building surfaces in your BREP produces surfaces that are twisted and fold back on themselves so that they cannot support fillets because the curvature of the base surface is much smaller than the fillet size.