_attedit command behavior

When using _attedit in acad,   the specific attribute is picked.   In bricscad it picks all of the attributes.    I have a routine that I use to change colors, values, layers, styles etc on attributes.   In acad it works with blocks having any number of attributes,  doing the modification only to the specific attribute picked.   

The Bricscad mod below works on the 1st attribute only,  no matter which one is picked.

Any ideas ?
Thanks,   Jay

ORIGINAL ACAD SUBROUTINE:
(WHILE ent (setq ent (entsel (strcat "\nPick Attribute to " stringmod "     ")) )
    (if ent
        (if (eq ch "Replace") (command "attedit" "" "" "" "" (cadr ent) "" "V" "r" string2 "")
            (if (eq ch "Delete") (command "attedit" "" "" "" "" (cadr ent) "" "v" "r" "" "")
            (command "attedit" "" "" "" "" (cadr ent) "" string1 string2 "")
         )
     )
 )    


BRICSCAD MOD
(if (eq ch "Delete")(setq stringmod ch)(setq stringmod (strcat "change " string1 " to " string2)))
  (if (eq ch "Replace")(setq stringmod (strcat "Replace current value with text \"" string2 "\""))     )
  (WHILE ent (setq ent (entsel (strcat "\nPick Attribute to " stringmod "     ")) )
    (if ent
        (if (eq ch "Replace") (command "attedit" "" "" "" "" (cadr ent) "V" "r" string2 "q")
            (if (eq ch "Delete") (command "attedit" "" "" "" "" (cadr ent) "v" "r" " " "q")
            (command "attedit" "" "" "" "" (cadr ent) string1 string2 "q") ) ) ) )

Comments

  • If you avoid the attedit command you will avoid this problem and make your code more reliable.
    [code](while (setq ent (car (nentsel (strcat "\nPick Attribute: "))))
      (setq obj (vlax-ename->vla-object ent))
      (if (= (vla-get-objectname obj) "AcDbAttribute")
        (progn
          (vla-put-color obj 1)
          (vla-put-layer obj "0")
          (vla-put-height obj 1.0)
          (vla-put-stylename obj "Standard")
          (vla-put-textstring obj "ABC")
        )
        (princ "\nNot an attribute. Try again: ")
      )
    )[/code]
  • Thanks Roy,   I added in the command for rotation as well.  I will look into all these additional acad commands,

    Jay
This discussion has been closed.