我用过外源码改成了 上下 和 左右 两个平移的程序,现在想合成一个,但是cond这个东西不好弄,越搞越糊涂
向大家请教一下,该如何完善!
- (defun c:MoveIt (/ ss d dir ang i e rot)
- (setq ss (ssget ":L" '((0 . "TEXT,MTEXT"))))
- (setq d (getdist "\nSpecify offset distance: "))
- (initget "L R U D")
- (setq dir
- (cond
- (getkword "\nChoose direction [上下左右] <右/R>:")
- (if (NULL dir) (setq dir "R")
- )
- (t dir)
- )
- )
- (cond ((= dir "U") (setq ang (/ pi 2) ))
- ((= dir "R") (setq ang 0))
- ((= dir "D") (setq ang (* 3 (/ pi 2)) ) )
- ((= dir "L") (setq ang pi))
- )
-
- (repeat (setq i (sslength ss))
- (setq e (vlax-ename->vla-object (ssname ss (setq i (1- i)))))
- (setq rot (vlax-get e 'Rotation) ip (vlax-get e 'InsertionPoint))
- (Vlax-put e 'InsertionPoint (polar ip (+ ang rot) d)
- )
- )
- (princ)
- )
|