Results 1 to 2 of 2

Thread: Lisp routine that changes the text font style in blocks of ATTDEF TEXT MTEXT

  1. #1
    Member
    Join Date
    2010-01
    Posts
    5
    Login to Give a bone
    0

    Lightbulb Lisp routine that changes the text font style in blocks of ATTDEF TEXT MTEXT

    I am busy to write a lisp routine that changes the style of text, mtext or attdef in a block.
    I use AutoCAD 2011.
    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)
    Last edited by remcokoedoot; 2016-02-04 at 02:14 PM. Reason: CODE

  2. #2
    Certifiable AUGI Addict
    Join Date
    2001-03
    Location
    Tallahassee, FL
    Posts
    3,421
    Login to Give a bone
    0

    Default Re: Lisp routine that changes the text font style in blocks of ATTDEF TEXT MTEXT

    To post code click the [Go Advanced] button on the bottom-right. Then from the Toolbars click the # icon (Wrap [CODE] tags around selected text) and past you code in between the [CODE] tags. Otherwise it's hard to follow, similes may be added or characters may be changed.

    You'll get better response.
    Tom Beauford P.S.M. - Civil 2020 on Windows 10 Enterprise
    Design Analysis - Leon County Public Works/Engineering Wrap [CODE] tags around selected text
    2280 Miccosukee Rd. Tallahassee, FL 32308-5310
    Ph# (850)606-1516 Home Page

Similar Threads

  1. Force text style/font
    By donalcommane in forum AutoCAD LT - General
    Replies: 13
    Last Post: 2013-10-21, 09:12 PM
  2. 2013: Text Style...Font Preview like older versions possible?
    By bjack56 in forum AutoCAD General
    Replies: 2
    Last Post: 2013-07-18, 04:20 PM
  3. LISP from AEC-Curve Text to MText or Regular Text
    By BoarsNest01 in forum AutoLISP
    Replies: 7
    Last Post: 2010-06-03, 02:46 PM
  4. Text Style font change?
    By Mail106941 in forum AutoLISP
    Replies: 5
    Last Post: 2008-05-23, 06:11 PM
  5. Replies: 5
    Last Post: 2005-01-04, 07:19 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •