Grasshopper

algorithmic modeling for Rhino

hey guys,

is a method, but is used like a type...?  

Rhino.Geometry.NurbsCurve c1 = new Rhino.Geometry.NurbsCurve.Create(false, 3, ptsList2);

i dont understand this as in the SDK documentation its used the same way:

Rhino.Geometry.NurbsCurve nc = Rhino.Geometry.NurbsCurve.Create(false, 3, points);


thanks for the help


Views: 493

Replies to This Discussion

The method returns a NURBS curve rather than works on an existing curve. The reason behind this is that in the previous SDK you'd have to go through an "alternative" class, such as RhUtil or OnUtil to be able to create a nurbs curve from scratch. There wasn't really a "problem" with this except that it was somewhat hard to discover, so it was changed.

If you look closely at the documentation you'll notice that the function is declared as static (C#) or Shared (VB). What that means is that the function is constant and doesn't rely on a unique instance of the class being created in order to do its job. This means that you don't have to create a NurbsCurve just to be able to use that function, which is not the case with many other methods.
perfect, thanks damien

i case anyone is wondering, here is the correction:


Rhino.Geometry.NurbsCurve c1;

c1 = Rhino.Geometry.NurbsCurve.Create(false, 3, ptsList2);
your second piece of code above should work fine as well
yep, i see it now.. thanks damien. while i have you on the subject of the second version of the SDK

can you tell me what the difference is between:


List < Point3d > endPtsList = new List < Point3d > ();

and:

Rhino.Collections.Point3dList endPtsList = new Rhino.Collections.Point3dList();



i am having a prob that when i call this function:

Branch(line, ang, factor, factorB, iterations, TreeList, endPtsList);

private void Branch(Line line, double ang, double factor, double factorB, int iterations, ref List TreeList, ref Rhino.Collections.Point3dList endPtsList)

i am getting an invalid argument
So you're essentially asking what the differences is between the a Systems.Collection.Generic.List and a Rhino.Collections.Point3dList. Well, they are different classes that do just about the same thing, although it appears that the Point3dList has some specialized functionality to retrieve the X,Y, and Z values of the list without retrieving the specific object first. Ultimately, if the method that you're looking to use calls for a Point3dList, you can't supply a List. However you can create a Point3dList from a regular old dotNET list...

Point3dList my3dPointList = new Point3dList(myListOfPoint3d);
Point3dList also has a .nearestNeighbor function which i find very handy

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