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

    Is it ok to add tolerance for snap points?

    Scheduled Pinned Locked Moved Plugins
    1 Posts 1 Posters 20 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.
    • designerbursaD Offline
      designerbursa
      last edited by designerbursa

      Re: [Plugin] BezierSpline - v2.2a - 22 Apr 21
      I made a change like this if you don't mind

      def pick_point_to_move(x, y, view) 
          tolerance = 1000 # Tolerans değeri, piksel cinsinden
          @old_pt_to_move = @pt_to_move
          ph = view.pick_helper
          @selection = ph.pick_segment @pts, x, y
      
          if @selection
              if @selection < 0
                  # Segment üzerinde bir nokta bulduysak
                  pickray = view.pickray x, y
                  i = -@selection
                  segment = [@pts[i-1], @pts[i]]
                  result = Geom.closest_points(segment, pickray)
      
                  # Yakınlık kontrolü
                  if result[0].distance(@pts[i-1]) <= tolerance || result[0].distance(@pts[i]) <= tolerance
                      @pt_to_move = result[0]
                  else
                      @pt_to_move = nil
                  end
              else
                  # Kontrol noktasını bulduysak
                  @pt_to_move = @pts[@selection]
              end
          else
              @pt_to_move = nil
          end
          @old_pt_to_move != @pt_to_move
      end
      
      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