Curve.DivideByCount Method C#

Hey everyone!

Curve.DivideBy… is not suggesting in grasshopper C# component!
Even there’s no suggestion after Curve.Di… !
Anyone experiencing the same problem? Or anyone can help me fix this?

Thanks a lot
Mehrzad

Divisions are not Static methods in Curve Class.


You have to use the selected curve object and then you can implement the division on it. Something like this

 private void RunScript(Curve inputCrv, double iLength, int iCount, string iDivideBy, ref object A)
  {

    List<Point3d> divisionPts = new List<Point3d>();
    Point3d[] divPts;
    if(iDivideBy == "Count")
    {
      inputCrv.DivideByCount(iCount, true, out divPts);
      divisionPts.AddRange(divPts);
    }
    else if(iDivideBy == "Length")
    {
      inputCrv.DivideByLength(iLength, false, out divPts);
      divisionPts.AddRange(divPts);

    }


    A = divisionPts;



  }


DivideCurve C#.gh (7.6 KB)

1 Like

Thanks
It’s working perfectly!