Give this a try:
(defun c:totalen (/ total lay ss lst output)
(setq total 0
lay (cdr
(assoc
8
(entget
(car (entsel "\n Select object to set layer filter: "))
)
)
)
ss (ssget (list (cons '0 "LINE,*POLYLINE,SPLINE,ARC,CIRCLE")
(cons '8 lay)
)
)
)
(if (and lay ss)
(progn
(setq
lst (mapcar 'vlax-ename->vla-object
(vl-remove-if 'listp (mapcar 'cadr (ssnamex ss)))
)
)
(mapcar '(lambda (x)
(setq len (vlax-curve-getdistatparam
x
(vlax-curve-getendparam x)
)
total (+ total len)
)
)
lst
)
(setq output
(strcat "\n"
(itoa (sslength ss))
" objects on layer ''"
lay
"'' have a total length of - "
(rtos total (getvar 'lunits) 3)
)
)
(alert output)
(princ output)
)
)
)