rs.IsObjectSelectable vs rh_obj.IsSelectable()

Hi @Pascal,

i think the rs.IsObjectSelectable() method is slightly wrong. Please create a new file, add one curve and select it, then run this example:

import Rhino
import scriptcontext
import rhinoscriptsyntax as rs

def DoSomething():
    
    crv_ids = rs.ObjectsByType(rs.filter.curve, False)
    if not crv_ids: return
    
    for crv_id in crv_ids:
        print "rs.IsObjectSelectable = ", rs.IsObjectSelectable(crv_id)
        
    objs = [rs.coercerhinoobject(crv_id, True, True) for crv_id in crv_ids]
    for obj in objs:
        print "rh_obj.IsSelectable = ", obj.IsSelectable()

DoSomething()

…or RhinoCommon takes it too seriously :wink:

_
c.

Checking it - thanks.
@clement - the version of the function that rhinoscriptsyntax uses has four bools set to

True,False, False, False

Set that way it works in your example. It looks like it is the first one, the one for ignoring selection state, that makes a difference - I guess that means, if False, if the object is selected then it is not selectable - a useful thing in some cases.

-Pascal

Thanks @pascal, my remark was more about rs.IsObjectSelectable() which has no overloads to respect that “ignoring selection state” option. I’ll just stick to the RhinoCommon method.
_
c.

Yeah… until right now, when I looked at it, I took the RhinoScript and rs functions to mean more generally, ‘can this object be selected if it needs to be selected’ and not ‘can this object be selected at this instant’.
I don’t know but my guess is this was a deliberate ‘generalization’ on the part of rhinoscriptsyntax.

-Pascal