Search the Community
Showing results for tags 'letter'.
-
I made a couple routines for a friend who wanted to increment numbers and letters. I know there are a few different programs out there already but you only learn by trying, right! I used kind of a different approach than the programs I have seen. I tried to understand Lees suite but promptly gave up on that adventure... for now... Please take a look as I would like to know if I did anything that could be improved. All your input lately has been much appreciated, thank you all! The numbering program creates a new text style and gives the user an option to add a suffix to the number with a default option. Is the key the only way i can exit this to be able to reset my variables? (defun c:incnum(/ *error oldcmd oldtextstyle num tht inc lr bp) (setq oldcmd (getvar 'cmdecho) oldtextstyle (getvar 'textstyle) ) (defun *error* (msg) (if oldcmd (setvar 'cmdecho oldcmd)) (if oldtextstyle (setvar 'textstyle oldtextstyle)) (setq msg "Function Completed") (princ msg) (princ) ) (setvar 'cmdecho 0) (command "-style" "ROMANS" "romans.shx" "" "" "" "" "" "") (initget 7) (setq num (getint "\nEnter number to start:")) (initget 7) (setq tht (getreal "\nEnter text height desired:")) (initget 7) (setq inc (getint "\nEnter number to increment by:")) (initget "Left Right") (setq LR (getkword "\nChoose kerf [Left/Right] <Right>: ")) (if(not LR)(setq LR "Right")) (initget 1) (while (setq bp (getpoint "\nPick point--Press <Esc> when finished")) (entmake (list (cons 0 "text") (cons 1 (if (= LR "Right") (strcat(itoa num)",r") (itoa num) ) ) (cons 10 bp) (cons 11 bp) (cons 40 tht) (cons 7 "romans") ) ) (setq num (+ inc num)) (initget 1) ) ) The letter program is set up to always display capital letters regardless of the case of the input.. Also it will quit after letter "Z". (defun c:inclet(/ *error oldcmd start nascii tht bp) (setq oldcmd (getvar 'cmdecho)) (defun *error* (msg) (if oldcmd (setvar 'cmdecho oldcmd)) (setq msg "Function Completed") (princ msg) (princ) ) (setvar 'cmdecho 0) (initget "a b c d e f g h i j k l m n o p q r s t u z w x y z") (setq start (getkword "\Enter starting letter: ")) (if(> (setq nascii (ascii start)) 90) (setq nascii (- nascii 32))) (setq tht (getvar "TEXTSIZE")) (initget 1) (while(<= nascii 90) (setq bp (getpoint "\nPick point--Press <Esc> when finished")) (entmake (list (cons 0 "text") (cons 1 (chr nascii)) (cons 10 bp) (cons 11 bp) (cons 40 tht) ) ) (setq nascii (+ 1 nascii)) (initget 1) ) )