想到ET里有个拖动的函数,我也做了一个,效果比用MOVE应该好多了:;函数:(Drag ss pt)
;功能:实现拖动效果
;参数:ss——需要实现拖动效果的对象选择集
; pt——拖动过程鼠标移动起点
;返回:左键拖动过程鼠标移动终点,否则返回nil(根据拖动过程的起点和终点就可以做需要做的事情了)- (defun Drag (ss pt / blk ent ents m gr rVal mc-make-unname-block)
- (defun mc-make-unname-block (pt ss / count entlist ent blk)
- (entmake (list '(0 . "BLOCK")
- '(2 . "*U")
- '(70 . 1)
- (cons 10 pt)
- )
- )
- (setq count 0)
- (repeat (sslength ss)
- (setq entlist (entget (setq ent (ssname ss count))))
- (setq count (1+ count))
- (entmake entlist)
- )
- (setq count 0)
- (repeat (sslength ss)
- (setq ent (ssname ss count))
- (setq count (1+ count))
- )
- (setq blk (entmake '((0 . "ENDBLK"))))
- )
- (if (setq blk (mc-make-unname-block pt ss))
- (progn
- (entmake (list (cons 0 "INSERT")
- (cons 2 blk)
- (cons 10 pt)
- )
- )
- (setq ent (entlast))
- )
- )
- (if ent
- (progn
- (setq ents (entget ent))
- (setq m t
- rVal nil
- )
- (while m
- (setq gr (grread 2 4))
- (cond
- ((= (car gr) 5)
- (setq ents (subst (cons 10 (cadr gr)) (assoc 10 ents) ents))
- (entmod ents)
- )
- ((= (car gr) 3)
- (setq m nil)
- (setq rVal (cadr gr))
- (entdel ent)
- (command "_.purge" "b" blk "n")
- )
- (t (setq m nil) (entdel ent)(command "_.purge" "b" blk "n"))
- )
- )
- )
- )
- rVal
- )
|