Rhino 8 - rs.CloseCurve( obj ) does not close curve

Copy-Paste from the examples :

import rhinoscriptsyntax as rs
obj = rs.GetObject("Select curve", rs.filter.curve)
if not rs.IsCurveClosed(obj) and rs.IsCurveClosable(obj):
    my_crv = rs.CloseCurve( obj )
    rs.AddCurve(my_crv)

Hi Bogdan, both of those functions take a tolerance. If the curve is closeable at the tolerance and you give the same or greater tolerance for CloseCurve, the curve should be closed. Note CLoseCurve is not like the Rhino command - it will not att a line segment to close the curve, only move the end points.

-Pascal

It’s failing on rs.IsCurveClosable() because the tolerance argument is missing in the sample. That means that the curve ends need to be within the file tolerance to be considered ‘closable’. If you give it a bigger tolerance - larger than your gap - it should work.

In addition rs.CloseCurve() needs the same tolerance as an argument.

It looks like neither of the sample code snippets provided are correct - probably never modified since the VB Rhinoscript days when these additional arguments may have been absent.

Ok, thank you, so I guess sample code needs a small update.

Otherwise is quite confusing since I tested without tolerance on a simple square (without one edge) 1000x1000 on the WorldOrigin and it didn’t work. Maybe tolerance should not be Optional…