Closed polyline has an end somewhere

It did not close when I joined it.
And so, somewhere in the dozen arcs and/or two dozen lines is a bad joint… open or overlapped.
Anyone have a quicker way to find that stray end?
Autocad has polyline edit, edit vertex, with which I can walk around the joints until I end at the break or see it double back at an overlap…

CrvStart or CrvEnd will put a point at the start/end of the curve… --Mitch

Thank you very much Helvetosaur; I even tried it and shared it in the office.

The next version of Rhino will have a new command ShowEnds which will also be quite useful for this… --Mitch

1 Like

I also discovered (not because I forgot the answer you gave me, just saying)
Which will add a segment to close a polyline, but the segment may be a zigzag
and it’s still invisible unless you zoom in and scroll around…
But for Noobs like me, try it til you know it.

Well, there is an option that has been added to CloseCrv for the next version of Rhino, which seems like it should just try to close the ends without adding a segment. However, I’m not sure if or how it works…

I have a script which tries to close curves by moving both endpoints to an average point in between the two.

(edited - minor correction) (1.3 KB)

@pascal - the “Tolerance” setting in -CloseCrv (WIP) may make sense for a macro, but first, it doesn’t seem to work here - and second, there should be a setting for “I don’t care what tolerance there is, just close my curve”… And third perhaps - the settings should be sticky, at least within a session, IMO.

Cheers, --Mitch

No need for a script. Match close curves by moving control points. Select the curve near one end, then near the other end. Continuity - Position and Average curves options result in the end points being moved to an average position between the original end positions…

The script closes multiple selected curves automatically… :wink:

@Helvetosaur, all - please check howCloseCrv works in V6/WIP - do you like that better?


@pascal, did you see my post above?

Ah, sorry Mitch - V6 closes curves regardless of tolerance if CloseWideGapsWithLine=Yes and closes by moving end points below tolerance. Do you see that? So, if you want to make sure all curves that look like they are closed are actually closed, you can select all your curves and filter out the ones that have an actual gap (larger then tolerance) by setting CloseWideGapsWithLine=No and these curves will not be changed.


Ah, OK, the wording is confusing then, plus the command entry seems somewhat buggy here.

I assumed that if I set CloseWideGapsWithLine=No and the curve ends were within the tolerance I set, that it would close them. That was not happening during my first tests. Now I see that it actually does work, but the tolerance settings I was inputting were somehow not sticking, and everything always reverted to default. Now, after trying a bunch, I have finally got them to stick. However, in closing without a line, the curve end is moved to the curve start, there is no averaging being done…

So, I guess I would restructure the command like this:

Instead of “CloseWideGapsWithLine=Yes/No” I would put:

CloseWideGaps=InsertLine / MoveStartToEnd / MoveEndToStart / AvgEnds / DontClose

And, I would allow a tolerance 0 which would close any gap, no matter how big or small, come what may…

Just my 2¢…


Hi Mitch - with tolerance zero, gaps would be closed by moving ends, correct? The actual moving of the ends is as it has always been as far as I know - the extra modes you’re suggesting would be new stuff…



OK, I suppose I never tried it in V5 on curves that had open ends within file tolerance, so I always assumed it made a line to close in all cases - but in thinking about that now, I guess it would not be logical to insert a line segment less than file tolerance…

Cheers, --Mitch

Are you familiar with a way to “weld” separate curves whose open endpoints are within a certain tolerance? This would be immensely helpful for cleaning up topography contours I’m working with.

have you tried using that tolerance in the absolute tolerance file and then using the join command? just guessing.

If you’re referring to @Helvetosaur 's python script, I don’t believe this will work because what I’m trying to do is simply connect separate open curves, not close individual curves.

Nevermind, @Helvetosaur is a genius

It’s actually not all that easy to do in a script, I had a go at it a long time ago, but I think I never finished it. One way to attack this might be, after having joined what can already be joined within tolerance, to ask for the max distance for the gap, then extend all open curves by that amount both ends. Then find all the resulting intersections between the extended curves, split all the curves at the intersections, discard the ends that have been split off and then try to join everything.

The problem happens when you have more than two curve ends within the given tolerance, the results might then be wrong. Probably a bunch of other stuff could go wrong as well…

1 Like