Infill for concave outlines?

I’m struggling to produce infill for a concave area that is reliable for different shapes, minimizes tool travel distance, and minimizes discontinuities.

I’ve got a contour-based approach sort of working, but it is very suboptimal and resulting in 20+ infill segments where I can see that a simple solution would have 3 segments. And a more sophisticated approach could be done with one single segment.

The requirements are:

  • Rectinlinear infill; the cross-hatching is important for durability (I also do a spiral-style infill at the top layer for aesthetics, but that part works)
  • Constant distance between lines
  • Clipped at the shape perimeter
  • Minimize travel that is not extruding (i.e. minimize “orphan” lines and segments)

Here’s what I’ve got:

And it does an… OK job:

…but you can see where it could connect segments, and for the life of me I can’t find a decent algorithm.

Any ideas?
infill-problem.gh (26.0 KB)

(that last branch component is just to make it easier to see and work on one layer at a time, not part of the actual infill generation)

Your code, unfiltered:


infill-2025Jul22a.gh (32.3 KB)

later: filtered by color / branch. Each branch is assigned a unique color.

1 Like

Each branch is assigned a unique color.

Well that’s a technique I wish I had picked up years go. :person_facepalming:

Here is Kimi K2 to the rescue:


infill-2025Jul22a_re.gh (46.2 KB)

1 Like

Wow, that is completely insane. Thank you @Cumberland … can you elaborate on your Kimi K2 workflow to get this?

Here is the conversation that I had it with Kimi k2:

It struggled to clean the long vertical connection line, but other than that his solution it is quite good.