Fillet curve at parameter is un-grasshopper-y

I’m attempting to fillet a curve in multiple locations at once, but that doesn’t work :

Fillet Curve is un-grasshopper-y.gh (9.4 KB)

I wish there was an equivalent to the “Fillet Edge” component where you just specify the indices of the edges to fillet, and it fillets all at once.

There are two other fillet tools for curves that fillets “all sharp corners”, but I generally only need to fillet specific corners.

1 Like

Here a small workaround using c# and iterating over NodeInCode:


Corrected code by Harri Lewis Fillet curve at parameter is un-grasshopper-y - #4 by Harri_Lewis

As it accepts also different radiuses for each parameter, please feed it same amount of t and R

Code:

 private void RunScript(Curve Ci, List<double> t, List<double> R, ref object Co)
  {
    // Creating Fillet component delegate
    Rhino.NodeInCode.ComponentFunctionInfo FilletInfo = Rhino.NodeInCode.Components.FindComponent("Fillet");
    System.Delegate Fillet = FilletInfo.Delegate;

    int n = t.Count;

    // At each iteration curve domain will change; finding wanted fillet locations
    List<Rhino.Geometry.Point3d> pts = new List<Rhino.Geometry.Point3d>();
    for(int i = 0;i < n;i++){
      pts.Add(Ci.PointAt(t[i]));
    }

    // Iterating
    for(int i = 0;i < n;i++){
      // Finding correct parameter for current iteration's curve
      double tt;
      Ci.ClosestPoint(pts[i], out tt);
      IList<object> results = (IList<object>) Fillet.DynamicInvoke(Ci, tt, R[i]);
      IList<object> resultList = (IList<object>) results[0];
      Ci = (Rhino.Geometry.Curve) resultList[0];
    }

    Co = Ci;
  }

Thank-you Riccardo.

This has also the merit of giving me concrete examples of C# code, which helps in learning.

Hi @maje90

Nice example - it proved useful for me today.

Looks like there was a small typo in the code - when iterating you were always checking against the first item in pts. See attached edit.

Thanks again,

Harric# curve multifillet hl edit.gh (12.7 KB)

1 Like