basically, just create 2 input points: one at the origin of the line you want to inference to, and another input point offset from that origin along the vector.
here is a really quick example:
class TestTool
def initialize
@ip = Sketchup;;InputPoint.new
end
def self.add_tool
Sketchup.active_model.tools.push_tool(TestTool.new)
end
def onKeyDown(key,repeat,flags,view)
ip1,ip2 = Sketchup;;InputPoint.new,Sketchup;;InputPoint.new
origin2d = view.screen_coords([0,0,0])
if(key == VK_UP)
z2d = view.screen_coords([0,0,100])
ip1.pick(view,origin2d[0],origin2d[1])
ip2.pick(view,z2d[0],z2d[1])
view.lock_inference(ip1,ip2)
puts "up"
elsif(key == VK_LEFT)
y2d = view.screen_coords([0,100,0])
ip1.pick(view,origin2d[0],origin2d[1])
ip2.pick(view,y2d[0],y2d[1])
view.lock_inference(ip1,ip2)
puts "left"
elsif(key == VK_RIGHT)
x2d = view.screen_coords([100,0,0])
ip1.pick(view,origin2d[0],origin2d[1])
ip2.pick(view,x2d[0],x2d[1])
view.lock_inference(ip1,ip2)
puts "right"
elsif(key == VK_DOWN)
view.lock_inference
puts "down"
end
end
def onMouseMove(flags,x,y,view)
@ip.pick(view,x,y)
view.invalidate
end
def draw(view)
@ip.draw(view)
end
end