Close gaps between curves globally, e.g. by setting a threshold value

I guess there’s not really an option to do that, but I’ve been spending doing repetitive tasks many times in Rhino until realizing there was an easy command for what I was wasting my time on.

So the question:
Is it possible to join curves that have a little gap between them (or overlap) by setting a threshold.
In my case I have many curves that have defined gaps of 0.17mm between them.
Ideally I would mark them all, and use a command like “bridge all gaps, threshold 0.2mm”
Does sth like this exist, or is there another workaround to not do it manually.

This python script should accomplish your goal.

import rhinoscriptsyntax as rs
objs = rs.GetObjects("Select curves to join", rs.filter.curve)
if objs: rs.JoinCurves(objs, delete_input=True, tolerance=0.2)

-Kevin

1 Like

Thanks for looking into it Kevin.
The command does somehow work but not close the gaps.
if I have already matching curves it joins them.

example curve.3dm (965.6 KB)

Try increasing the tollerance to 0.3 in the script

1 Like

You can adjust the script to prompt for the tolerance each time it is run.

import rhinoscriptsyntax as rs
objs = rs.GetObjects("Select curves to join", rs.filter.curve)
tol = rs.GetReal(message="Tolerance", number=None, minimum=None, maximum=None)
if objs: rs.JoinCurves(objs, delete_input=True, tolerance=tol)

As per the rs.JoinCurves() documentation: if the tolerance is omitted, 2.1 * document absolute tolerance is used.

-Kevin

1 Like

Hello Farouk & Kevin, Thanks for both your answers. It works! :grinning: