Get Selected UserText


Is it possible to return the selected key/val pair in the ActiveDoc.


Just as it would be done using this method for Layers?:


LayerTable.GetSelected Method (



Already a feature. Please right click and select by

I think the goal is get the selected indices based on UI selection which is not possible.

@lignindes what problem are you trying to solve (short of just knowing what is selected in the ui). I may be able to offer an alternative suggestion before trying to file a feature request.

Gotcha, switching the post to the scripting forum category.

1 Like


That is correct, I’m trying to get the indices based on UI selection.

I’d like to write a script that would do the following:


  • run command, say: “DataDots”
  • select (or preselect) geometry from the main UI
  • select one or multiple key/value pairs from the user text window
  • hit enter


  • Text dots on each selected geometry populated with comma separated values from each of the selected keys.

For example, if I had PartName/Beam and PartNumber/100 as key/val pairs on a piece of geometry I would get a dot that read “Beam,100”

Does that make sense?



I can see your logic. Unfortunately the UI doesn’t expose anything publicly since its really just a wrapper around GetUserString and SetUserString

The first thought that comes to my mind would be to run your object picker code to prompt to select the objects, then popup a simple modal dialog that has the objects key/value pairs listed in it. Make them pick from that list and press OK. I think there’s probably some pit falls in terms of waiting for the user to pick from the user text panel when it might not be visible. The modal approach would definitely solve that issue and be more like a traditional Rhino command.


Thanks for the tips.

I got this working today. It’s a start.


1 Like