Referring back to a post I made in the "Show Yer Stuff" forum, here's a generic function that applies a function across all objects in a selection set
(defun ent:SSObjApply (fun ss / i)
;|Description:
Process a function on each vla-object in a selection set.
Example:
(ent:SSObjApply '(lambda (VlaObj) (..Do sonething to VlaObj...)) ss)
|;
(setq i -1)
(if (= 'PICKSET (type ss))
(repeat (fix (sslength ss))
(apply fun
(list
(vlax-ename->vla-object
(ssname ss (setq i (1+ i)))
)
)
)
)
)
)
It's kind of like a foreach for selection sets. Implementing it in a "EQ." macro, you simply do this:
(defun c:EQ ()
;|Description:
Replace dimension text with "EQ."
|;
(prompt "\nEQ. Dimension.")
(ent:SSObjApply
'(lambda (DimObj)
(vla-put-TextOverride DimObj "EQ.")
)
(ssget '((0 . "DIMENSION")))
)
(princ)
)
I like this approach because it filters for Dimensions in the selection set process. Using a simpler macro would mean it would error out if you didn't pick the right kind of entity.
Alaso, using the generic function in this way, it's very easy to write tens of macros using almost the same code.