# Path Mapping/Trim Mapping

Hi everyone,
I wish to create a SDL Line similar to the picture from GH.

I therefore want to combine for example
the point in from [44,0,0] with the vector [44,0,0] and the length from [44],
the point in from [44,1,0] with the vector [44,1,0] and the length from [44].
the point in from [44,2,0] with the vector [44,2,0] and the length from [44]…

the point in from [45,0,0] with the vector [45,0,0] and the length from [45]
the point in from [45,1,0] with the vector [45,1,0] and the length from [45]

basically every point should be connected with one vector and the length from its category.

Does anyone know how to do that?

Thank you very much.

If I were you I would try and erase your mind of the way GH structures data and learn from the ground-up using the Dynamo primer and DesignScript documents, as Dynamo adopts universal list management protocols, i.e. indexing etc, which every other object-orientated programming language also uses. GH on the other-hand adopts a proprietary data management system which at best, vaguely translates to this standard and in doing so, has inadvertently corrupted the minds of all of its users! It appears that you are attempting to match what you see in GH with what you are doing in Dynamo and thats leading to unnecessary list depth.

In your start and dir list outputs, you could structure your data better by outputting 2D lists instead of 3D lists, not unless there’s a reason why you would want to store a single object in its own list (in most cases there wont be). In doing so, straightaway your problem becomes far easier to solve. A quick way of performing rank reduction (2D lists) is as so:

If you were to do this, then combining the sets of indexes you need would be as simple as:

I am not sure i can agree with the statement that “grasshopper…has inadvertently corrupted the minds of all of its users”. I have learned Grasshopper and its Data Tree logic long before I have written textual code or learned how to use Dynamo. Data Tree logic is very clear and very simple, and as a matter of fact quite similar to what you would encounter with nested lists in Dynamo. Here’s a good reference that explains why David has chosen Data Trees over Dictionaries or Lists. It’s a great read:

I do agree with the rest of your statement. @norbert.schlotter Simplify, first and foremost. Then please pick up a Dynamo reference book and learn some basics. Thanks!

1 Like

…and it took a genius to explain it

At least the conclusion was honest:

Although data trees can be difficult to work with and probably cause more confusion than any other part of Grasshopper, they seem to work well in the majority of cases and we haven’t been able to come up with a better solution.

My problem is a little more complex. The list.Combine won’t solve it i guess.

The goal is to create a Line.ByStartPointDirectionLength therefore I have three lists (as shown in the original post):

The Point list:
0 list
0 Point
1 Point
2 Point
3 Point
1 list
0 Point
2 list
0 Point
1 Point

A Direction list:
0 list
0 Direction
1 Direction
2 Direction
3 Direction
1 list
0 Direction
2 list
0 Direction
1 Direction

And a Length list:
0 Length
1 Length
2 Length

I now want to create only one line each:
0 list
0 Point, 0 Direction, 0 Length
1 Point, 1 Direction, 0 Length
2 Point, 2 Direction, 0 Length
3 Point, 3 Direction, 0 Length
1 list
0 Point, 0 Direction, 1 Length
2 list
0 Point, 0 Direction, 2 Length
1 Point, 1 Direction, 2 Length

I hope that helps.

The Line.ByStartPointDirectionLength node will automaticly handle the different length lists for you. If that does not work, you need to play with list levels or replication guides.

2 Likes

Thank you very much Einar,

It must be an issue with the list levels then. This should be solvable…