This is an entire working script, from start to finish. Save it as a .rb file and its ready to go. It installs itself as "Plugins>Mouse Tools". There are no comments in the code whatsoever. I took them all out because the ones that were there were not terribly helpful, mostly just made it hard to read the code straight through. I believe that this code is more complex than absolutely necessary because it adds a few checks to make sure it does not call the draw method unnecessarily. Hopefully this helps. I'm still confused what portions of this code are doing....
require 'sketchup.rb'
class Clf_mousetools
def activate
@ip = Sketchup;;InputPoint.new
@iptemp = Sketchup;;InputPoint.new
@displayed = false
end
def onMouseMove(flags, x, y, view)
pos = @ip.position
Sketchup;;set_status_text("#{pos.x}, #{pos.y}, #{pos.z}")
@iptemp.pick view, x, y
if( @iptemp.valid? )
changed = @iptemp != @ip
@ip.copy! @iptemp
pos = @ip.position;
if( changed and (@ip.display? or @displayed) )
view.invalidate
end
end
end
def draw(view)
if( @ip.valid? && @ip.display? )
@ip.draw view
@displayed = true
else
@displayed = false
end
end
end
if !file_loaded?(__FILE__) then
UI.menu("Plugins").add_item("Mouse Tools") { Sketchup.active_model.select_tool Clf_mousetools.new }
end
file_loaded(__FILE__)
Chris