Grasshopper

algorithmic modeling for Rhino

Hug eveyone :), i get some troules in this way ?

 

private void RunScript(List<On3dPoint> Pts, ref object A)
  {
    RMA.OpenNURBS.OnNurbsCurve Ncurve;
    Ncurve.CreatePeriodicUniformNurbs(Degree, (Degree + 1), Pts); 

    if (Ncurve.IsValid()){A = Ncurve;}
  }

Views: 241

Attachments:

Replies to This Discussion

There are two thiings wrong with you code. First, you never instantiate Ncurve, just declare it as on OnNurbsCurve. Without actually creating an instance of an OnNurbsCurve class, the method your trying to use won't work. Second, you can't supply a List to that method. It needs to be an array, which is pretty simple to do. See below for working code...

OnNurbsCurve Ncurve = new OnNurbsCurve();
if (Ncurve.CreatePeriodicUniformNurbs(Degree, (Degree + 1), Pts.ToArray()))
{
A = Ncurve;
}
hey thanks Damien ;)
Just another things :) how i can easly reconize the correct kind of argument for this method ?
becose in that case the argument type needed, seems not to be very explicit for me .
When you type the method and as you go through adding the arguments, Intellisense will pop up and let you know what is expected for that argument, both in regards to what that argument should be (ie points, or the degree of the curve) and the data type needed. I'm not sure exactly what you mean by not very explicit, but the data type shown is always going to need to be what's expected. In this case it was a simple array of the IOn3dPoint type, but for something like this it could have potentially been an ArrayOn3dPoint or an On3dPointArray. Either way, you have to make sure that the class/type of the data your supplying matches what is expected/required by the method. You can also check the help file out if you need more info. Its however a bit more hit or miss, as it may not have a full description.

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service