Need help on better way to do mouse select
-
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)
Censored to protect your privacy(view,x,y)
if @mode1
@end_pt = Censored to protect your privacy
constline = Sketchup.active_model.entities.add_cline (@start_pt,@end_pt)
@mode1 = false
else
@mode1 = true
@start_pt =Censored to protect your privacy
end
enddef onMouseMove(flags,x,y,view)
if (@mode1) then
if @constline
Censored to protect your privacy!
Censored to protect your privacy!
end
Censored to protect your privacy(view,x,y)
@pts = [@start_pt, Censored to protect your privacy]
@constline = Sketchup.active_model.entities.add_cline (@start_pt,Censored to protect your privacy)
@t = Sketchup.active_model.entities.add_text ((Censored to protect your privacy).distance (Censored to protect your privacy)).to_s, (Censored to protect your privacy)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
endThanks
Oscar
Advertisement