Serious problem with Brep.Trim(Plane,Threshold)

Hi ,
I have a situation that trimming a planar Brep with a plane fails using any tolerance.
you can see in the image that brep passes trough the plane clearly with a relatively large angle. however the trim fails (see the grasshopper file).
If you just rotate the object with tenth of degree , then the trim works.
this is causing my program fails.
thanks for your help.

plane_brep_trim problem.3dm (150.1 KB)
problem with plane_brep trim.gh (9.7 KB)

@dale, is this a RhinoCommon bug or an oversight on our side? An intersection can be found with for the two objects, but Brep.Trim() returns an empty array in both C# and Python.

Hi @diff-arch,

Yes I see that - I’ve logged this so we can have a closer look.

https://mcneel.myjetbrains.com/youtrack/issue/RH-65209

In this case, use Brep.Split and then toss the piece you don’t want.

  private void RunScript(Brep brep, Brep cutter, ref object A)
  {
    if (null != brep && null != cutter)
      A = brep.Split(cutter, RhinoDocument.ModelAbsoluteTolerance);
  }

– Dale

1 Like

Thanks, @dale! You probably won’t believe this, but through this thread I’ve finally found out why I couldn’t get a 2 and a half year old Python script to work! :smiley:

1 Like

Hi @dale
Since I only have the cutting plane as input, I fist build a bounding box of the stock object based on the input plane , then built a planar brep based on the bottom face of the bounding box , move it to the plane position and do the split. then test which one of the results are on the positive side of the input plane.
is there a better workaround if you take a plane as input?

Hi @torabiarchitect,

In the end, the version of Brep.Trim that accepts a plane is doing the same you are doing with split. So I think your good.

– Dale

1 Like

Interesting! I don’t know why I was expecting this to be much lighter in terms of computation.
Anyhow thanks for your feedback and looking forward to the fix .

I agree this is a serious bug and it was easy to “fix”. Please check out the version 7 release candidate coming out next week and let me know if the problem is fixed.

RH-65209 is fixed in Rhino 7 Service Release 10 Release Candidate

1 Like