oh darn Emmanuel beat me to it, awell , at least (unlike me) he probably knows what he was doing
lol....oh , that's the command , because don't want to redefine my own LL command (load lisp)
(defun alg-ang (obj pnt)
(angle '(0. 0. 0.) (vlax-curve-getfirstderiv obj (vlax-curve-getparamatpoint obj pnt))))
(defun C:LoL (/ *error* acsp adoc ang fld midp mtx rot sset txtpt)
(defun *error* (msg)
(if (vl-position msg '("console break" "Function cancelled" "quit / exit abort"))
(princ "Error!") (princ msg)) (vla-endundomark (vla-get-activedocument (vlax-get-acad-object)))
(princ)
)
(or adoc (setq adoc (vla-get-activedocument (vlax-get-acad-object))))
(if (and (= (getvar "tilemode") 0) (= (getvar "cvport") 1))
(setq acsp (vla-get-paperspace adoc)) (setq acsp (vla-get-modelspace adoc)))
(vla-startundomark adoc)
(if (setq sset (ssget "_:L" (list (cons 0 "point"))))
(foreach obj
(mapcar 'vlax-ename->vla-object (vl-remove-if 'listp (mapcar 'cadr (ssnamex sset))))
;(if (not (eq "AcDbArc" (vla-get-objectname obj)))
; (setq midp (vlax-curve-getclosestpointto obj (vlax-curve-getpointatparam obj
; (/ (- (vlax-curve-getEndParam obj)(vlax-curve-getStartParam obj)) 2))))
; (setq midp (vlax-curve-getclosestpointto obj (vlax-curve-getpointatdist obj
; (/ (vla-get-arclength obj) 2)))))
;(setq ang (alg-ang obj midp))
(setq ang 0 midp (vlax-safearray->list (vlax-variant-value (vla-get-coordinates obj))))
(if (> pi ang (/ pi 2)) (setq ang (+ ang pi)))
(if (> (* pi 1.5) ang pi) (setq ang (+ ang pi)))
(setq rot (+ ang (/ pi 2)))
(setq txtpt (polar midp (* pi 0.25) (if (zerop (getvar "dimtxt")) 2.5 (getvar "dimtxt"))))
(setq fld (strcat "%<\\AcObjProp Object(%<\\_ObjId " (itoa (vla-get-objectid obj)) ">%).Layer>%"))
(setq mtx (vlax-invoke acsp 'AddMText midp 0.0 fld))
(vlax-put mtx 'AttachmentPoint (vlax-put mtx 'InsertionPoint txtpt) (vlax-put mtx 'Rotation ang)
)
)
(princ)
)
(princ "\n\t\t\tType LoL to label curves with layer name\t")
(prin1)
(vl-load-com)
time (almost) to enjoy the weekend
gr. R.