Prompt user to select a point

In my Ruby script, I simply want to prompt the user to select a point, and return that point to the program. Seems very simple yet I cannot find a simple answer.

What sort of prompt do you want and where? The typical way is Sketchup.set_status_text.

1 Like

Sketchup.set_status_text would work just fine, the part I am unable to do is have a point return to my ruby script via mouse click

To to receive input events, you need to make your code into a Tool and handle the user input via (e.g.) onLButtonDown. Within the event callback, you use an InputPoint to identify what the user has clicked.

1 Like

There are example Tool extensions in the Extension Warehouse, by the SketchUp Team.

You must copy, and change the topmost namespace module to your own unique module name*, and the inner module also if necessary, and then edit the code to your heart’s content.

  • Examples extension

    • see linetool.rb
  • Utilities extension

* … unless you leave and use the extension(s) as is .