Hi,
I have write the below ruby, but I think there are better way to do
this.
Could anybody tell me how to make it like we select the dimension
tool, please?
It is like we move the mouse near the end or mid point of an edge, it
will have an indicator appear.
def onLButtonDown(flags, x, y, view)
@ip.pick(view,x,y)
if @mode1
@end_pt = @ip.position
constline = Sketchup.active_model.entities.add_cline
(@start_pt,@end_pt)
@mode1 = false
else
@mode1 = true
@start_pt =...@ip.position
end
end
def onMouseMove(flags,x,y,view)
if (@mode1) then
if @constline
@constline.erase!
@t.erase!
end
@ip.pick(view,x,y)
@pts = [@start_pt, @ip.position]
@constline = Sketchup.active_model.entities.add_cline
(@start_pt,@ip.position)
@t = Sketchup.active_model.entities.add_text
((@constline.start).distance (@constline.end)).to_s, (@constline.end)
# I don't know how to use "view", the below cannot work.
# view.line_width = 10
# view.set_color_from_line(@pts[0], @pts[1])
# view.drawing_color = "gray"
# view.draw(GL_LINES, @pts)
# view.draw_lines($start_pt, $ip.position)
end
end
Thanks
Oscar