I would appreciate any critiques on how my command
1. Acquires the desired layer ;<----- I'm sure there is a better way to do this that I don't understand/know
2. Decides whether to use the annotative blocks / scales.
3. General formatting.
I should say that most of our projects are non-annotative (for now, although I'm trying to change that)
Thanks,
Andre
Code:
(defun anno-manual-set (/ oanno)
(if (not anno)(setq anno "N"))
(setq oanno anno)
(if (= (setq anno (getstring (strcat "\nis drawing annotative? <"oanno">: ")))"")
(setq anno oanno))
(setq anno (strcase anno))
(princ (strcat "\nis drawing annotative? \"" anno"\""))
(if (/= anno "Y")
(progn
(if (/= anno "N")
(progn
(alert "\nPlease specify \"Y\" or \"N\"")
(setq anno oanno)
(anno-manual-set)
))
))
(princ))
(defun anno-set (/ oanno)
(if (not anno)
(anno-manual-set)
)
(princ))
(defun c:tp (/ bn bs sp1 rl cclayer) ; bn=block name / bs = block scale
(anno-set)
(setq cclayer (getvar "clayer"))
(setq bn "SPIN-IN")
(setq bs (getvar "Dimscale"))
(if (= anno "Y")
(progn
(setq bn "SPIN-IN_ANNO")
(setq bs 1)
))
(setq sp1 (getpoint "\nspecify point for single line tap: "))
(if(/= sp1 nil)
(progn
(command "laymcur" sp1)
(setq rl (getvar "clayer"))
(setvar "clayer" cclayer)
(command "-insert" bn "s" bs "r" 0 sp1)
(command "Change" (entlast) "" "P" "LA" rl "")
(command "rotate" (entlast) "" "non" sp1 pause)
))
(princ))