Lt Dan's l 发表于 2022-7-6 10:34:42

检索用户prof的简单方法

试着用我和同事的Lisp程序。我被用户配置文件名卡住了
 
(defun c:STAMP (/ opt date ent text)
(initget 1 "Date Name")
(setq opt (getkword "\nSpecify stamp : "))
(while
   (not
   (and
(setq ent (car (entsel "\nSelect text to modify: ")))
(eq "TEXT" (cdr (assoc 0 (setq ent (entget ent)))))
   )
   )
(prompt "\n**Please select a text to modify!**")
)
(if (eq "Date" opt)
   (progn
   (setq date (rtos (getvar "CDATE") 2 0))
   (setq text (strcat (substr date 5 2) "/" (substr date 7 2) "/" (substr date 3 2)))
   )
   (setq text (getvar "???"))
)
(entmod (subst (cons 1 text)(assoc 1 ent) ent))
(princ)
)

Kerry Brown 发表于 2022-7-6 10:50:31

(getvar“CPROFILE”)

Lt Dan's l 发表于 2022-7-6 10:56:25

非常感谢。

rkmcswain 发表于 2022-7-6 11:13:35

AutoCAD配置文件还是Windows配置文件?
如果是后者,则使用(getenv“username”)

Lt Dan's l 发表于 2022-7-6 11:19:24

这是cad配置文件,但这可能有用。非常感谢。

Tharwat 发表于 2022-7-6 11:33:40

 
丹的腿好极了。
 
当做

Lt Dan's l 发表于 2022-7-6 11:43:07

谢谢如果这对这里的任何人都有用,你去吧
 
(defun c:STAMP (/ *error* opt date ent text)
(defun *error* (msg)
   (or (wcmatch (strcase msg) "*BREAK,*CANCEL*,*EXIT*")
      (princ (strcat "\n** Error: " msg " **"))
   )
   (princ)
)
   (initget 1 "Date Name")
   (setq opt (getkword "\nSpecify stamp : "))
   (while
   (not
       (and
         (setq ent (car (entsel "\nSelect text to modify: ")))
         (setq ent (entget ent))
         (OR
         (eq "TEXT" (cdr (assoc 0 ent)))
         (eq "MTEXT" (cdr (assoc 0 ent)))
         )
       )
   )
    (prompt "\n**Please select a text to modify!**")
   )
   (if (eq "Date" opt)
   (progn
       (setq date (rtos (getvar "CDATE") 2 0))
       (setq text (strcat (substr date 5 2) "/" (substr date 7 2) "/" (substr date 3 2)))
   )
   (setq text (getvar "CPROFILE"))
   )
   (entmod (subst (cons 1 text)(assoc 1 ent) ent))
   (princ)
)
 
很抱歉我只使用单行文字,但决定允许同时使用。。。如果有人真的用这个。
页: [1]
查看完整版本: 检索用户prof的简单方法