@dbaldzhiev wrote:
I am looking for a way to prefix all text styles in a drawing with the name of the drawing using a script that runs on accoreconsole. Does the RENAME command take only exact matches - I cannot rename all with it from the command line.
RENAME in the dialog box, but apparently not in the command-line version, accepts wildcards. [But it's risky -- if I put in * for the old name, and TEST* for the new, it manages somehow to rename even the Standard Style -- which you're not supposed to be able to Rename -- as TESTStandard.]
Here's an AutoLisp approach that seems to work in minimal testing:
(defun C:SPDN (/ s-entry s-name s-data); = Style Prefixed with Drawing Name
(while (setq s-entry (tblnext "style" (not s-entry)))
(setq
s-name (cdr (assoc 2 s-entry))
s-data (entget (tblobjname "style" s-name))
); setq
(if (/= s-name "Standard"); leave that one alone
(entmod
(subst
(cons 2 (strcat (substr (getvar 'dwgname) 1 (- (strlen (getvar 'dwgname)) 4)) s-name))
(assoc 2 s-data)
s-data
); subst
); entmod
); if
); while
(princ)
); defun
I haven't worked with ACCORECONSOLE, but I assume you could have that Load such a routine from a .lsp file and then run it.
Kent Cooper, AIA