Line fill pattern with restrictions

Hello,

I am attempting to have lines fill a grid of points similar to a circuit board:


Each line must:

  1. Not intersect.
  2. Be between 1-5 segments long.
  3. Cannot traverse more than once vertically or horizontally.
  4. Cannot traverse more than twice diagonally.
  5. Cannot traverse at less than a 90 degree angle.

So far my attempts have involved creating connections connections between points and culling, but after hitting several issues I think this is the wrong approach. Would this be better solved using recursion?

Any hints to push me in the right direction would be hugely appreciated.

Thanks!

@laurent_delrieu of Nautilus plugin shared some examples in the past very similar to your request. > Can the circuit board effect be created using Grasshopper? - Grasshopper - McNeel Forum

Hello,
@Chris37 link doesn’t seem what you need.
The first thing is to get the lines, you could get them using a planar mesh that is triangulated


If it is too ordered you could flip diagonals

or completely random


random trinagulation.gh (13.6 KB)

Then topology with sandbox or others tools (I remade one in Nautilus)

Then I think it is more easy to do the rest by code
Make an array that tells you if point is taken.

choose a random point, go to the next following you rules, at each point set the point has taken
continue until you have no others points available

That’s the result, will surely be a little Nautilus component !




5 Likes

This is completely amazing! Not only did it solve my problem, but it opened up my mind to a ton of other possibilities. Thanks!

I put a little tool in Nautilus 1.9, it doesn’t have some of special rules, diagonally and vertically or horizontally because it will means working in a plane with lines always at 0°,+/-45° and 90°



1 Like