Script for batch change attribute value

Script for batch change attribute value

Anonymous
Not applicable
4,058 Views
5 Replies
Message 1 of 6

Script for batch change attribute value

Anonymous
Not applicable
Hello everybody
I would like to ask for some help in automating this as it would save me a lot of time and errors.

The problem:

We have a bunch of dwg files in a folder. We need to change the value of the attribute MyAttribute in the block MyBlock in all of the drawings.
So far, we have been using a lisp file to do this. It is saved as a STARTUP lisp and it contains an an Attedit, saves and closes. We launch Autocad, and in the open option we select to open all the drawings we want to modify, so, one after another, they are opened, modified and closed automatically. As we work with several patterns of Blocks and Attributes, we have already coded all Attedits we need in the .lsp and we simply comment/uncomment and modify the values to replace.
But now, we would like to make a script out of it so that it can be used in AutoCad LT.

My ideas:

Note that we have very basic lisp knowledge, and have never worked with scripts.

Obviously the first step is getting a scr file doing the attedit. I am working on it, and I feel it shouldn't be that hard. If someone could help with that it'll amazing, but I feel I can do this one.

But my problem comes here. Once the simple attedit is made, I can write a script that opens a file, performs the attedit, saves and closes. I know how to do this writing individually the complete path for all the files. This feels possible, but wouldn't fix my problem as it'll be extremely time consuming.

I've searched and found some lisp routines and add-ons that help writing scripts this way, but they're to be used as lisps in complete AutoCAD versions, so that wouldn't solve my issue.

Another idea I got from this forum was creating a for loop in a .bat file. I don't really know how it works, tbh. Other option I am thinking is to write a C program that creates the script by reading the path, block names ans attributes from a tct file that I would modify every time. However, I feel there must be a more efficient solution.

So that's it. I would need a solution that allows me to easily change the path of the folder I want to batch attedit and change the block name, attribute name and values to replace, using AutoCad LT.

Any help or idea would be kindly appreciated.
Thank you so much
Best regards
0 Likes
Accepted solutions (2)
4,059 Views
5 Replies
Replies (5)
Message 2 of 6

roland.r71
Collaborator
Collaborator

You should check out script generators. They can do exactly what you want.

You can use something like ScriptPro, or anything similar.

0 Likes
Message 3 of 6

Anonymous
Not applicable
Thanks for your repply.
I managed fo do sth with a .bat file.
However, I didnt manage to run any Script Writer. I can't install ScriptPro even though I download it from Autodesk website. It says it's missing a dll file and can't figure out the solution (I read sth about it not working in 64 bits). Other such as Autoscript don't run in AutoCAD LT. Any ideas? Thanks
0 Likes
Message 4 of 6

roland.r71
Collaborator
Collaborator

I can't recommend any, as i never use LT. (so i wrote my own script generator in AutoLISP)

I only used one some 14 years ago, when i was just beginning to learn lisp.

 

But when looking around, i see a lot of references to: Hurricane

Which is only free, for non-profit use.

 

However, i'm currently at work and here i can't install anything. So, i can't try anything or see if i can get scriptPro running. Might try at home. (but can only test with full version of AutoCAD)

0 Likes
Message 5 of 6

roland.r71
Collaborator
Collaborator
Accepted solution

I was unsuccesfull at getting scriptpro to run, or any other for that matter.

Haven't found a useable (free) script generator yet. Most are very, very old and won't run (or install) on my 64bits windows 10 machine.

 

There are alternatives, like excell, but i don't know how exactly to do that.

 

It's one of the reasons i personally don't want the LT version. It's missing the most powerfull part of Acad.

0 Likes
Message 6 of 6

Anonymous
Not applicable
Accepted solution

If anyone wonders, the solution I used at the end was running the .bat file explained in this other thread:

 

https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/batch-file-for-script-problem/td-p/6...

 

Thank you for your time

0 Likes