Grasshopper

algorithmic modeling for Rhino

I want to make a curve from some points that are given to me. I've made some lines before this with no trouble, and tried to do it the same when with curves. This gives an error.

In C# when I try to make a new curve from points I attempt to do it by writing:


    Curve cv = new Curve();

This gives me the error:
Error: 'Rhino.Geometry.Curve.Curve()' is inaccessible due to its protection level (line 88)

I have also tried calling the CreateInterpolatedCurve() from the Curve class, but


Curve cv = null;
cv = new Curve.CreateInterpolatedCurve(Mould.Branch(0), 3);

 But from this i get:

Error: 'Rhino.Geometry.Curve.CreateInterpolatedCurve(System.Collections.Generic.IEnumerable<Rhino.Geometry.Point3d>, int)' is a 'method' but is used like a 'type' (line 89)

I'm really quite lost about how I can this to work. Can anyone help me?

Views: 4388

Replies to This Discussion

Curve does not have a constructor that you can call. You can create new NurbsCurves or LineCurves, but not the base type Curve.

CreateInterpolatedCurve is a static method on the Curve type. To call it, all you need is the type name:

Curve cv = Curve.CreateInterpolatedCurve(Mould.Branch(0), 3);

 

--

David Rutten

david@mcneel.com

Poprad, Slovakia

Thank you, both of you! I had not realised that the Create method already generates a new object. This also clears up some other mild confusion I have had with some of the different types.

Again, thank you very much for the fast reply! :)

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service