algorithmic modeling for Rhino
Hi everyone,
I wrote this script but it doesn't work. I don't know what's wrong. Please help! Thx!
Private Sub RunScript(ByVal brep As Brep, ByVal vector As List(Of Vector3d), ByRef A As Object)
Dim breps As New List(Of Brep)
Call translate(breps, brep, vector)
A = breps
End Sub
'<Custom additional code>
Sub translate(ByRef breps As List(Of Brep), ByVal brep As Brep, ByVal vector As List(Of Vector3d))
If breps.Count() > vector.Count() Then Exit Sub
Dim v0 As New Vector3d
Dim count As Integer
count = vector.Count()
For i As Integer = 0 To count - 1
v0 = vector(i)
brep.translate(v0)
breps.Add(brep)
i = i + 1
Next
Call translate(breps, brep, vector)
End Sub
Tags:
Replies are closed for this discussion.
you've created a recursive function with no way out! The subroutine "Translate" calls the subroutine "Translate" which calls the subroutine "Translate" which calls the subroutine "Translate" which calls the subroutine "Translate" which calls the subroutine "Translate" which calls the subroutine "Translate" which calls the subroutine "Translate" which calls the subroutine "Translate" which calls the subroutine "Translate" which calls the subroutine "Translate".... you get the picture.
It would be helpful to give an explanation of what you're trying to do so we can make suggestions about how to accomplish it.
Here's the idea,
First we got one box(green box) and a list of tangent vectors. The idea is moving this box by its own tangent vector on the curve.(white box) and this "new" box generates the next one by its own tangent vector on the curve... and this happens to the last item. Here's the algorithm:
B0 ----> B1
B1 ----> B2
B2 ----> B3
B3 ----> B4
Please Help! :(
So where does the curve come in? Your code does not mention any curves, only a list of vectors, which are inputted and therefore known ahead of time.
I also don't see the need to both iterate and recurse. Surely if you have a list of vectors all you need is iteration?
Private Sub RunScript(ByVal G As GeometryBase, ByVal v As List(Of Vector3d), ByRef A As Object)
Dim geometry As New List(Of GeometryBase)
For i As Integer = 0 To v.Count - 1
'Duplicate the geometry because you kept
'transforming the same one over and over.
G = G.Duplicate()
G.Translate(v(i))
geometry.Add(G)
Next
A = geometry
End Sub
--
David Rutten
david@mcneel.com
Poprad, Slovakia
Yes, I think I need Iteration. Thank you so much. ;)
You could achieve the same using Mass Addition btw. and hooking up a Move component to the Pr output.
--
David Rutten
david@mcneel.com
Poprad, Slovakia
Thank you! :) I appreciate your help.
Dear David,
This is my last try. This definition supposed to be working. I dont' know what to do. please help! :( thx
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