A very helpful feature of Rhino is that you can use selection commands like _SelName from command line while other commands or scripts are waiting for objects to be selected. But since a few releases (6.1? - 6.21) the _SelName doesn’t work as intended.
Let’s assume that there are one or more objects named ‘a’ and one or more objects named ‘b’. ‘_SelName’ works fine outside of a command or script. What means if in selName-dialog you first click ‘a’ and then ‘b’ (without shift or ctrl pressed) only ‘b’-named objects will be selected after pressing OK.
BUT, inside of a command/script, both - ‘a’ AND ‘b’ will be selected.
And to make things even worse: If you swap the 'a’s and 'b’s a few times in the dialog the objects get selected multiple times. It seems that each time a name is selected from the list all related objects are appended to the list of objects which finally will be selected. Just run the script below:
import rhinoscriptsyntax as rs
def test():
"""Let's assume that your document has one object named 'a' and one
object named 'b'
"""
objs = rs.GetObjects('type in "selname" and swap the a and b named'+
' objects several times')
if not objs:
return
print('Number and names of selected objects:',
len(objs), [rs.ObjectName(obj) for obj in objs])
if __name__ == '__main__':
test()
There are some older related topics:
- List item _SelName from rs.GetObjects not returning expected results
- List item rs.GetObjects and then SelName does not work properly
but both address ‘only’ the rs.GetObjects function. The current bug affects pure rhino command line commands as well. So i assume that the SelName-dialog misbehaves.