- ;_仿sketchup动态复制程序
- (defun c:ddc (/ #err4 $orr p1 p2 s e cn a1 d1 ns cnn)
- ;__________________
- (defun ttt (ss n / m)
- (defun #err4 (s)
- (command ".UNDO" "E")
- (setvar "osmode" snap)
- (setq *error* $orr)
- )
- (setq snap (getvar "osmode"))
- (setvar "cmdecho" 0)
- (setq $orr *error*
- *error* #err4
- )
- (setq ee e
- ns (ssadd)
- )
- (while (setq ee (entnext ee))
- (setq ns (ssadd ee ns))
- )
- (command "erase" ns "")
- (command "copy" ss "" "m" "non" p1)
- (if (member (substr n (strlen n)) '("/" "*"))
- (progn
- (setq m 0)
- (repeat (atoi n)
- (setq m (1+ m))
- (cond
- ((= "/" (substr n (strlen n)))
- (command "non"(mapcar '(lambda (x y) (+ x (* m (/ (- y x) (atof n))))) p1 p2))
- )
- ((= "*" (substr n (strlen n)))
- (command "non"(mapcar '(lambda (x y) (+ x (* m (- y x)))) p1 p2))
- )
- )
- )
- )
- (command "non" (setq p2 (polar p1 a1 (atof n))))
- )
- (command)
- )
- ;__________________
- (princ "\n动态复制程序")
- (princ "\n选择要复制的物体:")
- (setq s (ssget))
- (setq p1 (getpoint "\n复制的起点:"))
- (command "undo" "be" "line" p1 p1 "" )
- (setq e (entlast) )
- (command "copy" s "" "non" p1 pause)
- (setq p2 (getvar "lastpoint")
- a1 (angle p1 p2)
- d1 (distance p1 p2)
- )
- (setq cn "1*")
- (while cn
- (ttt s cn)
- (initget 128)
- (princ "\n输入坐标=复制终点 输入数值=修改间距 ")
- (princ "\n输入数值n并以 / 结束=间距内等分n次复制 输入数值n并以 * 结束=按间距复制n次 ")
- (setq cnn (getpoint "\n请按提示输入<退出>:"))
- (if (= 'LIST (type cnn))
- (setq p2 cnn
- a1 (angle p1 p2)
- d1 (distance p1 p2)
- )
- (setq cn cnn)
- )
- )
- (entdel e)
- (command "undo" "e")
- (princ)
- )
一直不得要领,麻烦那位大神改一下?这个还是比较好用的,用习惯了的话,可以实时修改!
|