Reorder lists, find a formula

dynamo

#1

Hi;
I am surface modeler and recently started to learn dynamo for using with alias.
I am trying to build hexagon net pattern from the scratch, i ended with 2 problems.

First problem;


I ended with 2 sets of layers and i want to combine them all under one list, but it would be of wrong numbering, so my question is how to re-order the lists correctly when i flatten the lists.

Second problem:


I want to execute a formula to translate each single row to fit to the next one. I want that formula to be applicable if i decided to change the number of rows.


#2

For your first problem you should be able to get the correct order with List.Chop and List.Transpose.
As for the second problem you’ll just have to do some math to determine the X and Y spacing for your hexagons.


#3

Nick_Boyts; Thanks for replying but i think you didn’t get my question.
i don’t want to replace the row with columns, i’d rather want to re-order the rows with keeping its positions not changed.
i guess i want a node that reverse the action of “takeeverynthitem”, but don’t know how


#4

Can you show the rest of your graph so we can see how you’re building this geometry?
The point of List.Transpose along with List.Chop is to group the sequence in order to flip the indices… if that makes any sense. Then you can flatten out your groups to return a single list of sublists in the correct order.


Don’t think of Transpose as converting rows to columns in a spatial sense. It’s more like handling a set of sublists like a matrix to regroup and reorder items.


#5

Yeah with pleasure, here is the file

hexa-pattern.dyn (88.9 KB)


#6

You could definitely benefit from some better list management. You shouldn’t have to duplicate groups of nodes for each row. You’d be much better off getting your graph to accept a single list of inputs.

Part of the problem with reordering your rows is that you don’t actually start at 0 (your first list is 7). The best solution with your current workflow is to sort the geometry by X value.


#7

Interesting, that is very professional setup.
what about the second problem, to shift every single row downside to adjacent one, i can’t figure out the needed equation.
I appreciate your help very much.