(defun c:foo (/ _c ad b bd bn d e p p2 s sc)
;; RJP » 2018-12-10
(defun _c (p r) (entmakex (list '(0 . "circle") (cons 10 p) '(8 . "detail") (cons 40 r))))
(cond
((and
(setq p (getpoint "\nPick center of detail: "))
(setq d (getdist p "\nEnter radius: "))
(setq p2 (getpoint p "\nPick point to place detail: "))
(setq sc (cond ((getint "\nEnter scale of detail <2>: "))
(2)
)
)
(setq s (ssget "_C" (list (+ (car p) d) (- (cadr p) d)) (list (- (car p) d) (+ (cadr p) d))))
(setq s (vl-remove-if 'listp (mapcar 'cadr (ssnamex s))))
(setq s (vl-remove-if
'(lambda (x) (wcmatch (cdr (assoc 0 (entget x))) "INSERT,MTEXT,TEXT,DIMENSION"))
s
)
)
)
(setq bn (strcat "Detail_" (itoa sc) "_" (rtos (getvar 'cdate) 2 12)))
(setq ad (vla-get-activedocument (vlax-get-acad-object)))
(setq bd (vlax-invoke (vla-get-blocks ad) 'add p bn))
(vlax-invoke ad 'copyobjects (mapcar 'vlax-ename->vla-object s) bd)
(setq b (vla-insertblock (vla-get-modelspace ad) (vlax-3d-point p2) bn sc sc sc 0.))
(_c p d)
(_c p2 (* d sc))
(vla-put-layer b "detail")
(command "_.polygon" 100 p2 "_I" (* d sc))
(setq e (entlast))
(command "_.xclip" (vlax-vla-object->ename b) "" "_New" "_Select" e)
(entdel e)
(entmakex (list '(0 . "line")
(cons 10 (polar p (angle p p2) d))
(cons 11 (polar p (angle p p2) (- (distance p p2) (* d sc))))
'(8 . "detail")
)
)
(entmakex
(list '(0 . "TEXT")
'(100 . "AcDbEntity")
'(67 . 0)
'(8 . "detail")
'(100 . "AcDbText")
(cons 10 (setq p2 (polar p2 (* pi 1.5) (+ (* d sc) (* 2.5 (getvar "TEXTSIZE"))))))
(cons 40 0.125)
(cons 1 (strcat "sCALED:" (itoa sc) "x"))
'(50 . 0.)
'(41 . 1.)
'(51 . 0.)
'(71 . 0)
'(72 . 1)
(cons 11 p2)
'(100 . "AcDbText")
'(73 . 0)
)
)
)
)
(princ)
)
(vl-load-com)
I tried to somewhat translate your code. It could still use some cleanup but hopefully will give you a working base.