Simple list management question

Hi All,

I have a list of lists, each element is a list of two points.

I just need to draw lines out of this data. So far I managed to do it but is such a convoluted way (using “List.TakeEveryNthItem”) that I think there must be a better way. Probably with a simple code node…

See screen cap. The original list is on the left; I flatten it, then extract first point / second point by means of two “List.TakeEveryNthItem” nodes.

Any suggestion is welcome,

thank you
Capture

So I guess you could transpose the list, like this.

Capture

Hi Giovanni,

This has been asked before. Jostein’s solution will work wonderfully but another option is to simply drive the list of point pairs through a “Line.ByBestFitThroughPoints” node:

2015-08-28_10-30-31

Wow.

Exciting and disconcerting at the same time. There was no way I could have guessed neither one, although using Transpose makes quite a bit of sense now.

 

But the “FitThroughPoints” node… Genius! Using a list of two points, it simply returns the line through those tow points…

However, I would have never guessed that the node would have processed the list of lists the way it does… one list of two points at a time.

 

This is one of the main problems of Dynamo: there is no extensive, scientific, reference guide…

 

Thank you, awesome work,

Regards

 

gio