Grasshopper

algorithmic modeling for Rhino

Hi,

I'm pretty new to VB.net scripting and I'm trying to get a projected curve on a plane using the script component in grasshopper. What I have done is to use RhUtil.RhinoProjectCurvesToPlane but all I get for the result is boolean whether curve can be projected on a plane or not. How can I have a projected curve as a result?

Thanks!

Views: 401

Replies to This Discussion

functions always report if they were successful or not
so if you want to get the curve it is stored inside the ref variable (byref means it's sending you back the calculated solution)

Dim crvout As OnNurbsCurve = New OnNurbsCurve
crv.GetNurbForm(crvout)
RhUtil.RhinoProjectToPlane(crvout, y)
A = crvout
Most of the methods in RhUtil don't actually return much more than boolean values, and even at that it can be "tricky" to rely on those boolean values for the success or failure of a given method. What most methods do is output the result of the function into a variable that you have to supply. In this case, the curves that you supply into the method will be changed to the projected curves if the method is successful. You can tell if a given variable does this by looking at the intellisense and seeing if it says anything for [out]


Note that because this particular method changes the input curves, you should really supply a copy of the original curves so that you have the originals lying around.
Thank you to] and Damien for the help!!
Now I understand what I was missing. I'm glad I asked even though it is totally a newbie's question.
It takes most people a little bit of time to get used to supply variables that then get filled by a given function. Some times it makes it easier, others its slightly more of a pain, but once you know you can at least deal with it.

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service