Brep Face Joined Outline

Is there a way to get directly joined BRep faces curves (one closed outline) to avoid calling JoinCurves method?

The reason to ask is that the DuplicateNakedEdgeCurves outputs unordered set of curves.
That requires JoinCurves method to joints all curves into closed path.

        var c = new List<Curve>();

        foreach (BrepFace face in brep.Faces) {
            Brep b = face.DuplicateFace(false);
            Curve[] edges = b.DuplicateNakedEdgeCurves(true, false);
            c.AddRange(Curve.JoinCurves(edges));
        }

Hi @Petras_Vestartas,

Is this all you want?

protected override Result RunCommand(RhinoDoc doc, RunMode mode)
{
  var filter = ObjectType.Surface | ObjectType.PolysrfFilter;
  var rc = RhinoGet.GetOneObject("Select surface or polysurface", false, filter, out ObjRef objref);
  if (rc != Result.Success || objref == null)
    return rc;

  var brep = objref.Brep();
  if (null == brep)
    return Result.Failure;

  foreach (var face in brep.Faces)
  {
    var curve = face.OuterLoop.To3dCurve();
    doc.Objects.AddCurve(curve);
  }

  doc.Views.Redraw();

  return Result.Success;
}

– Dale

1 Like

This is neat, thank you as always @Dale.