Rhinoscript Bug - Rhino.SetUserText doesn't do what the documentation says

The documentation of SetUserText says that if the optional strValue parameter is omitted, the UserText’s key & value is deleted. That means that a call like this should delete it:

Call Rhino.SetUserText strID, “MyKey”

So far so good. But if I include the optional strValue it should not delete it. Therefore neither of the following calls should delete it because the optional parameter is not omitted:

Call Rhino.SetUserText strID, “MyKey”, “Some Text”
Call Rhino.SetUserText strID, “MyKey”, “”

The second call above DOES delete the key/value contrary to the documentation.

The reason this is a problem is because having a blank in a usertext is legal. I can use Rhino’s property tab to set a Usertext to blank, and it lives on that way. I cannot set it to blank ("") from RhinoScript though, and I need to be able to do that. So how do I set UserText to blank from Rhinoscript without deleting the key?

Hello - you cannot set a blank key, as far as I know.


Yes, you can! In the Rhino interface, select an object, open the property tab, change a usertext key to blank. No errors. Here’s what it looks like after hitting enter with blank in the field:

You also missed the point about the documentation being wrong. I have not omitted the parameter, which is the only thing that should cause the key to be deleted.