Just sayin' : UI.set_clipboard_data(String); UI.get_clipboard_data :-)

In case someone hadn’t seen it - which there’s a good chance - I thought I’d just sayin’:

Neither in SketchUp Release Notes, nor in SketchUp API Release Notes announced, but there are new Class methods in UI module to handle the clipboard text (only String ) , since SketchUp 2023.1.

UI.set_clipboard_data-class_method
UI.get_clipboard_data-class_method

def clipboard_test
  json = Sketchup.active_model.rendering_options.to_h.to_json
  UI.set_clipboard_data(json)
  text = UI.get_clipboard_data
end

Thanks a lot for this! :+1: :beers:

@tt_su, @ChrisFullmer Would be nice to update the above mentioned Release Notes as well as the Ruby API doc in UI.set_clipboard_data and put the required Parameter description…
(I need to figure out my password on GitHub :blush: to be able to post there… someone else may can do it.)

2 Likes

I privately reported this already, but no action yet on it.

Beware, that if you test from the native Ruby Console the methods seem to act weirdly because (it seems) that the Console input field is using the clipboard. But if used within a Ruby method (as shown above,) they work as we would expect.

1 Like