Issue with CreateFilletCornersCurve not returning None on error

Hi, just trying to use the following command:
“Rhino.Geometry.Curve.CreateFilletCornersCurve”

The issue I’ve run into is when a curve is passed into it that can’t be filleted (i.e. a rectangle that already has the required fillets) it stops the running of the script instead of returning None as described in the documentation. Should I be doing a check on the input curve beforehand to see if it can have fillets added? If so what check should I be running?

My code:

Output in the terminal after running on a rectangle with 10mm radius corners:

Thanks in advance.

I’m not sure what the best exception(s) to catch is (or are), but how about putting the calls to CreateFilletCornersCurve in a try: except: block?

You should check on line 18 if filleted_curve is None, and only add it to the document if it is not. To be clear: it does return None as described in the documentation.

As you can see in the output, adding an object to the document that is None will give an exception and that will stop running your script.

Oh yeah. The existing None check is just a few lines too late to catch the issue.

Thanks, I thought I had tried that but obviously not.

1 Like