algorithmic modeling for Rhino
I have this very strange problem, which has never occurred to me before, I have a datatree that I am looping through and then if a certain "if" statement is met then I add an object to a predetermined branch. The weird part is that when I add stuff to the "trail" branch, the path "p" gets rewritten, and if I comment(trail) out it maintains its proper structure.
The structure normaly goes{0;0}-{1;0}-{2;0} and so on, when I enter the if statement it should be {0;0}-{0;1}-{1;0}-{1;1}-{2;0}-{2;1}, but what I get is {0;0}-{0;1}-{0;2}-{0;3}-{0;4}-{0;5}
The code in question is bellow(it is a part of a bigger whole).
For i As int32 = 0 To trail.BranchCount - 1
For j As int32 =0 To trail.Branch(i).Count - 1
Dim ghi As GH_Path = trail.path(i)
Dim v As Vector3d = vL.Branch(i).item(j)
Dim pw As New Polyline(trail.Branch(i).item(j))
Dim agent As New point3d(pw.Last)
Dim p As New GH_Path(ghi(0), ghi(1) + 1)
v.Unitize
v *= seg
agent += v
If (count Mod math.Ceiling(conrate * div) = 0) AndAlso _
(stopper.Branch(i).item(j) = 0 AndAlso count > 0) Then
print(p.ToString)
Dim dupPw As New polyline
duppw.Add(pw.Last)
duppw.Add(pw.Last + v * seg)
vl.Add(v, p)
gen.add(gen.Branch(i).item(j) + 1, p)
stopper.add(0, p)
stopper.Branch(i).item(j) = 1
trail.Add(duppw, p)
Continue For
End If
pw.Add(agent)
vl.Branch(i).item(j) = v
trail.branch(i).item(j) = pw
Next
Next
I am looking foreward to hear any suggestions.
Sincerely
Tags:
Hi Jens,
you're going to have to post something that actually runs, ideally the simplest case that reproduces the problem. I can't work out from this where the problem might be.
--
David Rutten
david@mcneel.com
Poprad, Slovakia
I have now attached a verison with the problem, I have added small comments here and there, so I hope that it makes sense.
Looking foreward to hear from you again
Hey David.
I found a solution now.
The main problem was that I didn't quite get how the datatrees structures them selfs, but I sure as hell do now, after dealing with this problem for the past 24 hours...
So enjoi your holidays(i am guessing you are having a holiday based on the "support absence" message).
- Jens
Just some more clarification. I have attacthed two picture where you will see that the print saying:
path(0) = (a number) changes from following the i count to some strange mod when entering the if statemnt.
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