construction script with meshes of different lenght

I am trying to make construction script that can make chain of drain pipes following this tutorial 1.2 - Automatic Wall | Unreal Engine Documentation

However, if i use one mesh then it become quite repetetive and won’t fit all scenarios (3x 1m long pipes won’t fit into 2.75m space and so on).
Is there a way to have system that would pick mesh based on distance from last pipe?

What i mean by it:
I have pipes meshe 0.5, 1, 2 meters long.
Let’s say i drag 3d widget about 0.75m from the start, script will add 0.5m
If i reach 1 meter from the start, the script will add (predefined) 1 meter long pipe.
If i drag it just a bit further then it adds 0.5m pipe.
If I drag 3d widget beyond 0.5 meter (so 2 meters in total), it adds another 1m long pipe instead.

If anyone can please help me with logic how to determine distances, i can add rest myself.
Thanks,
H