Help to create a custom tool

Please quote code correctly on the forum:

You can check this topic: (The end of the second post might be what you are looking for…)
https://forums.sketchup.com/t/move-an-imported-dwg-component-using-ruby/248848


Edit:
Also read (credit: @DanRathbun ):

Why it is not a tool ... ( click to expand )

This is not really a tool interface; it is a command. Meaning, the code is basically sequential and does not act like a tool.

  • It does not use any tool callbacks, does not leverage the VCB (ie, Measurements toolbar) for offset input instead implementing an inputbox.
  • It does not have any tool states and does not stay in the tool and reset after each use like a tool interface should. (i.e., a tool would go back to the select edge or cline state as the initial tool state. A tool would reset when the ESC key is clicked.)
  • It does not set a cursor so it looks weird if the user uses custom system cursor scheme. Instead of the SketchUp select cursor, the system arrow cursor is shown. (I use extra large bright orange system cursor scheme that I drew many years ago. So I know immediately when a Ruby tool does not set the cursor.) This is avoided now that the code does not set the command interface as the active tool.
  • A tool generally uses interactive mouse movements and clicks or drags, often at multiple states (stages) of the task.

. :wink:

2 Likes