BatchGenerator.show vbModeless Macro
- Last UpdatedJan 30, 2025
- 4 minute read
The macro is designed to create a batch operation that runs on multiple drawings selected by the user.
Note:
The macro can be executed manually by the user with a command defined in the lisp
routine: AVVMAC_CRBATCH.
The AVEVA P&ID Batch Manager dialog can be used to manage batch operations.

Note:
To run batch processing using native AutoCAD, check the Using Native AutoCAD checkbox.
Search Path Depth
There is a limit of 256 characters that can be set as part of the AutoCAD environment when creating a batch file with the application. The user must limit the number of environment paths to include in the batch file as part of the AutoCAD environment. The default value is 5 for native AutoCAD users. The user can increase or decrease the value according to the requirement. The path location of the macro files must be included within the folder path of the selected depth range.
Setting the location of AutoCAD support, fonts and line type paths is enough to run AutoCAD successfully. Make sure these environment paths are set among the path depth range selected on the dialog.
The example indicates the environment paths used for the the creation of the batch file using a depth range value of 4.

Browse
Click Browse to specify the drawings to be batch processed.
Use the Select Folder window to navigate to the drawings.

Select the drawings to be batch processed. The selected drawings display in the AVEVA P&ID Batch Manager dialog.

The commands to be executed on each drawing are displayed under the script node.
Script Definition
The scripts can be customized in the acaddoc.lsp file. For example:
;;;-------------------------------------------------------------------------
;;;BEGIN SCRIPT FILE CONTENT
;;;-------------------------------------------------------------------------
;;;._CMDECHO 1
;;;._ZOOM _E
;;;(setvar "expert" 3)
;;;(command "-linetype" "load" "*" "Acad.lin" "")
;;;._REGENALL
;;;(princ " Linetype Successfully reload it\n")
;;;._QSAVE
;;;._QUIT _N
;;;-------------------------------------------------------------------------
;;;END SCRIPT FILE CONTENT
;;;-------------------------------------------------------------------------
Create
Click Create to create an operating batch file.
At the end of the process, a message displays indicating the location of the created batch file.

The example displays a created batch file:
@ECHO OFF
PUSHD "%~dp0%"
@ECHO ON
"C:\Program Files\Autodesk\AutoCAD 2025\acad.exe" "D:\Projects\RHL\Drawings\5-AD1001393WA0001.DWG " /nologo /s "C:\Program Files\Autodesk\AutoCAD 2025\Support ;C:\Program Files\Autodesk\AutoCAD 2022\Fonts ;C:\Program Files\Autodesk\AutoCAD 2025\Help ;C:\Program Files\Autodesk\AutoCAD 2025\Express ;C:\Program Files (x86)\Autodesk\ApplicationPlugins\Autodesk AppManager.bundle\Contents\Windows ;C:\Program Files (x86)\Autodesk\ApplicationPlugins\Autodesk AppManager.bundle\Contents\Windows\2025 ;C:\Program Files (x86)\Autodesk\ApplicationPlugins\Autodesk FeaturedApps.bundle\Contents\Resources ;C:\Users\guillermo.tula\OneDrive - AVEVA Solutions Limited\Documents ;C:\Users\guillermo.tula\OneDrive - AVEVA Solutions Limited\Documents" /b "D:\Projects\RHL\Drawings\UpdateDrawing.scr"
@ECHO OFF
PUSHD "%~dp0%"
@ECHO ON
"C:\Program Files\Autodesk\AutoCAD 2025\acad.exe" "D:\Projects\RHL\Drawings\D014\D014-DEURDE\D014-DEURDE-OTHER\RHL-000103651.DWG " /nologo /s "C:\Program Files\Autodesk\AutoCAD 2025\Support ;C:\Program Files\Autodesk\AutoCAD 2025\Fonts ;C:\Program Files\Autodesk\AutoCAD 2025\Help ;C:\Program Files\Autodesk\AutoCAD 2025\Express ;C:\Program Files (x86)\Autodesk\ApplicationPlugins\Autodesk AppManager.bundle\Contents\Windows ;C:\Program Files (x86)\Autodesk\ApplicationPlugins\Autodesk AppManager.bundle\Contents\Windows\2025 ;C:\Program Files (x86)\Autodesk\ApplicationPlugins\Autodesk FeaturedApps.bundle\Contents\Resources ;C:\Users\guillermo.tula\OneDrive - AVEVA Solutions Limited\Documents ;C:\Users\guillermo.tula\OneDrive - AVEVA Solutions Limited\Documents" /b "D:\Projects\RHL\Drawings\UpdateDrawing.scr"
@ECHO OFF
PUSHD "%~dp0%"
@ECHO ON
"C:\Program Files\Autodesk\AutoCAD 2025\acad.exe" "D:\Projects\RHL\Drawings\D014\D014-DEURDE\D014-DEURDE-OTHER\RHL-000104925.DWG " /nologo /s "C:\Program Files\Autodesk\AutoCAD 2025\Support ;C:\Program Files\Autodesk\AutoCAD 2025\Fonts ;C:\Program Files\Autodesk\AutoCAD 2025\Help ;C:\Program Files\Autodesk\AutoCAD 2025\Express ;C:\Program Files (x86)\Autodesk\ApplicationPlugins\Autodesk AppManager.bundle\Contents\Windows ;C:\Program Files (x86)\Autodesk\ApplicationPlugins\Autodesk AppManager.bundle\Contents\Windows\2025 ;C:\Program Files (x86)\Autodesk\ApplicationPlugins\Autodesk FeaturedApps.bundle\Contents\Resources ;C:\Users\guillermo.tula\OneDrive - AVEVA Solutions Limited\Documents ;C:\Users\guillermo.tula\OneDrive - AVEVA Solutions Limited\Documents" /b "D:\Projects\RHL\Drawings\UpdateDrawing.scr"
@ECHO OFF
PUSHD "%~dp0%"
@ECHO ON
"C:\Program Files\Autodesk\AutoCAD 2025\acad.exe" "D:\Projects\RHL\Drawings\D014\D014-MMD\D014-LBAFLGAS\RHL-000257646.DWG " /nologo /s "C:\Program Files\Autodesk\AutoCAD 2025\Support ;C:\Program Files\Autodesk\AutoCAD 2025\Fonts ;C:\Program Files\Autodesk\AutoCAD 2025\Help ;C:\Program Files\Autodesk\AutoCAD 2025\Express ;C:\Program Files (x86)\Autodesk\ApplicationPlugins\Autodesk AppManager.bundle\Contents\Windows ;C:\Program Files (x86)\Autodesk\ApplicationPlugins\Autodesk AppManager.bundle\Contents\Windows\2025 ;C:\Program Files (x86)\Autodesk\ApplicationPlugins\Autodesk FeaturedApps.bundle\Contents\Resources ;C:\Users\guillermo.tula\OneDrive - AVEVA Solutions Limited\Documents ;C:\Users\guillermo.tula\OneDrive - AVEVA Solutions Limited\Documents" /b "D:\Projects\RHL\Drawings\UpdateDrawing.scr"
A script file is created, indicating the scripts to be executed for each drawing. For example:
._CMDECHO 1
._ZOOM _E
(setvar "expert" 3)
(command "-linetype" "load" "*" "Acad.lin" "")
._REGENALL
(princ " Linetype Successfully reload it\n")
._QSAVE
._QUIT _N
Note:
Execute the batch file directly from the operating system to complete the workflow.