ems in the same way. Lofting was particularly difficult, you had to have a separate loft component for every lofted surface that you wanted to generate because the component would/could only see one large list of inputs. Then came along the data structures in GH v0.6 which allowed for the segregation of multiple input sets.
If you go to Section 8: The Garden of Forking Paths of the Grasshopper Primer 2nd Edition you will find the image above describing the storing of data.
Here you will notice a similarity between the path {0;0;0;0}(N=6) and the pathmapper Mask {A;B;C;D}(i). A is a placeholder for all of the first Branch structures (in this case just 0). B is a place holder for all the second branch structures possibly either 0, 1 or 2 in this case. And so forth.
(i) is a place holder for the index of N. If you think of it like a for loop the i plays the same role. For the example {A;B;C;D}(i) --> {i\3}
{0;0;0;0}(0) --> {0\3} = {0}
{0;0;0;0}(1) --> {1\3} = {0}
{0;0;0;0}(2) --> {2\3} = {0}
{0;0;0;0}(3) --> {3\3} = {1}
{0;0;0;0}(4) --> {4\3} = {1}
{0;0;0;0}(5) --> {5\3} = {1}
{0;0;0;1}(0) --> {0\3} = {0}
{0;0;0;1}(1) --> {1\3} = {0}
{0;0;0;1}(2) --> {2\3} = {0}
{0;0;0;1}(3) --> {3\3} = {1}
{0;0;0;1}(4) --> {4\3} = {1}
{0;0;0;1}(5) --> {5\3} = {1}
{0;0;0;1}(6) --> {6\3} = {2}
{0;0;0;1}(7) --> {7\3} = {2}
{0;0;0;1}(8) --> {8\3} = {2}
...
{0;2;1;1}(8) --> {8\3} = {2}
I'm not entirely sure why you want to do this particular exercise but it goes some way towards describing the process.
The reason for the tidy up: every time the data stream passes through a component that influences the path structure it adds a branch. This can get very unwieldy if you let it go to far. some times I've ended up with structures like {0;0;1;0;0;0;3;0;0;0;14}(N=1) and by remapping the structure to {A;B;C} you get {0;0;1}(N=15) and is much neater to deal with.
If you ever need to see what the structure is there is a component called Param Viewer on the first Tab Param>Special Icon is a tree. It has two modes text and visual double click to switch between the two.
Have a look at this example of three scenarios in three situations to see how the data structure changes depending on what components are doing.
…
ex: if polyline consist of points a-b-c i want 2 lines 1:a-b, 2:b-c; dont know if pathmapper would help with this since i need that some of the points in each path to become a new one.any thoughts are helpful…
0;3} (N = 2)
{0;0;0;4} (N = 2)
{0;0;1;0} (N = 2)
{0;0;1;1} (N = 2)
{0;0;1;2} (N = 2)
{0;0;1;3} (N = 2)
{0;0;1;4} (N = 2)
Flattening this structure using the Flatten component would result in:
{0} (N = 20)
However, using a Path Mapper with the following masks will flatten is somewhat more intelligently:
{A;B;C;D} -> {A;B;C}
Now, you get:
{0;0;0} (N = 10)
{0;0;1} (N = 10)
--
David Rutten
david@mcneel.com
Poprad, Slovakia…
Added by David Rutten at 3:19am on December 14, 2009
owing:
{0}0. d1. e2. f
3. g4. h5. i
{1}0. a1. b2. c
3. g4. h5. i
{2}0. a1. b2. c
3. e
4. f
5. g
Thought maybe I could use relative Item but I cant figure out how to do an offset that includes multiples.
…
{0;1;0}N=6
{0;1;1}N=6
{0;1;2}N=5
{0;2;0}N=7
{0;2;1}N=8
{0;2;2}N=9
Can you shift and wrap any of the paths A B or C?
Say if I wanted to shift and wrap B by 1 to get the following...
{0;0;0}N=7
{0;0;1}N=8
{0;0;2}N=9
{0;1;0}N=3
{0;1;1}N=2
{0;1;2}N=5
{0;2;0}N=6
{0;2;1}N=6
{0;2;2}N=5…
TREE B
{0} n=1 {0;1} n=4
{1} n=1 {0;4} n=4
{2} n=1 {1;1} n=4
{1;2} n=4
{1;3} n=4
{1;4} n=4
{2;1} n=2
{2;2} n=4
{2;3} n=4
{2;4} n=4
Both trees are generated from sliders, so could have any number of branches, although they are tied together. Tree A is a set of division points on a line, Tree B is a set of intersections from lines generated radially from the first (in this case three) points. I am trying to perform a "closest point" operation between the first tree and the second tree-- only, I do not want them to cross list, or long or short list. I want the {0} point to operate with those entries in the 2nd tree that start with {0,x}. So it would look like
{0} --> closest point with {0;1},{0;4}
{1} --> closest point with {1;1},{1,2},{1,3},{1,4} etc
I cannot figure out how this works. What I am visually trying to do is cast rays from a string of points so that they stop when they encounter another curve. I am having trouble picking through the intersection events to get what I want. Check the attached files for some clarity. THANK YOU…
Added by Joshua Jordan at 12:06am on February 5, 2012
mpletes, i will be incremented. The default increment amount is 1.
If you change the syntax to be:
For i As Int32 = 0 To 9 Step 2
then i will be incremented by 2 each time. So now the loop will run 5 times:
first iteration i = 0
second iteration i = 2
third iteration i = 4
fourth iteration i = 6
fifth iteration i = 8
sixth iteration i = 10 which is more than 9 so the 6th iteration never happens.
If you use Step 0, i isn't incremented at all, and the loop should run forever, unless you have some other abort statement or if you adjust the iteration variables inside the loop. You are doing the latter. Your iteration variable is D. The loop itself does not increment it, but you manually increment it when you call D += T.
Although this is logically solid, it is very bad practice since it makes the code very hard to read.
Since D, R and N are not external variables, I would not expose them as Input parameters.
Also, you inner loop is very weird:
For R = R1 To R Step 0
Your iteration variable here is R, but your termination limit is also R. Not to mention the step is again zero.
Trying to debug this is very difficult because it's been written in a very unorthodox fashion. I have a distinct feeling this algorithm can be written down with far fewer variables and constructs.
--
David Rutten
david@mcneel.com
Poprad, Slovakia…