Grasshopper

algorithmic modeling for Rhino

A suggestion: perhaps the NurbsCurve type hint (perhaps also other Curve subtypes?) can be added to the scripting components, so it's easier to access the NurbsCurve methods.

Or perhaps I am missing a quick fix for this issue?

My input is a list of curves, and to access the Points property I am now casting each curve individually to a nurbs curve and then adding them to my new list.

 

' Input: Curves as List (Of Curve)
Dim NurbsCurves As List(Of NurbsCurve)
For i As Integer = 0 To Curves.Count - 1
Dim curve As NurbsCurve = Curves(i)
NurbsCurves.Add(curve)
Next

 

 

Views: 842

Replies to This Discussion

Hi Arend,

 

Well, what if the input curve is not a nurbscurve?  Would you want the script component to convert the curve to a nurbscurve?

 

By the way, your casting code will work only with input that is actually a nurbs curve, so if you have other types such as "line", then the result is not valid.  If you want to convert your curves to nurbs curves, then I suggest you do something like:

 

    Dim NurbsCurves As New List(Of NurbsCurve)

    For i As Integer = 0 To Curves.Count - 1
      If Curves(i).HasNurbsForm Then
        NurbsCurves.Add(Curves(i).ToNurbsCurve)
      End If
    Next

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