Designer's initials Autofill Field

Designer's initials Autofill Field

todd.silvernail
Participant Participant
907 Views
4 Replies
Message 1 of 5

Designer's initials Autofill Field

todd.silvernail
Participant
Participant

I know this has been brought up many times and I've scoured the forums/Autodesk KBS and found many different solutions.  But none have resolved my issue.  Autocad 2017, windows 10 users with Firstname Lastname computer logins. There is a space between First Last.  When users run command LOGINNAME, it's confirmed.

I have users that need their profile initials to auto populate in the titleblock.  I've used the following Diesel expression (I'm not proficient in diesel) :

 

%<\AcDiesel $(substr, $(getvar, "loginname") ,1 ,2)>%

This only spits out the first initial obviously, but I need the command to find the space in the name, then spit out the last name initial.  Anyone?

0 Likes
908 Views
4 Replies
Replies (4)
Message 2 of 5

dlanorh
Advisor
Advisor

Do a google search for - autolisp split string, for a function that will split a string using a delimiter (" "). This will return a list of strings

 

then using the returned list (lst)

 

(foreach x lst (setq inits (strcat inits (strcase (substr x 1 1)))))

inits now should be the capitalised initials

I am not one of the robots you're looking for

Message 3 of 5

dlanorh
Advisor
Advisor

Try this. It creates a global variable (*inits* the two *'s are part of the name). This is available on a per drawing basis once the code is run.

 

(defun c:inits (/)
  (defun str_split ( str del / n ) (if (setq n (vl-string-search del str)) (cons (substr str 1 n) (str_split (substr str (+ n 1 (strlen del))) del)) (list str)))
  (setq *inits* (apply 'strcat (mapcar '(lambda (x) (strcase (substr x 1 1))) (str_split (getvar 'loginname) " "))))
  (princ)
);end_defun

I am not one of the robots you're looking for

Message 4 of 5

todd.silvernail
Participant
Participant
Almost exactly 3 years later, apologies for not responding! My users dropped the issue and just manually placed their initials into the sheets. I was unable to test your method and I appreciate your response and again apologies. I hope this helps someone else though!
0 Likes
Message 5 of 5

Sea-Haven
Mentor
Mentor

"into the sheets" if your using layouts then lots of functions out there like, fill in 1 layout and copy to all other layouts with same block name. Used in conjunction with auto layout creation.

 

Others;

"sheet X of Y" update all layouts

Do index of layouts

Rename all layouts

Others have more.

If you want post.

0 Likes