Although you do not really need a LISP routine to accomplish this task (as seen in THIS post). This particular routine is great because it also has an extra option to clear existing text overrides.
I use this routine to easily add text to show underneath dimensions and also to remove text overrides from dimensions.
- DTOR <enter> to start
- Select Dimensions to have the text overrides applied to (can be multiple)
- Enter the text that you’d like to show: in this example, I used <>\XTYP. to show “TYP.” underneath the dimension.
- <> lets you keep the actual measured dimension
- \X starts a new line of text underneath the actual dimension
- TYP. that is right next to the “\X” is the text to be displayed in the new line
The below animation shows how to add text:
The below animation shows how to remove text overrides:
I do not remember where this routine came from or who wrote it. I think that Alan Thompson wrote it but I am not certain.
(defun c:DTOR () (c:DimTextOverride)) (defun c:DimTextOverride ( / ss textString) (princ "\rDIMENSION TEXT OVERRIDE ") (vl-load-com) (if (and (setq ss (ssget '((0 . "DIMENSION")))) (setq textString (getstring T "\nEnter override text, <Enter> to remove override: "))) (progn (vla-startundomark (cond (*activeDoc*) ((setq *activeDoc* (vla-get-activedocument (vlax-get-acad-object)))))) (vlax-for oDim (setq ss (vla-get-activeselectionset *activeDoc*)) (vla-put-textoverride oDim textString)) (vla-delete ss) (vla-endundomark *activeDoc*)) (prompt "\n** Nothing selected ** ")) (princ))