sketchucation logo sketchucation
    • Login
    ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info

    Need help on better way to do mouse select

    Scheduled Pinned Locked Moved Developers' Forum
    1 Posts 1 Posters 2.9k Views 1 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • OscarLokO Offline
      OscarLok
      last edited by

      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
      end

      def 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
      end

      Thanks
      Oscar

      [b:dhgwcjdo][color=#0080BF:dhgwcjdo]JAYA Design & Renovation Sdn. Bhd.[/color:dhgwcjdo][/b:dhgwcjdo] [b:dhgwcjdo][color=#00BF40:dhgwcjdo]T[/color:dhgwcjdo][color=#00BC42:dhgwcjdo]h[/color:dhgwcjdo][color=#00B843:dhgwcjdo]e[/color:dhgwcjdo] [color=#00B247:dhgwcjdo]e[/color:dhgwcjdo][color=#00AE48:dhgwcjdo]x[/color:dhgwcjdo][color=#00AB4A:dhgwcjdo]p[/color:dhgwcjdo][color=#00A84C:dhgwcjdo]e[/color:dhgwcjdo][color=#00A44D:dhgwcjdo]r[/color:dhgwcjdo][color=#00A14F:dhgwcjdo]t[/color:dhgwcjdo] [color=#009A53:dhgwcjdo]i[/color:dhgwcjdo][color=#009754:dhgwcjdo]n[/color:dhgwcjdo] [color=#009058:dhgwcjdo]c[/color:dhgwcjdo][color=#008D59:dhgwcjdo]u[/color:dhgwcjdo][color=#008A5B:dhgwcjdo]s[/color:dhgwcjdo][color=#00865D:dhgwcjdo]t[/color:dhgwcjdo][color=#00835E:dhgwcjdo]o[/color:dhgwcjdo][color=#008060:dhgwcjdo]m[/color:dhgwcjdo][color=#007C62:dhgwcjdo]i[/color:dhgwcjdo][color=#007963:dhgwcjdo]z[/color:dhgwcjdo][color=#007565:dhgwcjdo]e[/color:dhgwcjdo][color=#007267:dhgwcjdo]d[/color:dhgwcjdo] [color=#006B6A:dhgwcjdo]o[/color:dhgwcjdo][color=#00686C:dhgwcjdo]f[/color:dhgwcjdo][color=#00656D:dhgwcjdo]f[/color:dhgwcjdo][color=#00616F:dhgwcjdo]i[/color:dhgwcjdo][color=#005E71:dhgwcjdo]c[/color:dhgwcjdo][color=#005B73:dhgwcjdo]e[/color:dhgwcjdo] [color=#005476:dhgwcjdo]s[/color:dhgwcjdo][color=#005178:dhgwcjdo]y[/color:dhgwcjdo][color=#004D79:dhgwcjdo]s[/color:dhgwcjdo][color=#004A7B:dhgwcjdo]t[/color:dhgwcjdo][color=#00477D:dhgwcjdo]e[/color:dhgwcjdo][color=#00437E:dhgwcjdo]m[/color:dhgwcjdo][color=#004080:dhgwcjdo].[/color:dhgwcjdo][/b:dhgwcjdo]

      1 Reply Last reply Reply Quote 0
      • 1 / 1
      • First post
        Last post
      Buy SketchPlus
      Buy SUbD
      Buy WrapR
      Buy eBook
      Buy Modelur
      Buy Vertex Tools
      Buy SketchCuisine
      Buy FormFonts

      Advertisement