Image....InputPoint.....Pick

Hello everyone, you can use this image of the “pencil”,

Img_pickPoint

used when running the “line” command, in the Api Ruby language,
while using it in the code…“InputPoint”…“Pick”… etc…

Thank you for your help…

Joseph.

You must make your own image files for cursors, buttons etc and load them into your tool…
They need to be packaged with the Ruby code files - typically you find them in an Images subfolder in that extension’s subfolder… They are then referenced as that Tool’s cursor and so on…

Look at some other authors’ [non-encrypted] code to see how they do it…

The native cursor images are in the “Images” subfolder of the installation path.
On Windows they’ll be SVG images, on Mac they’ll be PDF files.

This one is named “cursor_line”.

It’s probably not a good idea to copy a cursor image file exactly.
That might lead to some confusion in the users’ minds.
However, you could use it to make your own similar ones…

“Look at some other authors’ [non-encrypted] code to see how they do it…”

I couldn’t find anything, to figure out how to do it…
I also tried to look for directions on the Ruby Api online manual,
but at the moment I have not found specific indications…

Thank you for the answer…

Of course, it is not my intention to use the same image, but to create a personal one… at the time I was curious to know, how to make a personal image appear to the movement of the mouse, in inserting, for example a point… or other drawing actions…

Snippet of the beginning code of a tool using a cursor:

class MyTool

def initialize()
	@model = Sketchup.active_model
	@state = 0
	@cursorpath=@resourcesPath+ "/measureTool.png"
	@idcursor = UI::create_cursor @cursorpath, 10, 10 if @cursorpath
end

def activate
	Sketchup::set_status_text("Click first point")
	@ip1 = Sketchup::InputPoint.new()
end

def onSetCursor
	UI::set_cursor @idcursor if (@idcursor != 0)
end


end

Thank you very much… now I just have to study the use of this piece of code…

:disappointed_relieved: :disappointed_relieved: :disappointed_relieved:

There are literally hundreds of examples !
Download some from sketchucation.com

e.g. my own 2Dtools has lots of custom buttons and cursors, so of which switch at different stages of a tool’s use - as an additional indicator to the user…
https://sketchucation.com/pluginstore?pln=2Dtools

1 Like

Thank you very much for answering me…

:stuck_out_tongue_winking_eye: :stuck_out_tongue_winking_eye:

Again many thanks, for pointing me to the 2dTools file.rbz…
Seen many files .rb, unprotected, so I can use them as a studio,
in learning the Ruby language, especially the Ruby API for Sketchup…

Joseph.

:stuck_out_tongue_winking_eye: :stuck_out_tongue_winking_eye:
:+1: :+1: