algorithmic modeling for Rhino
Hi,
I'm pretty new to this and maybe this an easy one. I have a rhino file open, I have a set of curves. Now I need to connect those curves from Rhino to Grasshopper Curve Parameter. I need to do this inside rhinoScript.
How to do this?
I know that I have four curve parameters in Grasshopper named Crv1-Crv4, I have my array of curves in rhino scene, I can iterate them, get their ID, etc. I'm just completely lost on GH public API...
+ Is there some documentation for GH API accessible via rhinoScript?
Best regards,
Boris
Tags:
Come 0.9.0052 (I'll probably release it later today) the attached files will work.
--
David Rutten
david@mcneel.com
Poprad, Slovakia
Thanks, David!
I've found guids of curve params in my .gh following this thread http://www.grasshopper3d.com/forum/topics/gh-assigndatatoparameter
My code is as follows:
Dim arrCurves
Dim j
arrCurves = Rhino.ObjectsByType(4)
If IsNull(arrCurves) Then Exit Sub
'prestored ids of curve params from GH (TODO, get them dynamically?)
Dim ids
ids = Array("6cc6333e-144a-4574-93ad-9f08aca393c6", "45740fae-c491-4567-8ff1-84e129a056d7", "d661791e-6128-4b5f-bcc5-a517fc5020a8", "28bbdd74-7ce7-4498-b293-153243eb099e")
For j = 0 to ubound(arrCurves)
rhino.print "slot " & j & " ID is " & arrCurves(j)
Call GH.AssignDataToParameter( ids(j), arrCurves(j) )
Next
There is no error, but no connection either, is there a way to debug this (some log, output)? As this method is recognized do I need to wait for 0.9.0052 or should it work with older releases?
This is the output of print method:
slot 0 ID is 8de68939-d951-4c52-b44c-153b1b8d388a
slot 1 ID is abb19855-e315-41fc-9765-c464a468e7a4
slot 2 ID is 3248fb21-45f3-42b0-b6d8-218e518cfe48
slot 3 ID is 70dab461-07ef-432e-9737-2fecbad65fab
so I guess my curves are selected and input into AssignDataToParameter method correctly?
Best regards,
Boris
At the moment Grasshopper distinguishes between objects that implement IEnumerable and those that don'tin an attempt to figure out whether single items or lists ought to be assigned to a parameter. Unfortunately Strings are ienumerable collections of characters. Thus the assignment fails. I have fixed this, but you'l have to wait until 0.9.0052 is released.
--
David Rutten
david@mcneel.com
Poprad, Slovakia
ok, thanks for fixing it! I will wait for next release.
Boris
It has been released about an hour ago.
--
David Rutten
david@mcneel.com
Poprad, Slovakia
Thanks, looks like it resolved my issue, thanks for help, much appreciated!
Boris
Welcome to
Grasshopper
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
© 2024 Created by Scott Davidson. Powered by