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.
Here’s how:
- 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))
Thank you!
It works
How would you use this if the override text is always the same (ex: TYP) and simply wanted to insert it directly without receiving a prompt?
Try the code below:
;;; Use CDA in the command line after loadingC
;;; Change Dimension Values to “TYP”
;;; (c) 2001 Andy Leisk
;;; Modified by Greg Battin to insert TYP in to dimension
(defun C:CDA (/ ss)
(princ “Select Dimensions to say TYP…\n”)
(setq ss (ssget))
(command “.DIM1” “NEW” “TYP” ss “”)
(princ)
)
(princ)
Perfect! Thanks.
I like that it has the drag select option, instead of the single select, like this one:
(defun c:T1 ( / edim)
(vl-load-com)
(setq edim (vlax-ename->vla-object (car (entsel “\Select dimension to replace value”))) )
(vla-put-TextOverride edim ” (TOL.)”)
(princ)
)
Original found here: http://forums.augi.com/showthread.php?129908-Text-Override-in-Dimension
Slight mod to yours:
(command “.DIM1” “NEW” ” TYP” ss “”)
How would you change the format of the dim to decimal in the same command?
Got it. Thanks for the help.
(defun C:T1 (/ ss)
(princ “Select Dimensions to say TOL …\n”)
(setq ss (ssget))
(command “.DIM1” “NEW” ” (TOL.)” ss “”)
(command “DIMOVERRIDE” “DIMUNIT” “2” “” ss “”)
(princ)
)
Cool – glad you got it to work for you
~Greg
It came from: http://forums.augi.com/showthread.php?129908-Text-Override-in-Dimension&p=1127422&viewfull=1#post1127422