Unlock Detail Bug


#1

Greetings,
I have noticed what I believe is a bug in rs.DetailLock(). Below is a small script I wrote to check my results. I am able to take an unlocked detail and lock it. But I am unable to take a locked detail and unlock it.

import rhinoscriptsyntax as rs

detail = rs.GetObject("select a detail", rs.filter.detail)

if detail: 
    print "Detail GUID: "+str(detail)
    Locked=rs.DetailLock(detail,None)
    print "Current State: "+str(Locked)
    if Locked==False:
        print "Attempted to Lock"
        rs.DetailLock(detail,True)
    else:
        print "Attempted to Unlock"
        rs.DetailLock(detail,False)
    
    print "Final Locked State: "+str(rs.DetailLock(detail,None))

Here are the print results I found from attempting to lock then unlock the same detail:

Detail GUID: ef51f89a-5af8-499c-beab-783ea5b03d66
Current State: False
Attempted to Lock
Final Locked State: True

Detail GUID: ef51f89a-5af8-499c-beab-783ea5b03d66
Current State: True
Attempted to Unlock
Final Locked State: True

If anyone could shed some light on this issue it would be great.
Thanks,
5chmidt


(Steve Baer) #2

Thanks for finding this. I just fixed the bug so it will be available in SR8. If you need the functionality before SR8, you can get the updated python script from

https://github.com/mcneel/rhinopython/blob/master/scripts/rhinoscript/view.py