I am busy to write a lisp routine that changes the style of text, mtext or attdef in a block.
When I have a drawing with a lot of blocks, I have to edit them all with command bedit. One for one the command bedit and change (block redefine) the properties style of text, mtext or attribute defenitions (attdef). I would like to change that to a specific text font style
I call the font as PRE DEFINED STYLE, for example ARIAL, loaded arial.shx
I really dont know if this good runs, that's where some of you should be able to help.
Hope to get some advice soon.
Thanks in advance!
Here is my lisp code:
#CODE
;;;; STYLE-EDIT-IN-BLOCK-EDITOR.LSP - AutoCAD lisp routine that changes the text font style in blocks of ATTDEF TEXT MTEXT
;;;; Start this routine with AutoCAD commando: stupdblk
(defun err-ubc (s)
(if (/= s "Function cancelled")
(princ (strcat "\nError: " s))
)
(setq *error* olderr)
(princ)
)
(DEFUN C:STUPDBLK (/ BLK CBL CBL2 C AST ALY NLY NST)
(graphscr)
(setq olderr *error* *error* err-ubc)
(initget "?")
(while
(or (eq (setq C (getint "\nType new Style code/<?>: ")) "?")
(null C)
(> C 1)
(< C 0)
)
(textscr)
(princ "\n ")
(princ "\n Style code | Style name ")
(princ "\n ________________|_________________________ ")
(princ "\n | ")
(princ "\n 0 | Standard ")
(princ "\n 1 | ISO ")
(princ "\n 2 | PRE DEFINED STYLE ")
(princ "\n \n\n\n")
(initget "?")
)
(prompt "\nSelect blocks: ")
(SETQ SS (SSGET '((0 . "INSERT"))))
(SETQ K 0)
(WHILE (< K (SSLENGTH SS))
(setq CBL (tblsearch "BLOCK" (CDR (ASSOC 2 (ENTGET (SETQ BLK (SSNAME SS K)))))))
(SETQ CBL2 (CDR (ASSOC -2 CBL)))
(WHILE (BOUNDP 'CBL2)
(SETQ EE (ENTGET CBL2))
(SETQ NST (CONS 74 C))
(SETQ AST (ASSOC 74 EE))
(IF (= AST nil)
(SETQ NEWE (APPEND EE (LIST NST)))
(SETQ NEWE (SUBST NST AST EE))
)
(ENTMOD NEWE)
(SETQ CBL2 (ENTNEXT CBL2))
)
(ENTUPD BLK)
(SETQ K (1+ K))
)
(setq *error* olderr)
(princ)
)
(princ "\nSTYLE-EDIT-IN-BLOCK-EDITOR.LSP - AutoCAD lisp routine that changes the text font style in blocks of ATTDEF TEXT MTEXT.")
(princ "\nStart this routine with AutoCAD commando: stupdblk")
(princ)