Grasshopper

algorithmic modeling for Rhino

hi all,

I want claculate the intersection of two curves and obtain their intersection points in vb scripting.also,I know how to use"ArrayOnX_EVENT()"method to claculate,but the curves be created from different class like "onlin"."oncircle" ect.maybe x_EVENT() just
provide for "oncurve" type.I don't know the right approach to convert original class to a corresponding class.

maybe the step is convert online to onlinecurve ,then onlinecurve to oncurve?

thanks

Views: 555

Replies to This Discussion

I think you could use the "new OnLineCurve(line)" and then use it directly as the OnLineCurve is a OnCurve?

"Public Class OnLineCurve
Inherits OnCurve
Inherits IOnLineCurve"
Guilo is correct, but I think that a further explanation on these classes will be helpful. The OnCurve class is an abstract class which means that I don't really ever have an OnCurve and I can't create an OnCurve directly. Generally abstract classes are classes that contain common functionality between other classes. In this case, OnCurve implements a number of functions that are necessary for all of the other curve classes, such as OnNurbsCurve, OnLineCurve, OnPolyCurve, etc. to use. In cases where a given function has an OnCurve as an input, it means that I can use any of those classes that derive from OnCurve within that function.

There are several curve types in the Rhino SDK that do not derive from OnCurve, such as OnCircle, OnEllipse, OnLine, OnPolyLine, etc. In some cases, such as OnLine and OnPolyLine, then have a corresponding class that does derive from OnCurve that generally has the word "curve" after it, so OnLineCurve and OnPolyLine curve. For curve classes that are not derived from OnCurve, yet do not have "curve" counter parts, you can still create an OnCurve derived curve from those classes. Almost all of those non OnCurve classes have a function called GetNurbsForm. With this function you can convert one of those non OnCurve classes to a OnNurbsCurve and use it as you wish.

I know that this is probably a little confusing, but its definitely useful information.
Here's a little example of how to get a nurbs form from a non OnCurve class...pretty straight forward.

Dim ellipse As New OnEllipse (OnUtil.On_xy_plane(), 1, 2)
Dim nurbsCrv As New OnNurbsCurve ()

ellipse.GetNurbForm(nurbsCrv)
Thanks for the background information. It's very nice to see how things are actually built.

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service