You can use this:
(defun C:BB (/ minpt maxpt); Bounding Box of selected object
(vla-getboundingbox (vlax-ename->vla-object (car (entsel))) 'minpt 'maxpt)
(setq
box (list (vlax-safearray->list minpt) (vlax-safearray->list maxpt))
delta (mapcar '- (cadr box) (car box))
); setq
(prompt
(strcat
"\nBounding Box [in 'box' variable]: " (vl-princ-to-string box) ";"
"\nExtents: X direction " (rtos (car delta))
"; Y direction " (rtos (cadr delta))
"; Z direction " (rtos (caddr delta)) "."
); strcat
); prompt
(princ)
)
and read [and/or put into a variable, etc., if you want] its reported X-direction extents, or Y-direction if that's what "length" might mean for a given Block.
It works with different kinds of objects, stretch-parameter line length differences, scale factors, etc.
I also have a routine to draw the XY plane of the bounding box, instead of just report on it -- the DBB command [and DBBM for the collective box around Multiple objects] in DrawBoundingBox.lsp, >here<. That was used for the illustration below.
BUT:
That's reliable only with something orthogonally oriented. The difficulty is that when used with a Block, if it's rotated at some non-orthogonal angle, it's as though its bounding box when at zero rotation becomes part of the definition, and the resulting bounding box of the rotated Block is that of the bounding box of the non-rotated Block, when rotated to the same angle. Here, the dotted yellow at right illustrates what the yellow box in the middle becomes as if it's present and rotated along with the Block [even though it's not part of the Block definition]. That is what the right image builds its green bounding box around, though the Block itself is all that was selected. So the green one extends beyond the actual extents of the white Block contents:

So if "length" for you means, for example, extent in the direction of its rotation angle, whatever that is, something else would be needed.
Kent Cooper, AIA