Does anyone have any ideas on how I can batch run a LISP routine in a set of external .dwg’s? I am inserting a block into a bunch of .dwg’s in a Dynamo script right now, but I need to run attsync on files to update the attributes of the block. I have a LISP routine that does attsync on all blocks called attsyncall.
Why not just build the node/code to do the attsync in Dynamo? While there isn’t a direct API call it’s certainly doable via the API, as indicated in this external forum post form 2013: https://www.theswamp.org/index.php?topic=31859.msg508802#msg508802
Showing my age & a bit off-topic for this forum, but you don’t need a LISP routine- just a script
In Excel, create a batch file as follows- replacing drawing names etc, with one line per drawing
“C:\Program Files\Autodesk\AutoCAD 2025\acad.exe” “C:\Users\YourUser\Documents\MyDrawing.dwg” /b “C:\Users\YourUser\Scripts\MyScript.scr”
Create a script file (MyScript.scr) as follows- replacing with your block name:
ATTSYNC
Name
blockname
I’d be surprised if it took more than 5 mins
I used this and ChatGPT to create a python script that seems to work pretty well!
With one major caveat… it doesn’t work on file with a viewport in the external file. I am well beyond my knowledge now, so my information comes from ChatGPT, but ChatGPT said the viewports have XData with them and its causing the script to fail on files with viewports in them. Is there a way to avoid this so I can leave the viewports in the file? Or have I gone down a path with ChatGPT that I shouldn’t have.
Not sure - it would help to have the script you’re using. Weighing in on chat gpt’s thoughts won’t be a good use of anyone’s time.
You could also use the Batch Save Utility. This allows you to run a script against a series of selected files. You could potentially use it to do the original insert and then run the attsync command. In your current case, it could be used to just run through all the files and run attsync since you already have a lisp routine.
