Hi, trying to create a script but I can't get it to do what I want.
Here's the deal:
Command: -ATTEDIT
Edit attributes one at a time? [Yes/No] <Y>: n
Performing global editing of attribute values.
Edit only attributes visible on screen? [Yes/No] <Y>: n
Drawing must be regenerated afterwards.
Enter block name specification <*>: A3_ram_A4stamp
Enter attribute tag specification <*>: PROJ_NAMN
Enter attribute value specification <*>: *
1 attributes selected.
Enter string to change:
Enter new string: Traneberg
Everything works so far, the problem is that I want Autocad to replace the old value, what Autocad does is add the new string to the old Value, for example. If the old value was "Adam" and I use the command the new value would be "TranebergAdam".
Is there anyway to get this command to replace the existing value?
Solved! Go to Solution.
Solved by steven-g. Go to Solution.
Why not enter the "string to change" instead of leaving it blank? Seems to be a command requirement.
The string to change differs from drawing to drawing.
I would like to use a wildcard match there but...
Change
Modifies a few characters of the attribute value.
Enter string to change: Enter string to change or press ENTER
Enter new string: Enter replacement string or press ENTER
Either string can be null. The ? and * characters are interpreted literally, not as wild-card characters.
Sorry, but at the commandline -ATTEDIT does not work that way, only as I noted.
Also note that EVERY instance of that block in the file also gets changed: might be fine if you have a one off block but disasterous if you do not.
Are you trying to automate some sort of FIND/REPLACE function in LT?
Exactly what I'm trying to do, recieved a documentation from a client that I have to edit.
It contains about 20 drawings and about 200 layouts.
The block I'm trying to change is the titleblock in each layout...
Here is where you slap someone for not XREFing in a titleblock 🙂
One edit, one fix, all 20 drawings/200 layouts.
See this old tip:
Right now I feel more like beating someones car with a crowbar rather then slapping.
Thanks for the tip but won't help my case =/
I've just been reading through the 2010 help online and it seems global editing can not do that.
If you edit each item individually you get a change/replace option.
Link to relevent section
Howard Walker
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
Yea I read that while trying to figure it all out, editting them one by one looses all the functionality I was trying to archieve.
If your attribute values contain capitals or special characters you will need to add to the script, it's longwinded but does the job. Change the extension to scr
EDIT I used the name 'three' for the attribute tag that will need changing to suit as well.
Hi Steven,
My Script does not differ from yours except I specify the block reference, problem is that Autocad won't replace the the current value, if you have an empty attribute the script works fine, but all my attributes to change already has a value that differs from layout to layout.
To change the existing Value I must specify the current value to change, that requires a "user input" which would destroy the whole idea with the script.
For this to work I need to somehow include in the script to first blank all the existing value and then assign new values, this I don't know how to archieve and I don't think it's even possible.
Thanks for your input.
Did you look at the script, it goes through and blanks out the old text one character at a time then writes in the new text, but as I said in the first post it only works for lower case and numbers at the moment. If you use special characters or upper case then you would need to add to the script
Steven haha, ingenious 😉
Didn't get it at first, clever use of the command there, it will be one hell of a long script but it will save me a tremendous amount of time.
My good sir, I salute you!
Great idea, once set up it would work quickly. We were looking at the idea of adding variables to our Batch program, I can see it been very useful in this situation. That way you would not have to change the Tag name in the script just change the variable value.
The one good thing is we can combine scripts at run time, this allows you to have the main script to blank the attribute value and a separate script routine to change the attribute value.
Once again great idea.
Patrick
http://www.multi-batch.com/
For your entire batch processing needs
A thank you from me too!
I have been searching long and hard for a solution to the same problem as experienced by @AcadAdamLT with no answer. The problem is simply that Autodesk haven't provided for a wildcard in the 'change' and that with 'replace' you have to physically select each and every instance, rendering the idea of automation obsolete.
Nevertheless, your solution allows one to clear the attribute values in order to re-populate them.
I hope you don't mind, but I rewrote your script to use the lisp function "command" to write all parameters on a single line.
I hope this is not at the expense of performance, but it does improve readability and shorten the text file, so that maybe someone in the future can understand it better and improve upon it (if so, dear stranger, please share!).
Please find my iteration attached.
(Side note: I used capital letters as per convention in our company, and some special characters I feel are common. Please add/remove and experiment with more. I did however, find a problem with the backslash "\" special character. This one causes the script to malfunction - probably because it is itself, an escape character for Unicode values.)
(Second side note: Please use with care and always save your work before running a script).
Just a quick update, since you are now using AutoCAD full and lisp you could check out the Gatte command which is available in AutoCAD, this allows you to change attribute values without knowing the value beforehand.
Below is how to run it in a script file:
;Update all blocks of NAME/Attribute with same value. This will replace existing Attributed Text
;Change for your needs
gatte
b
;Block Name
Titleblock
;Atrribute Name to change
DRAWNDATE
;Text to change attribute to.
3/05/07
Y
_regen
_qsave
Sometimes you will have a job where the block name is in separate parts, for example Title Block instead of TitleBlock, this will stop routines written outside lisp, an easy workaround is to rename the block first, then run the change attributes routine and then you can rename the block back.
;;Rename a block. Can also be used to rename Dimstyle/LAyer/LType/Style/Ucs/VIew/VPort
;
_rename
_block
;old block name
Title Block
;;new block name
TitleBlock
_qsave
Patrick
http://www.multi-batch.com/
For your entire batch processing needs