求助
有一lisp程序,我想实现对圆的按比例缩放和统一半径两种功能,但是调试总有问题,请哪位高手不吝赐救,先行谢了!用"比例缩放"搜索看看
请教龙龙仔
(SETQ SC (getstring "\n比例缩放/<统一半径为> :"))这段语句在cad命令行输入时,键盘输入字符可真确反回结果,但在程序中则返回0.0,不知是怎么回事?
你這個問題以前我有回答過如下:
本帖最后由 作者 于 2002-10-30 8:09:24 编辑你這個問題以前我有回答過如下:
(defun C:TC (/ SSET SC SC1 SSLEN NT)
(while (= SSET NIL)
(prompt "\n选择要修改的圆:")
(setq SSET (ssget '((0 . "CIRCLE"))))
)
(setq SC (getstring "\n输入半径(R)/<缩放比例>: "))
(if (= SC "")
(setq SC (getreal "\n缩放比例: "))
(setq SC1 (getreal "\n输入半径: "))
)
(setq SSLEN (sslength SSET))
(while (> SSLEN 0)
(setq ENT (entget (ssname SSET (setq SSLEN (1- SSLEN)))))
(if (= SC1 NIL)
(setq NT (* SC (cdr (assoc 40 ENT))))
(setq NT SC1)
)
(entmod (subst (cons 40 NT) (assoc 40 ENT) ENT))
)
(princ)
)
;;改良
(defun C:TC (/ SSET SC SC1 SSLEN NT)
(while (= SSET NIL)
(prompt "\n选择要修改的圆:")
(setq SSET (ssget '((0 . "CIRCLE"))))
)
(setq SC (getreal "\n缩放比例(ENTER)/<输入半径>: "))
(if (= SC NIL)
(progn
(initget (+ 1 2 4))
(setq SC1 (getreal "\n缩放比例: "))
)
)
(setq SSLEN (sslength SSET))
(while (> SSLEN 0)
(setq ENT (entget (ssname SSET (setq SSLEN (1- SSLEN)))))
(if (= SC1 NIL)
(setq NT SC)
(setq NT (* SC1 (cdr (assoc 40 ENT))))
)
(entmod (subst (cons 40 NT) (assoc 40 ENT) ENT))
)
(princ)
)
页:
[1]