;;;Elise Moss ;;;Moss Designs ;;;www.mossdesigns.com ;;;August 2001 ;;; ;;;This routine allows you to label cable by selecting points to place text. (defun c:anum () ; get the current layer (setq curlay (getvar "CLAYER")) ;;CREATE THE LAYERS WE NEED (command "-layer" "new" "RefLetter,RefLetterNumber" "c" "t" "0,0,0" "RefLetter" "c" "t" "255,0,0" "RefLetterNumber" "") ;;;get first number (setq prefix (getstring "\n Prefix ? ")) (if (= prefix "") (setq prefix "A") ) (setq stnum (getint "\nStarting number? ")) (setq label (strcat prefix ", " (itoa stnum))) (setq incrnum (getreal "\nIncrement numbers by <1>? ")) (if (= incrnum nil) (setq incrnum 1) ) (setq txtht (getreal "\n Set textheight to: ")) (setq placepoint (getpoint "\Select text location: ")) (command "-layer" "s" "RefLetter" "") (command "text" placepoint txtht "0" prefix) (princ) (setq px (car placepoint)) (setq py (cadr placepoint)) (setq newpx (+ px (* txtht 1.02))) (setq y-delta (/ txtht 2)) (setq newpy (- py y-delta)) (setq newtxtht (/ txtht 2)) (setq subpoint (list newpx newpy 0.0)) (command "-layer" "s" "RefLetterNumber" "") ; place subtext (command "text" subpoint newtxtht "0" (itoa stnum)) ; increment (setq stnum (+ stnum incrnum)) ; get next text location (setq placepoint (getpoint "\Select text location: ")) (while (/= placepoint nil) (command "-layer" "s" "RefLetter" "") (command "text" placepoint txtht "0" prefix) (princ) (setq px (car placepoint)) (setq py (cadr placepoint)) (setq newpx (+ px (* 1.02 txtht) )) (setq y-delta (/ txtht 2)) (setq newpy (- py y-delta)) (setq subpoint (list newpx newpy 0.0)) (command "-layer" "s" "RefLetterNumber" "") ; place subtext (command "text" subpoint newtxtht "0" (itoa stnum)) (setq stnum (+ stnum incrnum)) (setq placepoint (getpoint "\Select text location: ")) ) ;end while ;reset back to current layer (command "-layer" "s" curlay "") (princ) ) ; end defun (prompt "\nType anum to run. ")