Ok, here is version 1.1
You edit the text override, removing the text to keep.
Note that the remaining text after editing must be a match to existing.
Like "11'1\" %%p*" can be edited to "%%p*" and "%%p*" will be removed.
But "SEE TABLE A1" edited to "SEE A1" will not work because there is no
match.
The work around is this:
you may do this "SEE TABLE A1" --> "SEE "
and then "SEE TABLE A1" --> " A1"
leaving TABLE
PS one problem with ddedit. If you hit Escape it returns you to the routine
and the complete text override is deleted. Is there a way to tell if it was
exited via escape vs enter?
;;; DimTextDel.lsp by Charles Alan Butler
;;; Copyright 2004
;;; by Precision Drafting & Design All Rights Reserved.
;;; Contact at ab2draft@TampaBay.rr.com
;;;
;;; Version 1.0 Beta June 10,2004
;;; Version 1.1 Beta June 10,2004
;;; Added edit of text override to remove
;;;
;;; DESCRIPTION
;;; User picks dimension with text override and routine deletes
;;; all overide text overrides in dims with matching override
;;;
;;;
;;; Limitations
;;; Text edit is limited, remaining text must be unbroken
;;; "11'1\" %%p*" --> "%%p*" is OK
;;; "SEE TABLE A1" --> "SEE A1" will fail to match
;;; you may do this "SEE TABLE A1" --> "SEE "
;;;
;;;
;;; Command Line Usage
;;; Command: dimtextdel
;;; Select Dimension with Text to remove.
;;;
;;;
;;; THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED
;;; WARRANTY. ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR
;;; PURPOSE AND OF MERCHANTABILITY ARE HEREBY DISCLAIMED.
;;; ;
;;; You are hereby granted permission to use, copy and modify this ;
;;; software without charge, provided you do so exclusively for ;
;;; your own use or for use by others in your organization in the ;
;;; performance of their normal duties, and provided further that ;
;;; the above copyright notice appears in all copies and both that ;
;;; copyright notice and the limited warranty and restricted rights ;
;;; notice appear in all supporting documentation. ;
(defun c:dimtextdel (/ str ss dm ovrtxt repltxt txt)
;; =============== ERROR ROUTINE =================
(defun *error* (msg)
(if
(not
(member
msg
'("console break" "Function cancelled" "quit / exit abort" "")
)
)
(princ (strcat "\nError: " msg))
) ; if
(setvar "CMDECHO" usercmd)
(if txt
(progn
(entdel txt)
(setq txt nil)
)
)
(princ)
) ;
;end error function
;;; =================================================================
;;; Main Routine
;;; =================================================================
(setq usercmd (getvar "CMDECHO"))
(setvar "CMDECHO" 0)
(vl-load-com)
(if (setq dm (entsel "\nSelect Dimension with Text to remove."))
(progn
(setq doc (vla-get-activedocument (vlax-get-acad-object)))
(setq dm (vlax-ename->vla-object (car dm)))
(if (wcmatch (vla-get-objectname dm) "*Dimension")
(if (/= (setq ovrtxt (vla-get-textoverride dm)) "")
(progn
(if (entmake (list '(0 . "TEXT")
(cons 10 '(0 0))
(cons 40 (getvar "TEXTSIZE"))
(cons 7 (getvar "TEXTSTYLE"))
(cons 1 ovrtxt) ; Text String
)
)
(setq txt (entlast))
(quit)
) ; endif
(prompt
"\nDelete the text you want to keep or press Enter to delete all."
)
(command "._ddedit" txt "")
(setq repltxt (cdr (assoc 1 (entget txt))))
(entdel txt)
(setq txt nil)
(vla-startundomark doc)
(and
(ssget "X" '((0 . "*DIM*"))) ;get all dimension objects
(setq ss (vla-get-activeselectionset
(vla-get-activedocument
(vlax-get-acad-object)
)
)
) ;use ActiveX ss
(vlax-for x ss
(if (= (setq str (vla-get-textoverride x)) ovrtxt)
(vla-put-textoverride
x
(vl-string-subst "" repltxt ovrtxt)
)
)
)
) ; and
(vla-endundomark doc)
) ; progn
(alert "\n\tNo Text Override in Dimension\t")
)
(alert "\n\tNot a Dimension\t")
)
)
)
(princ) ;exit quietly
)
(prompt
"\nDimension Text Delete loaded, enter dimtextdel to run."
)
(princ)