Jump to content

-ATTIPEDIT and DDEDIT


Freerefill

Recommended Posts

I like typing "ED" to activate the DDEDIT function, since it saves me some double-clicking, and I can usually type the command as my cursor is on the way to the text I need to edit. I made a LISP (yeah, I know, I could have changed the acad.pgp file or made a macro..) which is basically:

 

(defun c:at() (command "attipedit"))

 

so I can type "AT" in order to do the same thing as DDEDIT, only for block attributes.

 

The problem is twofold. DDEDIT performs in a sort of loop, once you're done editing one, it lets you edit another. ATTIPEDIT does not allow that. Is there any way to put it into a loop in order to match the functionality?

 

The other fold is that I occasionally type "AT" then click on a regular text object, causing AutoCAD to think I'm a bloody idiot and promptly reminding me of that fact. So, is there any way to combine the two into a singular command? I'm sure I could do it myself if I had some place to start, but I can't figure out the type of selection that ATTIPEDIT has.. somehow, it can activate an attribute without bringing up the dialog box. Also, I did try to put it into a loop, but again, I couldn't figure out how.

 

Any ideas?

Link to comment
Share on other sites

I don't have -attipedit on '04, but if its anything like ddedit, then maybe:

 

[b][color=RED]([/color][/b][b][color=BLUE]defun[/color][/b] c:ed2 [b][color=RED]([/color][/b][b][color=BLUE]/[/color][/b] ent[b][color=RED])[/color][/b]
 [b][color=RED]([/color][/b][b][color=BLUE]while[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]setq[/color][/b] ent [b][color=RED]([/color][/b][b][color=BLUE]nentsel[/color][/b] [b][color=#ff00ff]"\nSelect Object: "[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b]
   [b][color=RED]([/color][/b][b][color=BLUE]cond[/color][/b] [b][color=RED]([/color][/b][b][color=RED]([/color][/b][b][color=BLUE]wcmatch[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]cdadr[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]entget[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]car[/color][/b] ent[b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b] [b][color=#ff00ff]"*TEXT"[/color][/b][b][color=RED])[/color][/b]
          [b][color=RED]([/color][/b][b][color=BLUE]command[/color][/b] [b][color=#ff00ff]"DDEDIT"[/color][/b] ent pause[b][color=RED])[/color][/b][b][color=RED])[/color][/b]
         [b][color=RED]([/color][/b][b][color=RED]([/color][/b][b][color=BLUE]eq[/color][/b] [b][color=#ff00ff]"ATTRIB"[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]cdadr[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]entget[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]car[/color][/b] ent[b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b]
          [b][color=RED]([/color][/b][b][color=BLUE]command[/color][/b] [b][color=#ff00ff]"-ATTIPEDIT"[/color][/b] ent pause[b][color=RED])[/color][/b][b][color=RED])[/color][/b]
         [b][color=RED]([/color][/b][b][color=BLUE]T[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]princ[/color][/b] [b][color=#ff00ff]"\nInvalid Object Type... try again."[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b]
 [b][color=RED]([/color][/b][b][color=BLUE]princ[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b]

Link to comment
Share on other sites

Unfortunately, that won't work. I don't think you can pass an entity to ATTIPEDIT (but I'll give it a check). In fact, I have no idea how the selection works. To give you an idea, when you run the command, it asks you to select an entity, just like DDEDIT. You click on a block attribute, and the in-place text editor appears, exactly as if you had just double-clicked a text entity. You can then type what you wish, exactly as if you were editing regular text, and when you click off or hit 'Enter', the attribute is changed.. but unlike DDEDIT, you're back to the Command prompt and it doesn't ask you to select another one.

 

Clicking on a block selects the block, not the attribute. Because of that, I don't know how to pass that single attribute to ATTIPEDIT, short of getting all the attributes for the block and somehow finding the extents of every piece of text and checking to see if the clicked point is within one of them... but that seems like an awful lot of work to me.

 

I suppose if I have to, I'll do it. Just seems like there's a better way...

Link to comment
Share on other sites

Alright, got the loop to work.. thanks again, Lee, you inspire without realizing it.

 

(defun c:at()
 (while t (command "attipedit" pause))
 )

One down, one to go.

 

EDIT: Just checked, (command "attipedit" (entnext(car(entsel)))) didn't work, when I clicked on a block with editable attributes. In fact, it just nilled out completely. I'll keep playing with it.

Link to comment
Share on other sites

o.o "Nentsel" is a new one to me.. *rushes to play with it*

 

Fantastic command - gives you much more access to sub-entities straight off.

 

With that in mind, did my function work at all?

 

If you really want to get info - take a look at nentselp :D

Link to comment
Share on other sites

Alas, Lee, your function didn't work, nor did mine when I tried to build it from scratch, or modify yours. It seems that DDEDIT and ATTIPEDIT won't accept an entity.. when you call the function, it prompts to select an entity no matter what, and it just gets vastly messed up from there. I can't even figure out what's going wrong, but it must be something related to those functions, because everything else (the entity selection, the condition statement) worked flawlessly.

 

Here's what I ended up with:

 

(defun c:ed2( / ent)
 (while T
   (setq ent (car (nentsel "\nSelect entity: ")))
   (if ent
     (cond
       ((wcmatch (cdadr (entget ent)) "*TEXT")
        (command "ddedit" ent)(command)
        )
       ((eq (cdadr (entget ent)) "ATTRIB")
        (command "attipedit" pause)(command)
        )
   )
     )
   )
 (princ)
 )

 

I changed the while loop to continue no matter what, because short of setting up a (grread), that's as close as I could get it to the same functionality as DDEDIT. I usually just mash ESC anyway.

 

As for the seemingly extraneous (command)s, I put them there because that's a helpful way of cancelling a command. Not sure if there's a "cleaner" way, but that's the way that works for me. I've actually used it several times, to my advantage...

 

I really have no idea what's going on. I can't seem to isolate the error.

 

Is there any way to bring up the In-Place Text Editor on command, outside of DDEDIT? If not, the only thing I could think would be to get the entity and modify the text string with Virtual LISP or (entmod), entering the string on the command line.. which I can do, but isn't exactly what I was going for. ^^'

Link to comment
Share on other sites

  • 14 years later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...