jeepsheep 发表于 2004-9-25 21:28:00

修改别人的插入当前时间段!

<FONT face=宋体 size=2>(defun c:rq (/ tmp cy cm cd txt txt1 pt1)<BR>(setq tmp (rtos (getvar "cdate") 2 16))<BR>(setq cy (rtos (atof (substr tmp 1 4)) 2 0)<BR>cm (rtos (atof (substr tmp 5 2)) 2 0)<BR>cd (rtos (atof (substr tmp 7 2)) 2 0)<BR>)<BR>(cond ((= cm "1")(setq cm "Jan"))<BR>((= cm "2")(setq cm "Feb"))<BR>((= cm "3")(setq cm "Mar")) <BR>((= cm "4")(setq cm "Apr"))<BR>((= cm "5")(setq cm "May"))<BR>((= cm "6")(setq cm "Jun")) <BR>((= cm "7")(setq cm "Jul"))<BR>((= cm "8")(setq cm "Aug")) <BR>((= cm "9")(setq cm "Sep"))<BR>((= cm "10")(setq cm "Oct")) <BR>((= cm "11")(setq cm "Nov"))<BR>((= cm "12")(setq cm "Dec")) <BR>);cond <BR>(setq txt (strcat "现在是:" cd "," cm "," cy " ")<BR>txt1 (strcat cd "," cm "," cy " ")<BR>)<BR>(COMMAND "style" "宋体" "宋体" "300" "1" "0" "" "")<BR>(alert txt)<BR>(setq pt1(getpoint"\n\t放置点 : "))<BR>(command "text" "j" "mc" pt1 "0" txt1)<BR>(princ)<BR>) <BR><BR><BR>哪位大侠帮忙修改一下,使之变为点选文字使之内容变为当前时间!<BR>恨自己不懂LISP的编写,只会照猫画虎.</FONT>

王咣生 发表于 2004-9-25 23:18:00

回复

(defun c:rq (/ tmp cy cm cd txt txt1 pt1)<BR>       (setq tmp (rtos (getvar "cdate") 2 16))<BR>       (setq cy (rtos (atof (substr tmp 1 4)) 2 0)<BR>        cm (rtos (atof (substr tmp 5 2)) 2 0)<BR>        cd (rtos (atof (substr tmp 7 2)) 2 0)<BR>        )<BR>       (cond ((= cm "1")(setq cm "Jan"))<BR>        ((= cm "2")(setq cm "Feb"))<BR>        ((= cm "3")(setq cm "Mar"))<BR>        ((= cm "4")(setq cm "Apr"))<BR>        ((= cm "5")(setq cm "May"))<BR>        ((= cm "6")(setq cm "Jun"))<BR>        ((= cm "7")(setq cm "Jul"))<BR>        ((= cm "8")(setq cm "Aug"))<BR>        ((= cm "9")(setq cm "Sep"))<BR>        ((= cm "10")(setq cm "Oct"))<BR>        ((= cm "11")(setq cm "Nov"))<BR>        ((= cm "12")(setq cm "Dec"))<BR>        );cond<BR>       (setq txt (strcat "现在是:" cd "," cm "," cy " ")<BR>        txt1 (strcat cd "," cm "," cy " ")<BR>        )<BR>       (COMMAND "style" "宋体" "宋体" "300" "1" "0" "" "")<BR>       (alert txt)<BR>       ;;;(setq pt1(getpoint"\n\t放置点 : "))<BR>       ;;;(command "text" "j" "mc" pt1 "0" txt1)<BR>       (setq ename (car (entsel)))<BR>       (if ename<BR>                       (progn<BR>                                       (setq elist (entget ename))<BR>                                       (if (= (cdr (assoc 0 elist)) "TEXT")<BR>        (progn<BR>               (setq elist (subst (cons 1 txt1) (assoc 1 elist) elist))<BR>               (entmod elist)<BR>               )<BR>        )<BR>                                       )<BR>                       )<BR>       (princ)<BR>       )

jeepsheep 发表于 2004-9-26 13:44:00

谢谢!

清风明月名字 发表于 2013-6-27 09:07:26

谢谢楼主的分享!很有意思的代码,收藏备用。

混沌初开 发表于 2013-12-28 01:13:28

贴张图看一下!
页: [1]
查看完整版本: 修改别人的插入当前时间段!