Minor bug - rs.IsCurveClosed don't work with dimension

Hello, just to report that rs.IsCurveClosed will bug and stop script execution when testing a dimension, here is a simple script for testing :

import rhinoscriptsyntax as rs

id = rs.GetObject()
if rs.IsCurveClosed(id):
print “True”

and a Rhino file : Curve closed dimension.3dm (29.2 KB)

if you run the script and select the dimension you will get this error message :

if it can help anybody a simple workaround for my case was to test first with rs.IsCurve which work fine for filtering dimension object, I’m pretty sure it can also be handeled with a a “try:” method.

Well, in general, it’s a good idea to make sure that what you’re passing to a particular method is the correct type of geometry and variable.

The vb Rhinoscript method does not error out, it just returns Null, python rhinoscriptsyntax is currently a bit more “sensitive”, there is not 100% idiot-proofing (yet). OTOH, if you try to pass an an incorrect variable type (such as a list instead of a string), both vb and python rhinoscriptsyntax will error out.

–Mitch

True that Mitch, unfortunately since I can’t be always with the users in my company I have to make every script the more “idiot proof” possible.

that part of my bigger script actually take all the objects on a layer and compute the area of only the closed curve, rs.IsCurveClosed is supposed to filter out the non closed curve object. fortunately we can check before with rs.IsCurve, so it was just a head’s up for anyone who was going to use rs.IsCurveClosed() if he can find this post helpfull.

I’ve reported this as a bug.

http://mcneel.myjetbrains.com/youtrack/issue/RH-29840