Need a book? Engineering books recommendations...

Return to index: [Subject] [Thread] [Date] [Author]

RE: ACAD Attribute ?

[Subject Prev][Subject Next][Thread Prev][Thread Next]
John:

> What I would like to be able to do is the following:
>1.  Have a script open a file.
>2.  select a particular block to edit the attributes (ddatte)
>3.  change value of a particular attribute
>4.  save changes
>5.  continue to next dwg file.

DDATTE isn't going to work because it opens a dialog box, and scripts can't respond to or control dialog boxes. Even if you managed to tell your script to pick the appropriate block, the script would just stall once the Edit Attributes dialog popped up.

What you want to use instead is the ATTEDIT command (the command line version of DDATTE, which also includes some global editing features). Here's a script that changes all instances of string 11-FEB-1999 to 26-FEB-1999 in attributes contained in the block insert named TB:

----------
;;;ChangeAtt.scr: Script to replace an attribute value
;;;by Mark Middlebrook  26-Feb-1999
_.ATTEDIT
;;Edit attributes one at a time? <Y>
_No
;;Edit only attributes visible on screen? <Y>
_No
;;Block name specification <*>:
TB
;;Attribute tag specification <*>:

;;Attribute value specification <*>:

;;String to change:
11-FEB-1999
;;New string:
26-FEB-1999
----------

The lines beginning with semi-colons are comments, to show the prompts that the script is responding to.

There are other ways to do it with AutoLISP, but this script approach should work just fine for what you're trying to do.

- Mark Middlebrook