不错 学习了 .................				
			
		没看到代码在哪啊...............grread				
			
		谢谢G版分享,学习一下!				
			
		学习学习,找了好久了				
			
		之前在theswamp上看到一个类似的,不过想看看楼主的				
			
		我之前用的,但没有显示;;eGrid.lsp 
;;Rewritten by CAB @ TheSwamp.org
;; 
;;User picks a rectangle to size the 24x24 grid lines the
;;User drags the grid to it's final position
(defun c:egrid (/       DRAG    GHOSTPT H_CNT   H_CNT   H_DISTH_OFS   PLIST
                PT_1    PT_2    TIME    TMP   V_CNT   V_CNT   V_DISTV_OFS
                get_osmode calc_ get_points DrawGrid ghost
               )
 
;;CAB10/5/2006
;;
;;Function to return the current osmode setting in the form of a string
;;If (getvar "osmode") = 175
;;(get_osmode)returns   "_end,_mid,_cen,_nod,_int,_per"
(defun get_osmode (/ cur_mode mode$)
    (setq mode$ "")
    (if (< 0 (setq cur_mode (getvar "osmode")) 16383)
      (mapcar
      '(lambda (x)
         (if (not (zerop (logand cur_mode (car x))))
             (setq mode$ (strcat mode$ (cadr x)))
         )
         )
      '(
          (0    "_non,")
          (1    "_end,")
          (2    "_mid,")
          (4    "_cen,")
          (8    "_nod,")
          (16   "_qua,")
          (32   "_int,")
          (64   "_ins,")
          (128"_per,")
          (256"_tan,")
          (512"_nea,")
          (1024 "_qui,")
          (2048 "_app,")
          (4096 "_ext,")
          (8192 "_par")
         )
      )
    )
    mode$
)
;;Subrutine - calc offset & count
(defun calc_ (dist / rm ofs count)
    (setq count (/ dist 24.0))
    (setq rm (- count (fix count)))
    (setq ofs (* rm 12))
    (cond
      ((zerop rm)                     ; 24 even
       (setq count (1- count)
             ofs   24
       )
      )
      ((< ofs 12)
       (setq ofs   (+ ofs 12)
             count (1- count)
       )
      )
    )
    (list ofs (fix count))
)
(defun get_points (ll h_ofs h_cnt v_ofs v_cnt h_dist v_dist / up ptl pts pte)
    (setq up (/ pi 2))
    ;;hor lines
    (setq pts (polar ll up v_ofs)
          pte (polar pts 0 h_dist)
    )
    (setq ptl (list (list pts pte)))
    (repeat v_cnt
      (setq pts (polar pts up 24)
            pte (polar pts 0 h_dist)
      )
      (setq ptl (cons (list pts pte) ptl))
    )
    ;;vert lines
    (setq pts (polar ll 0 h_ofs)
          pte (polar pts up v_dist)
    )
    (setq ptl (cons (list pts pte) ptl))
    (repeat h_cnt
      (setq pts (polar pts 0 24)
            pte (polar pts up v_dist)
      )
      (setq ptl (cons (list pts pte) ptl))
    )
    ptl
)
;;Draw the Grid
(defun DrawGrid (plist / mk_line)
    (defun mk_line (st en)
      (entmake (list
               (cons 0 "LINE")      ;***
               (cons 6 "BYLAYER")
               (cons 8 "0")
               (cons 10 st)         ;***
               (cons 11 en)         ;***
               (cons 39 0.0)
               (cons 62 256)
               (cons 210 (list 0.0 0.0 1.0))
               )
      )
    )
    (mapcar '(lambda (x) (mk_line (car x) (cadr x))) plist)
)
;;Ghost the Grid
(defun ghost (plist / pv)
    (mapcar '(lambda (x)
               (if pv
               (setq pv (cons (car x) (cons (cadr x) (cons 4 pv))))
               (setq pv (list (car x) (cadr x) 4))
               )
             )
            plist
    )
    (grvecs (reverse pv))
)
;;****************************
;;Main Routine starts here 
;;****************************
(setq pt_1 (getpoint "\n* Size the Grid, Pick Lower-Left corner *"))
(setq pt_2 (getcorner pt_1 "\n* Pick Upper-Right corner *"))
(setq h_dist (- (car pt_2) (car pt_1))) ; horizontal length of the rectangle
(setq v_dist (- (cadr pt_2) (cadr pt_1))) ; vertical length of the rectangle
(setq tmp   (Calc_ h_dist)
      h_ofs (car tmp)
      h_cnt (cadr tmp)
)
(setq tmp   (Calc_ v_dist)
      v_ofs (car tmp)
      v_cnt (cadr tmp)
)
(setq time T)
(while time
    (setq drag (grread t 1 1))
    (cond
      ((= (car drag) 5)
       (if (null (setq ghostpt (osnap (cadr drag) (get_osmode))))
         (setq ghostpt (cadr drag))
       )
       (redraw)
       (setq plist (get_points ghostpt h_ofs h_cnt v_ofs v_cnt h_dist v_dist))
       (ghost plist)
      )
      ((= (car drag) 3)
       ;;(setq ghostpt (cadr drag))
       (if (null (setq ghostpt (osnap (cadr drag) (get_osmode))))
         (setq ghostpt (cadr drag))
       )
       (redraw)
       (setq plist (get_points ghostpt h_ofs h_cnt v_ofs v_cnt h_dist v_dist))
       (DrawGrid plist)
       (setq time nil)
      )
    )
)
(princ)
)				
			
		 本帖最后由 jpgmeta 于 2016-7-25 06:16 编辑 
楼主,当我将图纸用鼠标缩小时,会出现"INTERSECT 所选对象太多"的提示,可能是光标下的点太多引起的
----------------------
刚发现关掉捕捉中的"交点"就可以了
				
			
		看一下,支持楼主				
			
						
			
		grread的捕捉lihai