CurrentDetail() WishList/Bug?


#1

Greetings,
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

ID=rs.CurrentDetail("DRAWING","Top",False)
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

ID=rs.CurrentDetail("DRAWING","Top",False)
print "Detail GUID: "+str(ID)
print rs.DetailLock(ID)

I get the following error message:

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

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

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

rs.CurrentDetail("DRAWING","Top",False)
ID=rs.CurrentDetail("DRAWING",None,False)
print "Detail GUID: "+str(ID)
print rs.DetailLock(ID)

Everything works fine, and it prints:

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

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.
Thanks,
5chmidt


(Steve Baer) #2

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.