Area and length of multiple objects POLYLEN

;;;; FAQ: [23.5] How to calculate the LENGTH of polylines?

;;; add up the LENGTH of all selected objects, NOISY

(defun C:LEN-OF ()

(command "_AREA" "_A" "_O") ;add up objects

(std-ssmap 'command (ssget)) ;pass to AutoCAD

(command "" "") ;two returns

(getvar "PERIMETER")) ;this is the length

;;; similarly

(defun C:AREA-OF ()
  (command "_AREA" "_A" "_O")
  (std-ssmap 'command (ssget))
  (command "" "")
  (getvar "AREA"))

;;; Add up all the lengths of all selected polylines, quiet

;;; To accept also other entities, provide another function to std-ssmap

(defun C:POLYLEN ()
  (apply '+ 
    (std-ssmap 'poly-length 
      (ssget '((0 . "*POLYLINE"))))))

;;; calculates length of a polyline or lwpolyline, quiet

(defun POLY-LENGTH (poly)

(apply '+ ; the sum of all single segment lengths

(mapcar 'std-seg-length ; straight and curved

(std-pline-segs poly)))) ;segment list (p1 p2 [bulge])