Lt Dan's legs Posted August 10, 2010 Posted August 10, 2010 trying to make a lisp my coworker's and I can use. I'm stuck on user profile name (defun c:STAMP (/ opt date ent text) (initget 1 "Date Name") (setq opt (getkword "\nSpecify stamp [Date/Name]: ")) (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))) ) [b][color=red](setq text (getvar "???"))[/color][/b] ) (entmod (subst (cons 1 text)(assoc 1 ent) ent)) (princ) ) Quote
rkmcswain Posted August 10, 2010 Posted August 10, 2010 AutoCAD Profile or Windows Profile? If the latter, use (getenv "username") Quote
Lt Dan's legs Posted August 10, 2010 Author Posted August 10, 2010 it's cad profile but this may be useful. Thank you Quote
Tharwat Posted August 10, 2010 Posted August 10, 2010 (edited) trying to make a lisp my coworker's and I can use. I'm stuck on user profile name Wonderful work Lt Dan's legs. Regards. Edited August 10, 2010 by Tharwat Quote
Lt Dan's legs Posted August 10, 2010 Author Posted August 10, 2010 (edited) Thanks. If this is useful to anyone here you go (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 [Date/Name]: ")) (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) ) Sorry. I only use single line text but decided to allow the use of both... if anyone actually uses this. Edited August 10, 2010 by Lt Dan's legs Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.