Dear friends,
When we use the line tool in SU and try to draw a line, it simply finds axes directions but in the following code, it is hard to find axes directions. Can you help me with it?
module MyModule
module MyTest
class MyTest
def activate
@st = 0 #Stack
@input = Sketchup::InputPoint.new
@mp = @input.position #Mouse Pointer
@pt = @input.position #Point
end
def onLButtonDown(flags, x, y, view)
@st = (@st - 1).abs
@pt = @mp
end
def onMouseMove(flags, x, y, view)
@input.pick view, x, y
@mp = @input.position
view.invalidate
end
def draw view
if @st == 1
view.set_color_from_line @pt, @mp
view.line_width = 3
view.draw_polyline @pt, @mp
end
end
end
unless file_loaded?(__FILE__)
UI.menu("Plugins").add_item("MyTest") {
Sketchup.active_model.select_tool(MyTest.new)
}
file_loaded(__FILE__)
end
end
end