Space between Spheres on a Pipe

Hi all,

I’m new to Grasshopper and wanted to create some Spheres on a Pipe that should be random in size and position but without touching them. The firts two steps I managed to do, but I cannot find out how to make space between them, so that they wont touch. Really appriciate any kind of help here. The file is attached to the message. (14.8 KB)

Kind regards

Marcel Laci


In order for circles or spheres to touch, their centers need to be separated by the sum of their radius. So you can’t really have both radius and position random at once.

This would require to use Divide Distance component, unfortunately it doesn’t accept a list of values as input. I coded it in C#.

@laurent_delrieu 's Nautilus plugin has a similar component, that has the edge of the first sphere start on the curve. (17.6 KB)


Nice approach using Rhino function. I choose an iterative solution, less precise but it seems a bit faster.
0.5 s for 9600 circles here.

Sorry for the wrong file. The spheres werent randomized on the pipe, so this should be now the right one. (17.0 KB)

1 Like

Do you specifically need them randomized on a pipe? Would be a lot easier if they were randomized on a curve (ie the centreline of the pipe).

Unfortunately yes, I am trying to create something like this picture.

So the spheres actually need to be tangent between themselves, but also to the pipe surface ?

The spheres could just touch or they can have a space like now, but no blending should occur. On the other hadn, they need to blend with the pipe, so that it can function as one object. In the picture above, they used a wire to hold everything together, I want to make it more comprehensive.


This uses a curve as a guide, I’ve made a spiral but you could jitter the vertices to have something less regular.
Size of the pearls in controlled through Domain + Graph Mapper for the repartition (small/big).
All spheres are tangent to their neighbours and the pipe.
What is done inside C# component is detailed in a purple group on top of the canvas, though it’s useless to the definition. (20.7 KB)


Thanks for the help, really appreciated :slight_smile: