Modify attribute

Discussion in 'AutoCAD' started by Jim, Oct 28, 2003.

  1. Jim

    Jim Guest

    I want to change the value of an attribute, in a block with attributes
    throught a autolisp routine
    I tried the commands subst, entupd and entmod but the entity not didn't
    change.
    what wrong?

    Dimitris
     
    Jim, Oct 28, 2003
    #1
  2. Post the code, but in the mean time, did you REGEN?
     
    Michael Bulatovich, Oct 28, 2003
    #2
  3. Jim

    Jim Guest

    Thank you for answering
    I tried and it works

    This routine adds the string "N" to an attribute of selected blocks named
    "ajonb"

    Is the line (entupd blo) necessary ?
    It seems to works with or without this command

    ;;;AL-AJONB.LSP
    ;;;
    (defun c:al-ajonb ()
    (setq oldecho (getvar "cmdecho"))
    (setq oldlay (getvar "clayer"))
    (setvar "cmdecho" 0)
    (While
    (setq blo(car(entsel "\Pick block for change..:")))
    (if (or (= (cdr (assoc 2 (entget blo))) "ajonb")
    (= (cdr (assoc 2 (entget blo))) "AJONB")
    )
    (progn
    (entmod
    (subst (cons 1 "N") (assoc 1 (entget(entnext(entnext blo))))
    (entget(entnext(entnext blo))))
    )
    (entupd blo)
    );;;end progn
    );;;end if
    );;;end while
    (command "layer" "s" oldlay "")
    (setvar "cmdecho" oldecho)
    );;;end defun
     
    Jim, Oct 29, 2003
    #3
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.