Inspired by the OP, here is my updated routine that works for my needs and at the company I work for.
Similar to the code "mbrandt5" started with and what I posted earlier, but this also:
- Asks what scale to be drawing at (1 = PS, 48 = 1/4" = 1'-0", 96 = 1/8" = 1'-0" etc.)
- Rectangle has a plinewid of 0 (lineweight ByLayer) and radius of 1/4"
- After placing the detail call out, draws a polyline (you pick 3-points)
- Loads the callout "block" from a known address
Code:
;; DETAIL RECTANGLE AND CALLOUT ROUTINE
;; 2016-05-20 TED G.
;; CREATES NCS LAYERS AND USES NCS DETAIL CALLOUT
(defun C:detb ()
(setq cmde (getvar "cmdecho"))
(setq osm (getvar "osmode"))
(setvar "cmdecho" 1)
(setvar "attreq" 1)
(setvar "attdia" 1)
(setq scl (getdist "What Scale is this being drawn at? (paperspace = 1) Type a Number! "))(terpri)
(setq rad1 (* 0.25 scl))
(setq la (getvar "clayer"))
(SETQ LR1 (TBLSEARCH "LAYER" "G-ANNO-SYMB"))
(SETQ LR2 (TBLSEARCH "LAYER" "G-ANNO-SYMB-DETL"))
(IF (= LR1 NIL)
(command "layer" "make" "G-ANNO-SYMB" "color" "3" "" "lw" "0.35" "" ""))
(IF (= LR2 NIL)
(command "layer" "make" "G-ANNO-SYMB-DETL" "COLOR" "14" "" "lw" "0.7" "" "LT" "DASHED2" "" ""))
(command "layer" "t" "G-ANNO-SYMB-DETL" "S" "G-ANNO-SYMB-DETL" "")
(setvar "osmode" 0)
(if
(and (setq pt1 (getpoint "\nPick lower left corner of window: "))
(setq pt2 (getcorner pt1 "\nPick upper right corner of window: "))
)
(progn
(command "_rectangle" "f" rad1 pt1 pt2)
)
)
(setq pt3 (getpoint "Pick Detail Callout Location: "))
(command "layer" "t" "G-ANNO-SYMB" "S" "G-ANNO-SYMB" "")
(command "-insert" "c:\\lisp\\NCS_DETL""scale" scl pt3 "")
(setvar "osmode" 643)
(command "_pline" pause pause pause "")
(setvar "osmode" osm)
(setvar "clayer" la)
(setvar "cmdecho" cmde)
(princ)
)
(princ "\nDETB.lsp loaded, command: DETB, see command line for prompts")