Hello, I am trying to generate a continuous path for a 3d printer using this lattice structure. I am trying to get a polyline that goes from one circle to triangles and then again to circles and then triangles till the top of the form, so that the printer can print this form continuously without a break. I am looking to use this file for generating Gcodes for 3d printing.

Given any valid Graph (like yours) An Eulerian trail or Euler walk is a walk that uses each edge exactly once. If such a walk exists (not a given), the graph is called traversable or semi-eulerian. If you substitute edges with vertices … then we have a faaaaaaar more challenging task: find a Hamiltonian path (several naive/stupid publications on that are O[N factorial] : meaning the obvious).

It’s highly unlikely that you can deal with that sort of stuff without code: any valid Graph etc etc.

BTW: There’s tons of publications around for that puzzle. See a rather simple one using (obviously) an Adjacency Matrix (i.e. what node is connected to what). For instance if your Graph is treated as a Mesh … the AdjMatrix is simply the alter ego of a classic VV Connectivity Tree.

And while porting, say, the above into some C# is a piece of cake … the general case is another animal: one should first check for islands, bridges etc etc.

My idea was to get all the lines into order and then use their points to create a continuous path. In my script, I have achieved that too, but the order of lines is not desirable when it changes from verticle lines to horizontal ones.

BTW: While I have no interest - at all - for Euler Paths in Graphs … solely out of curiosity I’ve spend some time by inspecting solutions posted here and there on Internet: as expected 95% of them are faulty/crap/slow/amateurish.

See some typical crap algo (when the outer Loop is done … bananas follow).

I am very sure I can pull this off with data trees. The only problem I am facing is with sorting the curves in a circular fashion so that the first item of each list is on top of one another, unlike in the shared picture. GCODE EXPERIMENT.gh (79.4 KB)

Indeed you can (this Graph is very simple and rational anyway).

But get a free tip: ALWAYS deal with the general aspect of matters - no matter the cost (well … that’s easy if you can code). See the WIP Euler against a similar Graph (without Trees/Cats/Dogs etc etc)

BTW: Given the opportunity: After doing a classic VV Graph (per island) Connectivity (thus you can count the odd valence connections) this is the Eulerian loop condition:

If I understand well you want one curve going from bottom doing a circle, then triangle then circle.
As I am not an expert in dataTree management (I prefer to make code) here a simple solution using group, shifting list and working just with points.

Make a group of point for each slice

Shift the list with one offset and no wrap

Take the shortest of the two list (slice and slice just above)

Ungroup and add the first point to the list

Weave to make the triangle

Regroup

Weave the slices and the triangles.

The rest is just tools that allows to look at the path

Thank you, That works in the order I wanted, The only problem is it is repeating the first edge in the triangle series in selection. In that case, the 3d printer will try to print that edge twice.

This is a nice example! I would like to change your C# input parameters since I have a similar problem.

How do you change it to a user Pts Tree, because my input is a given data tree, where each branch consists of points (Extracted from Surface > Contour > Divide Curve). Each branch has the same number of points.

I want to create a zigzag pattern inbetween these curves and get the eulerian path where it first walks the cirles (bottom to top) and then the zigzag pattern (top to bottom). Basically like in your example.