Global Text Style Change F1

Discussion in 'AutoCAD' started by akdrafter, Apr 22, 2004.

  1. akdrafter

    Rudy Tovar Guest

    Tell you what, since you do know how to code.

    I'll start it for you...all you have to do is finish it, oh, and don't
    forget to access each individual block reference except for the external
    references, this can be accomplished by looping through the sub-entities.

    (defun SX ( sy / ss cn sn en ty nd)
    (setq ss (ssget "x"))
    (if
    ss
    (progn
    (setq cn 0)
    (while (setq sn (ssname ss cn))
    (progn
    (setq en (entget sn)
    ty (cdr (assoc 0 en))
    )
    (if (= ty "TEXT")
    (progn
    (entmod (subst (cons 7 sy)(assoc 7 en) en))
    )
    )
    (setq cn (1+ cn))
    )
    )
    )
    ); end of if ss
    (princ)
    )
    --

    AUTODESK
    Authorized Developer
    htt://www.Cadentity.com
    MASi


    chair from in front of your desk, stand up, walk outside and take a deep
    breath. Then, take another deep breath. Now, feel better?
    at all. It was a simple question and request for something that someone
    probably already has. Why try and re-invent the wheel when the wheel works.
    I am not asking for someone to write some super intelligent program to do
    every bit of work there is for me to do. I have personally been learning
    from the fine folks in these newsgroups that are more than willing to help
    someone out without the attitude. I don't have money or time to spend at
    some overpriced school learning programming and to be honest, I don't want
    to. When I leave work my life begins and work is the farthest thing from my
    mind. My work is not my life.
    anymore as I do NOT want your help. I do wish you well and I sincerely hope
    that life offers up all that is grand and wonderous.
     
    Rudy Tovar, Apr 23, 2004
    #21
  2. akdrafter

    ECCAD Guest

    Timothy,
    Sorry for coming down hard. Tony was just trying to help.
    You shot him in the foot. Not good.
    As far as the routine, yes, I wrote all of it. Don't know where
    you got that idea.. ?
    Fishing. I will take you up on that when I get to Alaska.
    Sorry las.

    Bob
     
    ECCAD, Apr 23, 2004
    #22
  3. akdrafter

    Phil Guest

    a couple of newby questions, you mean to loop thru all the block
    definitions, correct?
    And, is there a danger of changing external references. I don't
    normally have them and am very unfamiliar how they are handled in the
    db.

    TIA
     
    Phil, Apr 23, 2004
    #23
  4. akdrafter

    Rudy Tovar Guest

    Yes, you'd have to loop through all the block text and attributes, and
    mtext. this is exactly what he implied.

    To do a global style change, you'd have to process everything. It's not
    simply switching styles, since that's not going to get you much.

    Once again the following would be affected, text, mtext, attributes, and the
    text within nested blocks, etc.

    You could create a self-examining loop that would loop itself to capture
    each entity and any sub-entity.

    Here's an example.

    (defun c:scan (/ e da na ts ty nx la d1 d2)


    (setq e (entsel "\nSelect Xref: "))

    (if e
    (progn
    (setq da (entget (car e))
    na (cdr (assoc 2 da))
    ts (tblsearch "block" na)
    )
    (if ts
    (progn
    (if (assoc 1 ts)
    (setq da (entget (cdr (assoc -2 ts))))
    )
    (while da
    (progn
    (setq ty (cdr (assoc 0 da))
    la (cdr (assoc 8 da))
    en (cdr (assoc -1 da))
    )
    (if (and
    (= ty "LINE")
    (wcmatch la (strcat na "*|ARWALL"))
    )
    (progn
    (setq d1 (cdr (assoc 10 da))
    d2 (cdr (assoc 11 da))
    )
    (entmake (list (cons 0 "LINE")(cons 10 d1)(cons 11 d2)))

    )
    )
    ;;;;;;;;;;;;;;;;;;;;;;;;;;
    (if
    (= ty "INSERT")
    (progn
    (SCAN-next en)
    )
    )
    ;;;;;;;;;;;;;;;;;;;;;;;;;;
    (setq nx (entnext (cdr (assoc -1 da))))
    (if nx
    (setq da (entget nx))
    (setq da nil)
    )

    )
    ); end of while

    )
    )
    )
    )

    (princ)
    )

    (defun SCAN-next ( EN / e da na ts ty nx la d1 d2)


    (if EN
    (progn
    (setq da (entget EN)
    na (cdr (assoc 2 da))
    ts (tblNEXT "block" na)
    )
    (if ts
    (progn
    (if (assoc 1 ts)
    (setq da (entget (cdr (assoc -2 ts))))
    )
    (while da
    (progn
    (setq ty (cdr (assoc 0 da))
    la (cdr (assoc 8 da))
    en (cdr (assoc -1 da))
    )
    (if (and
    (= ty "LINE")
    (wcmatch la (strcat na "*|WALL"))
    )
    (progn
    (setq d1 (cdr (assoc 10 da))
    d2 (cdr (assoc 11 da))
    )
    (entmake (list (cons 0 "LINE")(cons 10 d1)(cons 11 d2)))

    )
    )
    ;;;;;;;;;;;;;;;;;;;;;;;;
    (if
    (and
    (= ty "INSERT")
    (not (assoc 66 da))
    )
    (progn
    (SCAN-next en)
    )
    )
    ;;;;;;;;;;;;;;;;;;;;;;;;

    (setq nx (entnext (cdr (assoc -1 da))))
    (if nx
    (setq da (entget nx))
    (setq da nil)
    )

    )
    ); end of while

    )
    )
    )
    )

    (princ)
    )

    He didn't mention any external files, but remember that he was going to
    process an entire directory, because the standards had changed.

    So if the entire office standard changed, then having to worry about
    external reference, wouldn't be a problem. I didn't mention to process them.
    My intent was to make him aware of filtering them out of what need to be
    processed. Those files would still be processed in the entire patch process.

    I posted an example of create a utility that would generate a script that
    could be used in conjunction with what he wanted to do. The lisp could
    easily be written to incorporate all of the the above, generate a script
    that would batch process the entire directory and run the utility to change
    all the text.
    --

    AUTODESK
    Authorized Developer
    htt://www.Cadentity.com
    MASi
     
    Rudy Tovar, Apr 23, 2004
    #24
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.