Hi,
I am trying to make a simple tool, which starts by drawing a line. I looked in the linetool.rb file to see how that works, but theres a lot going on in there!!!
Anyway below is my tool which just has a couple of variables to store some pick points, trouble im have is i get an "undefined method pick" in the console. Do I need to include some other file? there is nothing else ncluded in linetool.rb. Any help appreciated.
require 'sketchup.rb'
UI.menu("Tool").add_item("my tool") {
Sketchup.send_action "showRubyPanel;"
Sketchup.active_model.select_tool(My_Tool.new)
}
class My_Tool
@ip1 = Sketchup;;InputPoint.new
@ip2 = Sketchup;;InputPoint.new
@point_flag = 1
def activate
puts "Activate"
end
def deactivate(view)
puts "Deactivate"
end
def onMouseMove(flags, x, y, view)
puts "Mouse Moved"
end
def onLButtonDown(flags, x, y, view)
puts "Lbutton Down"
end
def onLButtonUp(flags, x, y, view)
if(@point_flag)
@ip1.pick view, x, y
@tool_flag = 0
else
@ip2.pick view, x, y
@tool_flag = 1
end
end
end #end of class My_Tool