Polyline for a 3d print

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).

But this - WIP - take on that puzzle is correct:

1 Like

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.

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.

Get PlanB as well - I could add an external user Pts Tree (if required) or some TextDots for the taken order, mind.

Graphs_EulerPath_ForPlanetUtopia.gh (261.0 KB)

How do you thing it is possible to go up ?
The solutions I see

  • Duplicate a line like now
  • Remove a line

This is just a question of odd and even.

I have a tool in Nautilus that I used to do such thing but it seems to not work well in this configuration. It was designed for near parallel curve.

And still it is a problem of even odd. I think you must made a sacrifice or duplicate a line.

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.

I’m far and away from base (summer = wave windsurfing and other things).

When I’ll back (this year I do hope) I’ll add a related option.