To change the units, change this line:
(setq mode 4)
to this
(setq mode 2)
on second thought change it to this:
(setq mode (getvar "LUNITS"))
At this prompt:
Select object(s) for layer filter.
The layer of anything you select will be used as the layer filter.
If you answered Yes to this prompt:
Current Space Only?
All objects in the current space matching the layer filter are used to get the total length.
This version will get current space objects or entire DWG objects on matching layer.
Perhaps I should modify the interface to allow user selected or all in current space or all in DWG.