algorithmic modeling for Rhino
Hello,
I am trying to create a script that finds all the rhino groups in a document, then iterates through the list and creates lists of each group, then adds that to a list of all groups in the document.
Hopefully I would be able to, using grasshopper, rotate each group individually.
Private Sub RunScript(ByVal x As List(Of Object), ByVal y As Object, ByRef A As Object, ByRef B As Object)
b = doc.Groups.GroupNames(True)
Dim geo_out As New list(Of GeometryBase)
Dim int As int32 = doc.Groups.Find(group_name, True)
Dim groups As New list(Of GeometryBase)
For Each nestedGroup As docobjects.rhinoobject In b
Dim group1 As New list(Of GeometryBase)
group1.add(nestedGroup.Geometry)
groups.add(group1.Geometry)
Next
a = groups
End Sub
My script shows up as red in grasshopper. What is wrong with it? What datasctructure is best for achieving this?
Thanks!
Tags:
If you want to rotate groups in Rhino, wouldn't it make a lot more sense to implement it as a VB.NET Rhino plugin? Grasshopper typically doesn't deal directly with the Rhino document, except to retrieve geometry from it.
You can certainly make it work in Grasshopper, although it might be weird to run this code consecutively.
Step one is make sure your variables are type safe. Don't use Object as a type unless you absolutely have to. I attached a script which collects all grouped Rhino objects into Grasshopper groups.
--
David Rutten
david@mcneel.com
Hello David! thanks so much!
The script collects the groups into what I envisioned would work in achieving the final result. However, I am still stuck, and this issue has to do with something I've been struggling in grasshopper for as long as I can remember. I cannot find a way to do something iteratively. For example, I need to go through each group, extract the circle from each group, and rotate that group around the circle's center. I have a script which successfully achieves that for each single group, however, I cannot find a way to step through each single group in grasshopper and do this.
What is the way of doing this? Ive heard of hoopsnake, but I am not sure that is the right approach. I've tried series, but that does not help me to iterate. Rather, it takes the the list item component and creates another list from it.
What is the right approach for scripting when I need to iterate?
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
Added by Parametric House 0 Comments 0 Likes
© 2024 Created by Scott Davidson. Powered by