@LoganAC34 wrote:
... add up the amount displayed instead of the actual value of the dimension, as well as preferably any text override. ....
Try this [minimally tested]:
(defun C:DDVS ; = Dimension Displayed Value Sum
(/ sum ss n dim mea ddata sdata disp prec)
(setq sum 0.0); initial value to add to
(prompt "\nTo add displayed values of Dimensions,")
(if (setq ss (ssget '((0 . "DIMENSION"))))
;; Does not limit to only linear-variety Dimensions, but could be made
;; to ignore angular and ordinate Dimensions in stepping through.
(progn ; then
(repeat (setq n (sslength ss))
(setq
dim (ssname ss (setq n (1- n)))
mea (cdr (assoc 42 (setq ddata (entget dim)))); measured value
sdata (tblsearch "dimstyle" (cdr (assoc 3 ddata))); Style's data
disp ; displayed value
(if (member '(1 . "") ddata); no override of content?
(rtos mea ; then -- measured distance as [if] rounded in display
(cdr (assoc 270 sdata)); mode
(cdr (assoc 271 sdata)); precision
); rtos
(cdr (assoc 1 ddata)); else -- use override value
;; [Assumes override is distance-type content only, and in
;; correct format; does not account for override in higher
;; precision than in Style's setting!]
); if & disp
prec (max (cond (prec) (1)) (cdr (assoc 271 sdata)))
;; highest precision of all selected Dimensions' Styles
sum (+ sum (distof disp)); [decimal/real-number units]
); setq
); repeat
(prompt
(strcat
"\nSum of displayed distances = "
(rtos sum (getvar 'lunits) prec)
;; Assumes all selected Dimensions' Styles use same units mode
;; as drawing's LUNITS setting [otherwise, how to express sum?].
;; Uses highest precision of selected Dimensions' Styles, in case
;; any are higher than drawing's Units precision setting.
"."
); strcat
); prompt
); progn
(prompt "\nNo Dimensions selected."); else
); if
(princ)
); defun
On the question of override text content that's of higher precision than the Style's setting, it might be possible to determine that an override is that way [e.g. the Style's roundoff value is 1/2" but you override it with something ending with quarters or eighths or sixteenths of inches]. Currently, such an override would be added into the sum correctly, but if no Style's roundoff level is that precise, the result will be rounded to the tightest Style roundoff value, which will round off that override's contribution. If you only do overrides to a coarser value than the Style's roundoff, as in your example of taking 13/16" to 3/4", it doesn't matter.
Kent Cooper, AIA