AutoCAD Core Console: Simple script will not explode all blocks in drawing

669 Views Asked by At

I am using AutoCAD Core Console to run a script via batch file to explode all blocks in a folder of AutoCAD drawing (DWG) files.

Batch file

FOR %%f IN ("%~dp0*.dwg") DO "C:\Program Files\Autodesk\AutoCAD 2021\accoreconsole.exe" /i "%%f" /s "%~dp0scripts\explode.scr" /l en-US

Script

EXPLODE
ALL
QSAVE

The above commands will explode all objects when executed in the AutoCAD UI, but the script will only explode one block per drawing leaving the rest of the blocks intact. Any ideas where I'm going wrong?

1

There are 1 best solutions below

0
On

The solution is setting the QAFLAGS system variable to 1 and then back to 0 after the explode command. Setting the QAFLAGS variable back to 0 is critical as this can cause unpredictable issues with other commands.

QAFLAGS
1

EXPLODE
ALL

QAFLAGS
0
QSAVE