Results 1 to 4 of 4

Thread: move blocks to the nearest snap spacing

  1. #1
    Member
    Join Date
    2018-02
    Posts
    3
    Login to Give a bone
    0

    Default move blocks to the nearest snap spacing

    Hello,

    I sometimes get schematics with the blocks a little off the gridspacing.

    if the groud is 1,1 I can use the following lisp

    Code:
    (defun c:FixInsBlk (/ i ss ed p)
      (initget "Yes No")
      (setq All (getkword "Select all blocks? [Yes/No] <N>"))
      (cond
        ((eq All "Yes")
         (setq i  0
    	   ss (ssget "_X" (list (cons 0 "INSERT")))
         )
        )
        (T
         (setq i  0
    	   ss (ssget (list (cons 0 "INSERT")))
         )
        )
      )
      (repeat (SSLength ss)
        (setq ed (entget (ssname ss i)))
        (setq p (cdr (assoc 10 ed)))
        (setq p (list (fix (+ (car p) 0.5))
    		  (fix (+ (cadr p) 0.5))
    		  (fix (+ (caddr p) 0.5))
    	    )
        )
        (setq ed (subst (cons 10 p) (assoc 10	ed) ed))
        (entmod ed)
        (setq i (1+ i))
      )
      (princ)
    )
    (defun C:FIB ()
      (c:FixInsBlk)
    )
    (princ
      "\n\t\t***\tFixInsBlk.lsp loaded. Type FIXINSBLK or FIB to execute.\t***"
    )
    (princ)
    Now I have a set a drawings with the snap spacing 1.25 and I can't see where I need to change the lisp so it will move the blocks to the nearest snap.

  2. #2
    All AUGI, all the time
    Join Date
    2010-06
    Posts
    962
    Login to Give a bone
    0

    Default Re: move blocks to the nearest snap spacing

    Hi,

    Change the decimal number in the routine from 0.5 to 0.625

  3. #3
    Member
    Join Date
    2018-02
    Posts
    3
    Login to Give a bone
    0

    Default Re: move blocks to the nearest snap spacing

    Hi Tharwat,

    Thank you very much!

  4. #4
    All AUGI, all the time
    Join Date
    2010-06
    Posts
    962
    Login to Give a bone
    0

    Default Re: move blocks to the nearest snap spacing

    Quote Originally Posted by dt180212 View Post
    Hi Tharwat,

    Thank you very much!
    You're welcome anytime.

Similar Threads

  1. 2017: Snap spacing automatically changes
    By rolibolibo in forum AutoCAD General
    Replies: 1
    Last Post: 2017-10-02, 01:30 PM
  2. Make running osnaps always snap to the nearest matching snap point
    By Wish List System in forum AutoCAD Wish List
    Replies: 0
    Last Post: 2012-06-17, 05:54 AM
  3. Dynamic Move Parameter to Nearest Line
    By Ohnoto in forum AutoLISP
    Replies: 17
    Last Post: 2011-03-21, 12:30 PM
  4. Perpendicular & nearest won't snap to arc
    By gadjet in forum AutoCAD General
    Replies: 4
    Last Post: 2007-05-08, 07:13 AM
  5. Nearest Snap Problem
    By tblack.62739 in forum AutoCAD CUI Menus
    Replies: 1
    Last Post: 2005-09-01, 05:42 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •