Hi folks,
Sketchup 7.1.4871
Vista SP1, 32-bit
I'm experimenting with capturing mouse coordinate input via tool class event handling. I'm using the "simple_tool.rb" script as a guide. Here's my little test script...
class Clicktest
Initialize the input point upon start
def activate
@pt1 = Sketchup::InputPoint.new
end
Respond to left-clicks in the design window
def onLButtonDown flags, x, y, view
@pt1.pick view, x, y
@pos1 = @pt1.position
str = "%.2f, %.2f, %.2f" % [@pos1.x, @pos1.y, @pos1.z]
puts "pt1: " + str
end
end
Create the Command object
simple_cmd = UI::Command.new("ClickTest") {
Sketchup.active_model.select_tool Clicktest.new
}
Add the Command to the Tools menu
tool_menu = UI.menu "Tools"
tool_menu.add_separator
tool_menu.add_item simple_cmd
When I select this tool and move the cursor towards a vertex, it appears to be selecting the vertex once the cursor gets sufficiently close to it, but it's not visually indicating that it's doing so. It doesn't behave the way Sketchup does when Sketchup is used manually - e.g. Sketchup uses tooltips and coloring to cue the user that a point close-to-but-not-immediately-underneath the cursor is about to be selected if the mouse is clicked. I think maybe this is called "snapping"?
Is there a way that I can make this behavior more visually apparent to the user of the tool?
Thanks!