Get Selected UserText

@Trav

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

image

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

image

LayerTable.GetSelected Method (rhino3d.com)

Thanks,

Dan

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

Hello,

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:

Inputs:

  • 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

Outputs:

  • 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?

Thanks,

Dan

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.

@trav,

Thanks for the tips.

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

Dan

1 Like