从别人处找了本98年出版的AutoLISP教程,临时磨刀上阵,无法对其函数精髓的领会,惭愧。 多亏有了如ZZXXQQ先生这样的热心人,再次谢谢啦! 搬用上面的代码,折腾了几个小时,终于按自己需要凑合可用了。虽然上不了台面,毕竟是我的处女作也。 (defun c:tt () (command "osnap" "none") (command "zoom" "e") (if (setq ss (ssget "X" '((0 . "INSERT") (2 . "AA")))) (progn (setq i 0) (repeat (sslength ss) (setq ent (entget(ssname ss i)) i (1+ i)) (setq J1 (/ (- (caddr(assoc 10 ent)) 15) 5)) (setq J1 (rtos J1 2 2)) (command "change" "w" "18.5,10" "26.5,12" "" "" "" "" "" "0" J1) ) )) (princ) (if (setq ss (ssget "X" '((0 . "INSERT") (2 . "BB")))) (progn (setq i 0) (repeat (sslength ss) (setq ent (entget(ssname ss i)) i (1+ i)) (setq J2 (/ (- (caddr(assoc 10 ent)) 15) 5)) (setq J2 (rtos J2 2 2)) (command "change" "w" "18.5,8" "26.5,10" "" "" "" "" "" "0" J2) ) )) (princ) (command "osnap" "int") ) |