Attribute Replacement

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

  1. Biscuits

    Biscuits Guest

    Thought I better re-post on this discussion group. The following is a simple routine I use to replace an attributed drawing revision. I would like to replace the line of code asking for the "OLD REVISION LETTER" with a line of code that does'nt care what the old revision letter might be and therefore reduce user input. Any ideas? Thanks.

    (defun C:REVUP (/ REVCUR REVNEW)
    (setq REVCUR (getstring "\nOLD REVISION LETTER: "))
    (setq REVNEW (getstring "\nNEW REVISION LETTER: "))
    (command "-ATTEDIT" "N" "N" "DWGATT*" "REV" "" REVCUR REVNEW)
    (gc)
    (princ)

    )
     
    Biscuits, Apr 22, 2004
    #1
  2. Biscuits

    zeha Guest

    Try this

    (defun SetAttribute (ent lst / BlkEnt)
    (setq BlkEnt (vlax-ename->vla-object ent))
    (mapcar
    '(lambda (att)
    (if (wcmatch (vla-get-tagstring att)(car lst))
    (vla-put-textstring att (cadr lst))
    )
    )
    (vlax-safearray->list
    (vlax-variant-value
    (vla-getAttributes BlkEnt)
    )
    )
    )
    (vla-update BlkEnt)
    )
    ;------------------------------
    (defun C:RevUp (/ i ss)
    (vl-load-com)
    (if (setq i 0 ss (ssget '((-4 . "<AND")(0 . "INSERT")(66 . 1)(-4 . "AND>"))))
    (while (> (sslength ss) i) (SetAttribute (ssname ss i)(list "DWGATT*" "YourRevision"))(setq i (1+ i)))
    )
    (princ)
    )
    ;------------------------------
    (defun C:RevUpAll (/ i ss)
    (vl-load-com)
    (if (setq i 0 ss (ssget "x" '((-4 . "<AND")(0 . "INSERT")(66 . 1)(-4 . "AND>"))))
    (while (> (sslength ss) i) (SetAttribute (ssname ss i)(list "DWGATT*" "YourRevision"))(setq i (1+ i)))
    )
    (princ)
    )
     
    zeha, Apr 23, 2004
    #2
  3. Biscuits

    Biscuits Guest

    Thanks for your efforts. Not sure what to do with all of this. II saved it as a file by itself, loaded it an executed RevUp,and RevUpAll. I got the following error message "error: no function definition: VLA-GETA". Am I to modify anything or add to the old routine? I did forget to mention I'm using 2002.
     
    Biscuits, Apr 23, 2004
    #3
  4. Biscuits

    ECCAD Guest

    Try taking the 'space' out of:
    (vla-getA ttributes BlkEnt)
    ..and move the A over to right.

    (vla-get Attributes BlkEnt)

    Bob
     
    ECCAD, Apr 23, 2004
    #4
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.