Wish: Paste text to TextDot by just selecting and Ctrl+V

Thanks in advance, this will be very handy thing.

To be more precise Ctrl+V to replace the Display Text of the Dot.

I thought you were the one encouraging others not to ask for features that can be easily scripted :stuck_out_tongue_winking_eye:

How can you script this?
I’ll delete my request if that’s possible easily!

I do not want to create a custom text dot object, it must have in the class an event that waits for Ctrl+V and check if the data inside the clipboard is a text string.

Ah, thought you wanted to copy a text object in Rhino and convert that to a dot.
not behind a windows machine right now, but maybe this works?

1 Like

the feature request stays :slight_smile:

There are numerous ways to get the clipboard data and input keys.
Getting into these does not qualify with the:

hmm, not sure then if I understand you correctly. You want to select a text dot and then hit a key and it replaces the text in the dot with the text from the clipboard?

Spot on!

No scripts, no commands. This is RhinoApp behavior.

import Eto
import Rhino
import scriptcontext

def setDotText():
    text = Eto.Forms.Clipboard().GetString(None)
    if( not text ):
        return
    objects = scriptcontext.doc.Objects.GetSelectedObjects(False, False)
    for obj in objects:
        if isinstance(obj, Rhino.DocObjects.TextDotObject):
            obj.Geometry.Text = text
            obj.CommitChanges()
    scriptcontext.doc.Views.Redraw()

setDotText()

I think there are going to be too many corner cases to be able to hook this directly up to ctrl+v

5 Likes

interesting using Eto, I thought I have to pinvoke Win32.dll

You mean, like wanting to copy/paste the actual TextDot Object?

You know, as a workaround could be when clicking the TextDot, the properties window to become on focus and the DisplayText to be active and selected, This will allow direct Ctrl+V on there.

Currently there’s slight difference in behavior. If you click in the Name field of an object, the text gets automatically selected, but clicking on the DisplayText field on Dot’s properties puts the cursor behind the text. So name can be quickly copied, but a text cannot be changed in a Dot’s DisplayText, it has to be selected first.

1 Like