I know how to increment pick points numerically (see below). How is it done alphabetically?
(defun C:test (/ pt# pt) (setq pt# (getint "\nEnter number: ")) (while (setq pt (getpoint "\nSpecify point: " )) (if (/= pt nil) (progn (command "TEXT" "M" pt "" "" pt#) (setq pt# (1+ pt#)) ) ) ) (princ) )
@smaher12 wrote:I know how to increment pick points numerically (see below). How is it done alphabetically?
....
You need to use the (ascii) and (chr) functions to give integer equivalents to letters so that you can increment them upward, for example:
(defun C:test (/ ltr asc pt)
(setq
ltr (getstring "\nEnter starting letter: ")
asc (ascii ltr)
)
(while
(setq pt (getpoint "\nSpecify point: " ))
(progn
(command "TEXT" "M" pt "" "" (chr asc))
(setq asc (1+ asc))
)
)
(princ)
)
Consider whether you need to make it more sophisticated, for instance, if the User picks enough points to go past Z [or z], it will move into punctuation characters, but you could have it go into double letters instead. I think there are threads on this Forum that include ways to do that. You could also have it check whether the User entered a single letter, or let them start with a double letter, and some other things.
Thank you Kent. I am looking at the following post (message 4) to consider what to do after Z or z.
http://forums.autodesk.com/t5/Visual-LISP-AutoLISP-and-General/Auto-Increment-Letter/td-p/2325302
You may also be interested in my Increment Alpha & Alpha++ functions as part of my set of Column Reference Functions - that page also provides examples of how to call the functions with the required arguments.
I hope this helps!