generative modeling for Rhino
With a vb.net component, I want to select groups of curves, and then hide the curves selected and store it in a list of list of curves.
Here is my script :
Dim i,j As Integer
Dim reponse As Integer
Dim objRefs As Rhino.DocObjects.ObjRef() = Nothing
Dim lstElts As New List(Of Object)
Dim lstLstElts As New List(Of List(Of Object))
Rhino.Input.RhinoGet.GetInteger("Number of groups (max =4) ?", False, reponse, 1, 4)
For i = 0 To reponse - 1
Rhino.Input.RhinoGet.GetMultipleObjects("Select curves of group n°" & i + 1, False, Rhino.DocObjects.ObjectType.Curve, objRefs)
For j = 0 To objRefs.Length - 1
Everything is working, excepting hiding the curves (in Red).
Any idea ?
Also, I would like to change the color of the curves after beeing selected, but I don't know how to do it (I used Call Rhino.ObjectColor with Rhinoscript, but I can't find the equivalence in rhinocommon).
Any idea ?
Thanks for your help
Replies are closed for this discussion.
Before we do anything else, I think you should not be asking for user input inside a Grasshopper component. I.e. this:
Is weird. Why not use an input parameter to supply the integer?
I think what you're looking for is:
The hide script is working now. But I still have two questions :
- About asking for user input inside a Grasshopper component, you are right, that is because I still have rhinoscript habits. BUT : I want to select multiples lines, and I don't know how to do this with the Line component because if I use "Manage line collection", I have to pick lines one by one, and I don't know how to pick a selection of lines in the Rhino window. Is it possible ? Same question for points
- How can I change the color of an existing Line with a vb script ?
Thanks for your help.
Set Multiple Lines in the menu will allow you to select a whole bunch at once. I don't think Grasshopper is a good tool for modifying geometry in the Rhino document though, it tends to work on its own geometry only.
Is there a reason you're unhappy with RhinoScript?
Changing display colours of Rhino objects is accomplished by modifying the attributes of the object. You'll need to get the current attributes, set the colour source and the colour, then replace the attributes.
Thanks for your answer again. I'll find out the exact script to change the color with your instructions.
I have no problem with Rhinoscript, but to me, Grasshopper is more intuitive and easier to use, so I prefer converting my old script, since I can add vb components, wich is necessary to me (I'm working on a formfinding script). Programming is not my speciality (I'm a structural engineer), so it is easer to script with visual components, rather than with 2500 lines and 15 differents arrays I would have to deal with.
But I am a bit lost with the langages I can use (vb, rhinocommon, rhinoscript,...) with vb components. Is there any document which gathers and explain this (like for exemple equivalences between Rhinoscript and rhinocommon) ?