ATTEDIT PROBLEM: how to enter text with spaces?

Dear forum members,

To enter a space in the ATTEDIT command you cannot use the spacebar (=ENTER). In the command history below I have used ALT+0160 (=hard space) in the new text. The problem is of course that if I then insert a new block and give one of the atributes the value "33 33", using a normal space (=ALT+0032), the text will look the same, but in fact be different from the "hard space" variant. So my question is how do you enter a normal space in the ATTEDIT command?

: ATTEDIT
Edit attributes one at a time? <Y> N
Global edit of attribute values.
Edit only attributes visible on screen? <Y> N
Edit attributes of which blocks? <*>:
Edit attributes with these names <*>:
Edit attributes with this text <*>: 33
6 attributes were selected.
Text to change: 33
New text: 33 33

Regards, Roy.

Please note: I use BC7.

Comments

  • I always had trouble with that Acad cryptic method of editing attributes, spaces were just one problem.

    I can't remember if Icad always had the pop-up att editor, does yours do it if you double click on the block/attribute? Newer versions open the popup ready at the attribute selected which is really neat when there are multiple attributes in a block. From memory older versions only read the first attribute without regard for multiple att's in a block.

    When I have more than one instance of the same expression as attributes to change, I use this lisp. I enter the old and the new texts as text on the screen, run the lisp and pick the old then the new and it changes all the attributes with that text. It accepts spaces from the text expressions.

    Sounds cumbersome, but the new and old texts are usually on the screen in a list anyway from another lisp I use to list all attributes.

    I can post the other lisp, but it only works for 2 maybe 3 attribute blocks.

    (DEFUN c:CHATT (/ a b c d)
    (SETVAR "CMDECHO" 0)
    (setq a (car (entsel "\nPick Old Text: ")))
    (setq b (car (entsel "\nPick New Text: ")))
    (setq c (cdr (assoc 1 (entget a))))
    (setq d (cdr (assoc 1 (entget b))))
    (if (/= c d)(command "attedit" "n" "n" "" "" "" c d))
    (command "change" a "" "" "" "" "" "" d)
    )

  • Thank you John.

    I was hoping there would be a special key-combination (e.g.: Shift+Spacebar) to enter a normal space in the attedit command.

    I've reworked your lisp into this:

    (defun c:ChAtt ( / oldCmdecho)
    (setq oldCmdecho (getvar "cmdecho"))
    (setvar "cmdecho" 0)
    (command
    "_.attedit" "_no" "_no" "*" "*" "*"
    (getstring T "\nOld text: ")
    (getstring T "\nNew text: ")
    )
    (setvar "cmdecho" oldCmdecho)
    (princ)
    )

    Regards, Roy.

  • I guess you could reduce the first getstring operation to pick out the attribute from the the entget'd block, but couldn't control which attribute would come up when there was more than one.

    Some clown with too much time sent a title block with 117 attributes they wanted used in their job, which would be a nightmare without the popup.

  • The popup editor in BC7 is "_ddatte" if this is what you're after. It only lets you

    edit one attibute in one block at a time though. But you can easily navigate through all

    attributes with the up+down arrow keys.

  • John: using nentsel you can select an attribute belonging to a block. See ChAttP:

     

    (defun c:ChAttP ( / loopSwitch input entName entLst oldLstItem newLstItem)
    ;;; Change attribute text by picking attribute
    (setq loopSwitch T)
    (while loopSwitch
    (initget "Quit")
    (if (= (setq input (nentsel "Select attribute to change or [Q] to quit: ")) "Quit")
    (setq loopSwitch nil)
    )
    (if
    (and
    loopSwitch
    (setq entName (car input))
    (setq entLst (entget entName))
    (= (cdr (assoc 0 entLst)) "ATTRIB")
    )
    (progn
    (setq oldLstItem (assoc 1 entLst))
    (setq newLstItem (cons 1 (getstring T (strcat "\nOld text: " (cdr oldLstItem) "\nNew text: "))))
    (entmod (subst newLstItem oldLstItem entLst))
    ;; (entupd entName) ; This doesn't seem to work ...
    (command "regen") ; So let's do this. But this may take a long time ...
    )
    (princ "\nNot an attribute, try again: ")
    )
    )
    (princ)
    )

     

    Note: I couldn't get entupd to work so instead a regen is performed every time an attribute is changed. This may take a long time in big drawings.

    Regards, Roy.

     

  • Improved version of ChAttP:

    (defun c:ChAttP ( / loopSwitch input entName entLst oldLstItem newLstItem)
    ;;; Change attribute text by picking attribute
    (setq loopSwitch T)
    (while loopSwitch
    (initget "Quit")
    (if (= (setq input (nentsel "\nSelect attribute to change or [Q] to quit: ")) "Quit")
    (setq loopSwitch nil)
    (progn
    (if
    (and
    (setq entName (car input))
    (setq entLst (entget entName))
    (= (cdr (assoc 0 entLst)) "ATTRIB")
    )
    (progn
    (setq oldLstItem (assoc 1 entLst))
    (setq newLstItem (cons 1 (getstring T (strcat "\nOld text: " (cdr oldLstItem) "\nNew text: "))))
    (entmod (subst newLstItem oldLstItem entLst))
    ;; (entupd entName) ; This doesn't seem to work ...
    (command "regen") ; So let's do this. But this may take a long time ...
    )
    (princ "\nNot an attribute, try again: ")
    )
    )
    )
    )
    (princ)
    )
  • That's neat (I had never used nentsel), but with v9 I can double click on the attribute and achieve the same thing.

    For this and many other improvements V9 is definitely worth the upgrade for my money.

    When I place my blocks for indicating (air diffusion) items I enter an abbreviated description in their first attribute field.

    That description will become an item number in the schedule, like D1, D2, D3.

    I run my listing lisp which prints all attributes to a list on screen as text, then run a second lisp which counts multiple occurrences of the same expression making a second list showing each different expression once with a quantity beside it.

    Then I create the schedule based on the abbreviated descriptions and finally use CHATT to change all the attributes to match the schedule numbers.

    So CHATT is useful for me in its form. It's all I use it for, but automating schedules is a big saver for me. I'm always amazed so few seem to pursue it as being worth the effort.

This discussion has been closed.