CurrentDetail() WishList/Bug?

I have been doing some work with details and I think I have found a bug. I am attempting to use the Layout string and Detail string to change the properties of a detail. Here is the code I am using to get the detail guid from the two strings:

import rhinoscriptsyntax as rs

print "Detail GUID: "+str(ID)

This works fine and prints:

Detail GUID: 5fe3178e-9134-4fa7-8cb2-195e599e689a

However, when I attempt to check/change the properties of the identified detail like so:

import rhinoscriptsyntax as rs

print "Detail GUID: "+str(ID)
print rs.DetailLock(ID)

I get the following error message:

Message: ‘module’ object has no attribute ‘errohandler’

line 188, in DetailLock, "C:\Users\BVTC\AppData\Roaming\McNeel\Rhinoceros\5.0\Plug-ins\IronPython (814d908a-e25c-493d-97e9-ee3861957f49)\settings\lib\rhinoscript\"
line 6, in , “C:\Users\BVTC\AppData\Local\Temp\

However, if I call the rs.CurrentDetail() function twice like so:

print "Detail GUID: "+str(ID)
print rs.DetailLock(ID)

Everything works fine, and it prints:

Detail GUID: 047ebe3e-2b0e-4ab2-8b2c-aab005e252e4

It would be nice if there were some way for me to do this without having to call rs.CurrentDetail() twice. If anyone knows of a more efficient way to accomplish I would be very appreciative.

I just fixed the errorhandler typo; thanks for pointing it out.

I believe what you need to do is call the CurrentDetail function twice since the function returns the id of the “previous” current detail when you are setting the current detail (which may be None if the previous current was the layout page itself.) Calling CurrentDetail and passing None gets you the id of the actual current detail.