For example.
If you have two lists of points.
List A List B
{0;0;0}(0) {0;0}(0)
{0;0;1}(0) {0;1}(0)
{0;2}(0)
{0;3}(0)
{0;4}(0)
And you want to merge the two lists so that the two points in list A are the end points.
Merge Lists Results:
{0;0}(0)
{0;0;0}(0)
{0;0;1}(0)
{0;1}(0)
{0;2}(0)
{0;3}(0)
{0;4}(0)
Because of their path structures the order is wrong from a simple merge so Flattening now is out of the question.
Path Mapper
{A;B} --> {A;B+1}
{A;B;C} --> {A;C*6}
---------------------
Results:
{0;0} --> {0;0+1} = {0;1}
{0;1} --> {0;1+1} = {0;2}
{0;2} --> {0;2+1} = {0;3}
{0;3} --> {0;3+1} = {0;4}
{0;4} --> {0;4+1} = {0;5}
{0;0;0} --> {0;0*6} = {0;0}
{0;0;1} --> {0;1*6} = {0;6}
Now with the Path Structures similar when they are re-ordered the results will have the two points of list A as the end points.
Question 2
why did the curve-line intersection lose the path structure? Both trees had 38 branches.
Both trees had 38 Paths but Tree A had more Items, 147 compared to 38 in Tree B.
So you get this happening:
{0;0;0;0;0;0}(0) compared to {0;0;0;0}(0) results: Null {0;0;0;0;0;0}(0)
Base result paths on longest
{0;0;1;0;0;0}(0) compared to {0;0;0;1}(0) results: Null {0;0;1;0;0;0}(0)
{0;0;2;0;0;0}(0) compared to {0;0;0;2}(0) results: Yes {0;0;2;0;0;0;0}(0)
Add a branch to contain result
{0;0;3;0;0;0}(0) compared to {0;0;0;3}(0) results: Yes {0;0;3;0;0;0;0}(0)
{0;0;3;0;0;0}(1) compared to {0;0;0;3}(0) results: No {0;0;3;0;0;0;1}(0)
{0;0;4;0;0;0}(0) compared to {0;0;0;4}(0) results: Yes {0;0;4;0;0;0;0}(0)
{0;0;4;0;0;0}(1) compared to {0;0;0;4}(0) results: Yes {0;0;4;0;0;0;1}(0)
{0;0;5;0;0;0}(0) compared to {0;0;0;5}(0) results: Yes {0;0;5;0;0;0;0}(0)
{0;0;5;0;0;0}(1) compared to {0;0;0;5}(0) results: Yes {0;0;5;0;0;0;1}(0)
{0;0;5;0;0;0}(2) compared to {0;0;0;5}(0) results: Yes {0;0;5;0;0;0;2}(0)
...... etc
…
actually in position 3)
Weave is useful when you have two lists with several objects in each, and you want to combine them into one list, in a particular order (that order being the "Pattern")
So if you have a list with letters: A, B, C, D, E, F... into input 1
And a list of numbers: 1, 2, 3, 4, 5... into input 2
With the pattern: 1, 1, 2
The output of the weave would be A, B, 1, C, D, 2, E, F, 3...
Until it runs out of list.
Hope that helped!
john…
and says "repeat every Nth element", meaning say if N was 3, I would get A B C C D E F F G H. I would also like to be able to then insert a list of 3 elements in between each of the repeats. For example, I wanted to insert: 1. 1
2. 2
3. 3 into the list, I would get A B C 1 2 3 C D E F 1 2 3 F G H. It seems like an easy task, but I cannot for the life of me figure out how to do it, I must be making a very basic mistake. I am new to grasshopper, so any and all help I could get would be GREATLY appreciated!…
is created for each point (25 paths, N=1 for each) which is feed into [Pull Point] for the pull geometry [G].
Correspondingly for the 4 source points a branch is created for each point and duplicated 25 times (4 paths, N=25 for each). This tree then needs to be inverted with [Path Mapper] so the structure will correspond to the format of the pull geometry. The mapping {A;B;C}(i) > {i}(B) produces (25 paths, N=4 for each) the structure to feed into the search point [P].
The [Pull Point] boolean toggle [C] needs to get set to False to obtain all the distances between all search and pull points (4 x 25 = 100 values).
Simultaneously there is also an index being created to correspond to the list of the 4 source points. This index is the integers 0 to 3 which are branched and inverted similar to the source points (25 paths, N=4 for each).
The distance output [D] from [Pull Point] is then sorted synchronously with the source point index for each branch. From the following screengrab branch {0;0} corresponds to a point in the 5 x 5 grid and the shortest distance between that point and a referenced source point index is 5.261. The index of the referenced source point is 3.
For each following sorted branch the first sorted index value will correspond to the closest source point (first [List Item] shown). This index value is then used to select from the original list of duplicated and inverted points and this is done for each of the 25 branches (second List Item shown).
Draw a line or whatever an away we go!…
a number between 0 and 1.
5. Generate random number for each of the points.
So each point have 2 numbers - distance D (remapped to 0 to 1), and random R (0-1).
X = D-R
If X is smaller than 0 then delete the point with cull pattern.
Should work.…
ruct Brep (V) --> Create Set
(L) Create Set: Flatten = True
Deconstruct Brep (V) --> (D) Find Similar Member
Create Set (L) --> (S) Find Similar Member
Deconstruct Brep (V) --> (P) Point to Numbers
(P) Point to Numbers: Graft = True
Find Similar Member (i) --> (D1) Merge
Find Similar Member (i): Simplify = True
# The (i) output is the N in the macro
(D1) Merge: Graft = True
Point to Numbers (N) --> (D2) Merge
Point to Numbers (N): Simpify =True
# The (N) outputs are the x,y,z components of the macro
Create Panel[1], Panel[2], Panel[3]
Panel[1] = ,
Panel[2] = E,
Panel[3] = N,
# start to combine all the parts together
Panel[1] --> (J) Text Join[1]
Find Similar Member (i) --> (T) Text Join[1]
Merge --> (T) Text Join[2]
Panel[1] --> (J) Text Join[2]
Panel[2] --> (A) Concatenate[1]
Text Join[1] --> (B) Concatenate[1]
Panel[3] --> (A) Concatenate[2]
Text Join[2] --> (B) Concatenate[2]
Concatenate[2] --> (D) Shift Paths
Shift Paths --> Tree Statistics
Tree Statistics (C) --> (C) Series
Series --> Int
Create Panel[4], Panel[5]
Panel[4] = "! Panel #"
Panel[5] = 0
Panel[5] = 1
# make sure Panel[5] is set to not multi-line
Panel[4] --> (A) Concatenate[3]
Int --> (B) Concatenate[3]
(B) Concatenate[3]: Graft = True
Concatenate[3] (R): Simplify = True
Shift Paths --> (L) List Insert
# make sure the next hooks are in order
Concatenate[2] --> (I) List Insert
Concatenate[3] --> (I) List Insert
Panel[5] --> (i) List Insert
List Insert (L): Flatten =True
List Insert --> Panel[6]
Panel[6]: Stream Contents =True…
l points" - off by one! Adding the expression "x-1" to the 'Divide|N' input fixes the 'CP' lists from the resulting curves so they are identical when 'ReB|D' = 1.
'ReB' has no default for 'D (Degree)' and when omitted, the resulting curve is segmented (D=1), not the same as the input curve from 'Field Line'. And no matter what value I use for 'D' (2, 3, 4, 5), the 'ReB' and 'Nurbs' curves never match - and the control points don't match either when 'ReB|D' != 1.
This seems odd to me? Inside baseball, I guess, but still... David?…
Added by Joseph Oster at 1:14pm on October 20, 2015