Grasshopper

algorithmic modeling for Rhino

I'm having a little trouble with data matching. I have a list of points that are assembled into branches at the same level {0}...I need to get the projection of these points onto a surface and then add to each ones z value. The intersections with the surface are producing an entirely different data path structure then the original points and I can't figure out why. I need the intersections to be structured the same way so that when I go back and add values the additions end up in the right place.

This explanation may be too complicated to follow but I believe, I hope, that the solution is really easy. I have tried everything I can think of but it's just not working. Any advice is really appreciated.

Views: 244

Attachments:

Replies to This Discussion

thanks so much! that's really amazing.

I just have to figure out the problem of lists greater than 10 - I need 32 of them...I haven't fully digested what you've done in your script but from you conversation it sounds like it might be possible to tweak it to accommodate more..
I actually had 128 paths not 32 - here was my solution. Thanks again Vicente. I really would have been in trouble without this

Dim tree As New DataTree(Of On3dPoint)
Dim sum As Integer = 0

For i As Int32 = 0 To y.count - 1
Dim c As Char = Convert.ToChar(y(i).substring(7, 1))
Dim d As Char = Convert.ToChar(y(i).substring(8, 1))
Dim p As Integer

If c = ";" Then
p = convert.ToInt32(y(i).substring(6, 1))
Else If d = ";" Then
p = convert.ToInt32(y(i).substring(6, 2))
Else
p = convert.ToInt32(y(i).substring(6, 3))
End If

Dim path As New EH_Path(p)
For j As int32 = sum To sum + z(i) - 1
tree.Add(x(j), path)
Next
sum = sum + z(i)
Next

A = tree
ok from what I can tell a new branch is created for every intersection event - so my 128 branches carrying from 20 -32 points each becomes 32 branches (the highest of all the lists) ranging from 128 points down to...well I hope it's roughly evident the reshuffling. Still not sure how to solve the problem.

I tried duplicating the surface by the number of branches (128) before the intersection, and that appears close - i end up with a structure of {0:0} where the first number is the branches I started with, and the second one for each point - if anyone could suggest how to go from this {0:0}{0:1}...{127:31} to this {0}...{127} - basically the second part of each path I would like to flatten into the first..anyone?
I added a few posts but they seem to have not made it through.

the whole thing worked and I just wanted to thank you big time Vicente.

For those trying to make the script work for branch lists exceeding 10, what I did was add a char variable for each value to the power of 10. WHat I mean is that I did an if conditional search where if the 7th character was a ";" than I knew that my p (path) would only be 1 character long. if the 8th one was a ";" than i knew it would be 2, and so on...I'm not sure if that's clear. I can post the code next time I'm looking at it...

RSS

About

Translate

Search

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service