More information here first would be helpful; there's already a lot of talented folks participating before I chimed in.
Also, if you didn't know that you could do this all from C#, perhaps it would be prudent to first exhaust the Script/LISP level of capability, before jumping to doing this all in C#. :beer:
Others may have additional questions, but I'm particularly interested to know if you're doing this on active drawing only, or multiple drawings.
If the former, cull the Script/LISP from your C# plugin, save it within your SFSP and simply use them as-is (with any enhancements made here, of course) and load/call them as you would any normal Script/LISP on the active document.
If the latter, there are multiple ways to approach batch processing... the fastest I've seen, is to use Core Console to process multiple drawings in parallel.
Here's an example, using LISP + DOSLib, that loads Core Console using the active session's Profile info (code copied from a 2018 post in another forum that uses BB formatting, revise as needed):
(vl-load-com)
(defun c:SCRM() (c:ScriptMultiple))
(defun c:ScriptMultiple (/ app flag dwgs dwgPath script cprofile)
;;;
;;; AcCoreConsole.exe [/i <input dwg>] /s <script>[/product <product>] [/l <language>]
;;; [/isolate <userid> <userDataFolder>] [/readonly] [/p[rofile] <profile>]
;;;
(if
(and
(setq app (findfile "accoreconsole.exe"))
(setq flag (dos_version))
(setq dwgs
(dos_getfilem
"Select drawing(s) to process:"
(if *Dwg_LastPath*
*Dwg_LastPath*
(getvar 'dwgprefix)
)
"Drawing files (*.dwg)|*.dwg||"
)
)
(setq *Dwg_LastPath* (car dwgs))
(setq dwgPath *Dwg_LastPath*)
(setq dwgs (cdr dwgs))
(setq script
(dos_getfiled
"Select a Script to run:"
(if *Script_LastPath*
*Script_LastPath*
"[COLOR="#FF0000"]C:\\ProgramData\\Autodesk\\C3D 2019\\BatchSaveTool\\Scripts[/COLOR]"
)
"Script (*.scr)|*.scr||"
)
)
(setq *Script_LastPath* (vl-filename-directory script))
(setq cprofile (getvar 'cprofile))
)
(progn
(foreach dwg dwgs
(startapp
(strcat
"\""
app
"\" /i \""
dwgPath
dwg
"\" /s \""
script
"\" /product \"[COLOR="#FF0000"]C3D[/COLOR]\" /p \""
cprofile
"\""
)
)
)
)
(cond
(dwgs (prompt "\n** No script selected ** \n"))
(flag (prompt "\n** No drawing(s) selected ** \n"))
(app (prompt "\n** DOSLib required ** \n"))
((prompt
"\n** Unable to find \"AcCoreConsole.exe\" in support paths ** \n"
)
)
)
)
(princ)
)
Here's an example, using Windows Shell Menu from File Explorer (outside of CAD), to right click --> plot DWG to PDF, using Autopublish (assuming you've set that up for PDF, etc):
@BlackBox_ wrote:
<snip>
What takes PUBLISH (written in ARX not .NET) 30+ minutes to produce PDFs, only takes +/- 3 minutes using Core Console with this Windows Shell menu (and a lot less code! Haha):
** The size and configuration of a plan set determine the relative time each takes (few multi-layout drawings vs many single-layout drawings, the latter actually takes less time to process).
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\*\shell\RightClickDwgToPdf]
@="2026 DWG to PDF"
"AppliesTo"=".dwg"
; "Icon"="C:\\Program Files\\Autodesk\\AutoCAD 2026\\accoreconsole.exe"
"HasLUAShield"=""
"Position"="Bottom"
[HKEY_CLASSES_ROOT\*\shell\RightClickDwgToPdf\command]
@="\"C:\\Program Files\\Autodesk\\AutoCAD 2026\\accoreconsole.exe\" /i \"%1\" /ld \"C:\\Program Files\\Autodesk\\AutoCAD 2026\\AecBase.dbx\" /p \"<YourProfileHere>\" /product \"C3D\" /language \"en-US\" /s \"C:\\<YourFilePathHere>\\RightClickDwgToPdf.scr\""
Here's the dependent Script:
;; reload layer state, set other sysvars
(setvar 'automaticpub 1)
(command ".QSAVE")
Cheers