How to delete a face from a Brep

Hi,
i can´t figure out how delete a face from a Brep…
In my case i have a (Brep) pipe with round caps and i want to lose one cap. Right now i extract the first two surfaces, make them both into Breps, join those and than cap the new Brep flat.
That seems unnecessary complicated!?
Thanks

I guess you’re looking for BrepFaceList.RemoveAt:

private void RunScript(Brep brep, int i, ref object A)
{
  brep.Faces.RemoveAt(i);
  A = brep;
}

RemoveAt
RemoveAt.gh (10.9 KB)

1 Like

Thanks!

Here is a slightly more robust version:

  private void RunScript(Brep brep, int index, ref object A)
  {
    if (null != brep && index >= 0 && index < brep.Faces.Count)
    {
      brep.Faces.RemoveAt(index);
      brep.Compact();
      if (brep.IsValid)
        A = brep;
    }
  }

– Dale

1 Like